File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,16 @@ void GenerationSettingsWidget::updateOptions()
61
61
}
62
62
}
63
63
64
+ bool GenerationSettingsWidget::checkEditEnable ()
65
+ {
66
+ return checkEditEnable (editor_editid);
67
+ }
68
+
69
+ bool GenerationSettingsWidget::checkEditEnable (int editid)
70
+ {
71
+ return factory != nullptr && editid >= 0 && editid < factory->getOptions ().size ();
72
+ }
73
+
64
74
void GenerationSettingsWidget::generateColorSelectionEditorControls ()
65
75
{
66
76
int index = 0 ;
@@ -240,7 +250,7 @@ void GenerationSettingsWidget::editor_editOptionByID(int editId)
240
250
241
251
void GenerationSettingsWidget::editor_setEditId (int editId)
242
252
{
243
- editor_editid = editId;
253
+ if ( checkEditEnable (editId)) editor_editid = editId;
244
254
editor_updateStatusLabel ();
245
255
}
246
256
@@ -303,7 +313,7 @@ void GenerationSettingsWidget::list_editSelectedOption()
303
313
void GenerationSettingsWidget::editor_changemode ()
304
314
{
305
315
if (!editor_editmode) {
306
- if (editor_editid < factory-> getOptions (). size ()) {
316
+ if (checkEditEnable ()) {
307
317
editor_setEditMode (!editor_editmode);
308
318
editor_reset ();
309
319
}
@@ -315,6 +325,9 @@ void GenerationSettingsWidget::editor_changemode()
315
325
316
326
void GenerationSettingsWidget::editor_reset ()
317
327
{
328
+ if (!checkEditEnable ()) {
329
+ editor_changemode ();
330
+ }
318
331
if (editor_editmode) {
319
332
editor_setParams (factory->getOptions ()[editor_editid]);
320
333
}
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ class GenerationSettingsWidget : public QWidget
18
18
private:
19
19
void generateColorSelectionEditorControls ();
20
20
void updateOptions ();
21
+ bool checkEditEnable ();
22
+ bool checkEditEnable (int editid);
21
23
22
24
void selecter_setupGenerationAmont ();
23
25
void selecter_setOptionsList (std::vector<SimulationModel::Cells::CellFactory::GenerateOption> options);
You can’t perform that action at this time.
0 commit comments