From 971a8b7b493e7bf5cdefc3d862bfcc754f4a59ab Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 24 Oct 2024 12:10:47 -0400 Subject: [PATCH] Fix grid settings dialog not restoring defaults when closed with X button --- src/ui/gridsettings.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/gridsettings.cpp b/src/ui/gridsettings.cpp index b4e180af..d3346f11 100644 --- a/src/ui/gridsettings.cpp +++ b/src/ui/gridsettings.cpp @@ -117,6 +117,7 @@ void GridSettingsDialog::init() { connect(ui->button_LinkDimensions, &QAbstractButton::toggled, [this](bool on) { m_dimensionsLinked = on; }); connect(ui->button_LinkOffsets, &QAbstractButton::toggled, [this](bool on) { m_offsetsLinked = on; }); connect(ui->colorInput, &ColorInputWidget::colorChanged, this, &GridSettingsDialog::onColorChanged); + connect(this, &GridSettingsDialog::rejected, [this] { setSettings(m_originalSettings); }); updateInput(); } @@ -218,11 +219,10 @@ void GridSettingsDialog::dialogButtonClicked(QAbstractButton *button) { auto role = ui->buttonBox->buttonRole(button); if (role == QDialogButtonBox::AcceptRole) { // "OK" - close(); + accept(); } else if (role == QDialogButtonBox::RejectRole) { // "Cancel" - setSettings(m_originalSettings); - close(); + reject(); } else if (role == QDialogButtonBox::ResetRole) { // "Restore Defaults" setSettings(m_defaultSettings);