Skip to content

Commit

Permalink
Make items in filter list auto tristate (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulromano authored Jun 7, 2024
1 parent c2761a0 commit d7ac96a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion openmc_plotter/docks.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ def _createFilterTree(self, spatial_filters):
0, "Only tallies with spatial filters are viewable.")
else:
filter_item.setFlags(
filter_item.flags() | QtCore.Qt.ItemIsUserCheckable)
filter_item.flags() | QtCore.Qt.ItemIsUserCheckable |
QtCore.Qt.ItemIsAutoTristate)
filter_item.setCheckState(0, QtCore.Qt.Unchecked)

# all mesh bins are selected by default and not shown in the dock
Expand Down
2 changes: 1 addition & 1 deletion openmc_plotter/plotmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ def setData(self, index, value, role=Qt.EditRole):
self.domains.set_masked(key, Qt.CheckState(value) == Qt.Checked)
elif column == HIGHLIGHT:
if role == Qt.CheckStateRole:
self.domains.set_highlight(Qt.CheckState(value) == Qt.Checked)
self.domains.set_highlight(key, Qt.CheckState(value) == Qt.Checked)

self.dataChanged.emit(index, index)
return True
Expand Down

0 comments on commit d7ac96a

Please sign in to comment.