diff --git a/piker/ui/_search.py b/piker/ui/_search.py index 72a1bfa6..c8d25f41 100644 --- a/piker/ui/_search.py +++ b/piker/ui/_search.py @@ -63,37 +63,21 @@ from PyQt5.QtWidgets import ( QTreeView, # QListWidgetItem, # QAbstractScrollArea, - QStyledItemDelegate, + # QStyledItemDelegate, ) from ..log import get_logger from ._style import ( _font, - DpiAwareFont, + # DpiAwareFont, ) -from ._forms import FontAndChartAwareLineEdit +from ._forms import FontAndChartAwareLineEdit, FontScaledDelegate log = get_logger(__name__) -class SimpleDelegate(QStyledItemDelegate): - """ - Super simple view delegate to render text in the same - font size as the search widget. - - """ - - def __init__( - self, - parent=None, - font: DpiAwareFont = _font, - ) -> None: - super().__init__(parent) - self.dpi_font = font - - class CompleterView(QTreeView): mode_name: str = 'search-nav' @@ -130,7 +114,7 @@ class CompleterView(QTreeView): self.labels = labels # a std "tabular" config - self.setItemDelegate(SimpleDelegate()) + self.setItemDelegate(FontScaledDelegate(self)) self.setModel(model) self.setAlternatingRowColors(True) # TODO: size this based on DPI font