numerical values of data as tooltip; closes #90

This commit is contained in:
Dominik Demuth 2023-07-08 19:55:20 +02:00
parent ead9751541
commit 91afe8224f
2 changed files with 5 additions and 4 deletions

View File

@ -68,8 +68,9 @@ class DataTree(QtWidgets.QTreeWidget):
for row in range(self.invisibleRootItem().childCount()):
graph = self.invisibleRootItem().child(row)
if graph.data(0, QtCore.Qt.UserRole) == gid:
for (idd, name) in items:
for (idd, name, value) in items:
item = QtWidgets.QTreeWidgetItem([name])
item.setToolTip(0, f'Value: {value}')
item.setData(0, QtCore.Qt.UserRole, idd)
item.setCheckState(0, QtCore.Qt.Checked)
item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsEditable |
@ -566,9 +567,9 @@ class DataWidget(QtWidgets.QWidget, Ui_DataWidget):
self.tree.add_graph(idd, name)
self.tree.blockSignals(False)
def add_item(self, idd: str, name: str, gid: str):
def add_item(self, idd: str, name: str, value: str, gid: str):
self.tree.blockSignals(True)
self.tree.add_item((idd, name), gid)
self.tree.add_item((idd, name, value), gid)
self.tree.blockSignals(False)
def add_item_list(self, loi: list, gid: str):

View File

@ -354,7 +354,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
for idd in sets:
new_item = self.management[idd]
self.datawidget.blockSignals(True)
self.datawidget.add_item(new_item.id, new_item.name, graph)
self.datawidget.add_item(new_item.id, new_item.name, new_item.value, graph)
self.datawidget.blockSignals(False)
# if graph == self.fit_dialog.connected_figure: