From e494441366934326bbbd769375af377b0dd30273 Mon Sep 17 00:00:00 2001 From: lovac42 Date: Sat, 21 Dec 2019 01:15:38 -0500 Subject: [PATCH 1/2] added code to handle ToolTipRole in SidebarModel --- aqt/browser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aqt/browser.py b/aqt/browser.py index 69803d77b..75d5eaf62 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -394,6 +394,7 @@ class SidebarItem: self.expanded = expanded self.children: List["SidebarItem"] = [] self.parentItem: Optional[SidebarItem] = None + self.tooltip = None def addChild(self, cb: "SidebarItem") -> None: self.children.append(cb) @@ -457,13 +458,15 @@ class SidebarModel(QAbstractItemModel): if not index.isValid(): return QVariant() - if role not in (Qt.DisplayRole, Qt.DecorationRole): + if role not in (Qt.DisplayRole, Qt.DecorationRole, Qt.ToolTipRole): return QVariant() item: SidebarItem = index.internalPointer() if role == Qt.DisplayRole: return QVariant(item.name) + elif role == Qt.ToolTipRole: + return QVariant(item.tooltip) else: return QVariant(self.iconFromRef(item.icon)) From f5ddaef04c1a14a81ede65245142687eb140ee13 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 21 Dec 2019 16:44:38 +1000 Subject: [PATCH 2/2] add type hint --- aqt/browser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aqt/browser.py b/aqt/browser.py index 75d5eaf62..91a596252 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -394,7 +394,7 @@ class SidebarItem: self.expanded = expanded self.children: List["SidebarItem"] = [] self.parentItem: Optional[SidebarItem] = None - self.tooltip = None + self.tooltip: Optional[str] = None def addChild(self, cb: "SidebarItem") -> None: self.children.append(cb)