From d9b29684268636d7c936c76981d489e9fb29b24e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 5 Apr 2016 13:25:14 +0800 Subject: [PATCH] gui/models/DictSyncTreeSepModel: support tooltips --- artiq/gui/models.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/artiq/gui/models.py b/artiq/gui/models.py index 0cdcba968..74f17d6f2 100644 --- a/artiq/gui/models.py +++ b/artiq/gui/models.py @@ -359,19 +359,27 @@ class DictSyncTreeSepModel(QtCore.QAbstractItemModel): return key def data(self, index, role): - if not index.isValid() or role != QtCore.Qt.DisplayRole: + if not index.isValid() or (role != QtCore.Qt.DisplayRole + and role != QtCore.Qt.ToolTipRole): return None else: column = index.column() - if column == 0: + if column == 0 and role == QtCore.Qt.DisplayRole: return index.internalPointer().name else: key = self.index_to_key(index) if key is None: return None else: - return self.convert(key, self.backing_store[key], - column) + if role == QtCore.Qt.DisplayRole: + convert = self.convert + else: + convert = self.convert_tooltip + return convert(key, self.backing_store[key], + column) def convert(self, k, v, column): raise NotImplementedError + + def convert_tooltip(self, k, v, column): + return None