Skip to content

Commit

Permalink
fixed domain contrast display
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhroom committed Nov 11, 2024
1 parent a707691 commit 3ab2bb0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rascal2/widgets/delegates.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,13 @@ def createEditor(self, parent, option, index):
layers = self.project_widget.draft_project["layers"]
widget.addItems([layer.name for layer in layers])

current_layers = index.data(QtCore.Qt.ItemDataRole.DisplayRole)
widget.select_indices([i for i, layer in enumerate(layers) if layer in current_layers])

return widget

def setEditorData(self, editor: MultiSelectComboBox, index):
data = index.data(QtCore.Qt.ItemDataRole.DisplayRole)
editor.select_indices([i for i, layer in enumerate(data) if layer in data])
layers = self.project_widget.draft_project["layers"]

editor.select_indices([i for i, layer in enumerate(layers) if layer.name in data])

def setModelData(self, editor, model, index):
data = editor.selected_items()
Expand Down
2 changes: 2 additions & 0 deletions rascal2/widgets/project/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def data(self, index, role=QtCore.Qt.ItemDataRole.DisplayRole):
# pyqt can't automatically coerce enums to strings...
if isinstance(data, Enum):
return str(data)
if isinstance(data, list):
return ", ".join(data)
return data
elif role == QtCore.Qt.ItemDataRole.CheckStateRole and self.index_header(index) == "fit":
return QtCore.Qt.CheckState.Checked if data else QtCore.Qt.CheckState.Unchecked
Expand Down

0 comments on commit 3ab2bb0

Please sign in to comment.