@@ -57,7 +57,7 @@ class LoadPlanDialog(QDialog, LoadPlanDialogBase): # type: ignore
57
57
search_line_edit : QLineEdit
58
58
button_box : QDialogButtonBox
59
59
60
- ID_COLUMN = 4
60
+ # ID_COLUMN = 4
61
61
62
62
def __init__ (self , parent , connection_names : list [str ]):
63
63
super ().__init__ (parent )
@@ -79,14 +79,14 @@ def __init__(self, parent, connection_names: list[str]):
79
79
self .plan_table_view .setSelectionBehavior (QTableView .SelectRows )
80
80
81
81
self .model = QStandardItemModel ()
82
- self .model .setColumnCount (5 )
82
+ self .model .setColumnCount (4 )
83
83
self .model .setHorizontalHeaderLabels (
84
84
[
85
85
"Nimi" ,
86
- "Tuottajan kaavatunnus" ,
87
86
"Kaavalaji" ,
88
87
"Kaavan elinkaaren tila" ,
89
- "ID" ,
88
+ "Tuottajan kaavatunnus" ,
89
+ # "ID",
90
90
]
91
91
)
92
92
@@ -97,9 +97,9 @@ def __init__(self, parent, connection_names: list[str]):
97
97
# self.plan_table_view.setSortingEnabled(True)
98
98
99
99
header = self .plan_table_view .horizontalHeader ()
100
- for i in range (4 ):
100
+ for i in range (3 ):
101
101
header .setSectionResizeMode (i , QHeaderView .ResizeToContents )
102
- header .setSectionResizeMode (4 , QHeaderView .Stretch )
102
+ header .setSectionResizeMode (3 , QHeaderView .Stretch )
103
103
104
104
# Show plans for the first connections by default
105
105
# NOTE: Could be changed to the previously used connection if/when plugin can remember it
@@ -124,12 +124,13 @@ def load_plans(self):
124
124
self .model .appendRow (
125
125
[
126
126
QStandardItem (name or "" ),
127
- QStandardItem (producers_plan_identifier or "" ),
128
127
QStandardItem (plan_type or "" ),
129
128
QStandardItem (lifecycle_status or "" ),
130
- QStandardItem (id_ or "" ),
129
+ QStandardItem (producers_plan_identifier or "" ),
130
+ # QStandardItem(id_ or ""),
131
131
]
132
132
)
133
+ self .model .item (i , 0 ).setData (id_ , Qt .UserRole )
133
134
if active_plan_id == id_ :
134
135
row_to_select = i
135
136
@@ -191,7 +192,7 @@ def on_selection_changed(self):
191
192
selection = self .plan_table_view .selectionModel ().selectedRows ()
192
193
if selection :
193
194
selected_row = selection [0 ].row ()
194
- self ._selected_plan_id = self .plan_table_view .model ().index (selected_row , self . ID_COLUMN ).data ()
195
+ self ._selected_plan_id = self .plan_table_view .model ().index (selected_row , 0 ).data (Qt . UserRole )
195
196
self .button_box .button (QDialogButtonBox .Ok ).setEnabled (True )
196
197
else :
197
198
self ._selected_plan_id = None
0 commit comments