From c2761a0b577921061660df4daf322bf0263c06df Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Thu, 6 Jun 2024 11:53:31 -0500 Subject: [PATCH] Casting input value to setData to a CheckState for correct comparison (#149) --- openmc_plotter/plotmodel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openmc_plotter/plotmodel.py b/openmc_plotter/plotmodel.py index 453c8a5..a2c453b 100644 --- a/openmc_plotter/plotmodel.py +++ b/openmc_plotter/plotmodel.py @@ -1314,10 +1314,10 @@ def setData(self, index, value, role=Qt.EditRole): self.domains.set_color(key, value) elif column == MASK: if role == Qt.CheckStateRole: - self.domains.set_masked(key, value == Qt.Checked) + self.domains.set_masked(key, Qt.CheckState(value) == Qt.Checked) elif column == HIGHLIGHT: if role == Qt.CheckStateRole: - self.domains.set_highlight(value == Qt.Checked) + self.domains.set_highlight(Qt.CheckState(value) == Qt.Checked) self.dataChanged.emit(index, index) return True @@ -1367,7 +1367,7 @@ def setEditorData(self, editor, index): def editorEvent(self, event, model, option, index): if index.column() in (COLOR, COLORLABEL): - if not (index.flags() & Qt.ItemIsEditable).value > 0: + if not int(index.flags() & Qt.ItemIsEditable) > 0: return False if event.type() == QEvent.MouseButtonRelease \ and event.button() == Qt.RightButton: