mirror of https://github.com/m-labs/artiq.git
gui/models/DictSyncTreeSepModel: support tooltips
This commit is contained in:
parent
14caa2713c
commit
d9b2968426
|
@ -359,19 +359,27 @@ class DictSyncTreeSepModel(QtCore.QAbstractItemModel):
|
||||||
return key
|
return key
|
||||||
|
|
||||||
def data(self, index, role):
|
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
|
return None
|
||||||
else:
|
else:
|
||||||
column = index.column()
|
column = index.column()
|
||||||
if column == 0:
|
if column == 0 and role == QtCore.Qt.DisplayRole:
|
||||||
return index.internalPointer().name
|
return index.internalPointer().name
|
||||||
else:
|
else:
|
||||||
key = self.index_to_key(index)
|
key = self.index_to_key(index)
|
||||||
if key is None:
|
if key is None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return self.convert(key, self.backing_store[key],
|
if role == QtCore.Qt.DisplayRole:
|
||||||
|
convert = self.convert
|
||||||
|
else:
|
||||||
|
convert = self.convert_tooltip
|
||||||
|
return convert(key, self.backing_store[key],
|
||||||
column)
|
column)
|
||||||
|
|
||||||
def convert(self, k, v, column):
|
def convert(self, k, v, column):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def convert_tooltip(self, k, v, column):
|
||||||
|
return None
|
||||||
|
|
Loading…
Reference in New Issue