@@ -43,6 +43,9 @@ foucaultView::foucaultView(QWidget *parent, SurfaceManager *sm) :
4343 // Using name() and string check for robust color persistence
4444 m_gridColor = QColor (set.value (" ronchiGrid/color" , " #00FFFF" ).toString ()); // Default Cyan
4545 m_textColor = QColor (set.value (" ronchiGrid/textColor" , " #FFFFFF" ).toString ()); // Default White
46+
47+ // Color storage (using local temps for the dialog session)
48+
4649}
4750
4851
@@ -118,17 +121,16 @@ void foucaultView::showGrid() {
118121 QCheckBox *textToggle = new QCheckBox (" Show unit labels" , &dlg);
119122 textToggle->setChecked (m_showUnitLabels);
120123
121- // Color storage (using local temps for the dialog session)
122- struct State { QColor grid; QColor text; } colors = { m_gridColor, m_textColor };
123-
124124 QPushButton *btnGridCol = new QPushButton (" Grid Color" );
125125 QPushButton *btnTextCol = new QPushButton (" Text Color" );
126126
127- connect (btnGridCol, &QPushButton::clicked, [&]() {
127+ colors = { m_gridColor, m_textColor }; // store current values
128+
129+ connect (btnGridCol, &QPushButton::clicked, this ,[this ]() {
128130 QColor c = QColorDialog::getColor (colors.grid , this );
129131 if (c.isValid ()) colors.grid = c;
130132 });
131- connect (btnTextCol, &QPushButton::clicked, [& ]() {
133+ connect (btnTextCol, &QPushButton::clicked, this , [ this ]() {
132134 QColor c = QColorDialog::getColor (colors.text , this );
133135 if (c.isValid ()) colors.text = c;
134136 });
@@ -146,7 +148,7 @@ void foucaultView::showGrid() {
146148 form.addRow (&buttonBox);
147149
148150 // Reset Logic
149- connect (resetBtn, &QPushButton::clicked, [& ]() {
151+ connect (resetBtn, &QPushButton::clicked, this , [= ]() {
150152 unitCombo->setCurrentIndex (0 ); // None
151153 spacingSpin->setValue (10.0 );
152154 widthSpin->setValue (1 );
0 commit comments