From 694d932abef0a21d0c576465caacec1243bb00ab Mon Sep 17 00:00:00 2001 From: Torsten Sommer Date: Thu, 21 Nov 2024 10:03:27 +0100 Subject: [PATCH] Fix flags for plot column when item is not a variable --- fmpy/gui/model.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fmpy/gui/model.py b/fmpy/gui/model.py index 578e9a31..f8a54098 100644 --- a/fmpy/gui/model.py +++ b/fmpy/gui/model.py @@ -138,15 +138,14 @@ def flags(self, index): column = self.COLUMN_NAMES[index.column()] - if column == 'Plot': - variable = self.variableForIndex(index) - if not variable or variable.dimensions: - return Qt.ItemIsSelectable - return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable - elif column == 'Start': + if column == 'Start': return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsEditable - else: - return Qt.ItemIsEnabled | Qt.ItemIsSelectable + elif column == 'Plot': + variable = self.variableForIndex(index) + if variable and not variable.dimensions: + return Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable + + return Qt.ItemIsEnabled | Qt.ItemIsSelectable def setData(self, index: QModelIndex | QPersistentModelIndex, value: Any, role: int):