From 5100661c2d7c820638fa49a8e27dceb6685e39b7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Jul 2016 13:40:59 +0200 Subject: gui/mapping: fix axis asymmetry checkboxes value needs to persist over the checkbox's lifetime, otherwise the slot gets disconnected. --- gui/curve-config.cpp | 11 ++++++----- gui/curve-config.h | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'gui') diff --git a/gui/curve-config.cpp b/gui/curve-config.cpp index 19237c3c..257675b5 100644 --- a/gui/curve-config.cpp +++ b/gui/curve-config.cpp @@ -11,7 +11,7 @@ MapWidget::MapWidget(Mappings& m) : m(m) { - ui.setupUi( this ); + ui.setupUi(this); m.load_mappings(); @@ -21,8 +21,6 @@ MapWidget::MapWidget(Mappings& m) : connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - main_settings s; - tie_setting(s.a_x.altp, ui.tx_altp); tie_setting(s.a_y.altp, ui.ty_altp); tie_setting(s.a_z.altp, ui.tz_altp); @@ -67,6 +65,7 @@ void MapWidget::reload() { QFunctionConfigurator& qfc = *qfcs[i].qfc; connect(qfcs[i].checkbox, &QCheckBox::toggled, + this, [&](bool f) -> void {qfc.setEnabled(f); qfc.force_redraw();}); qfc.setEnabled(qfcs[i].checkbox->isChecked()); qfc.force_redraw(); @@ -82,12 +81,14 @@ void MapWidget::reload() } } -void MapWidget::doOK() { +void MapWidget::doOK() +{ m.save_mappings(); close(); } -void MapWidget::doCancel() { +void MapWidget::doCancel() +{ m.invalidate_unsaved(); close(); } diff --git a/gui/curve-config.h b/gui/curve-config.h index 33ce90fd..f13e5501 100644 --- a/gui/curve-config.h +++ b/gui/curve-config.h @@ -12,6 +12,8 @@ public: private: Ui::UICCurveConfigurationDialog ui; Mappings& m; + main_settings s; + void closeEvent(QCloseEvent *) override { doCancel(); } private slots: void doOK(); -- cgit v1.2.3