From da4ee3868d7a014be42e998a7b7c98a149586d85 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 17 Dec 2021 13:46:46 +0100 Subject: options, tracker/pt: allow force-reloading value_::valueChanged Fixes auto threshold slider label text on toggling the checkbox without dragging the slider. --- options/base-value.hpp | 1 + options/value.hpp | 13 +++++++++++++ tracker-pt/ftnoir_tracker_pt_dialog.cpp | 4 +--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/options/base-value.hpp b/options/base-value.hpp index 6365f82a..d0fa42cf 100644 --- a/options/base-value.hpp +++ b/options/base-value.hpp @@ -95,6 +95,7 @@ public slots: virtual void set_to_default() noexcept = 0; virtual void notify() const = 0; + virtual void notify_() const = 0; virtual QVariant get_variant() const noexcept = 0; }; diff --git a/options/value.hpp b/options/value.hpp index 85b76cb6..090a7bdf 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -94,6 +94,19 @@ public: return traits::qvariant_from_value(def); } + never_inline + void notify_() const override + { + auto x = get(); + { + QMutexLocker l(&mtx); + cached_value = x; + } + maybe_trace("notify +"); + emit valueChanged(traits::storage_from_value(x)); + maybe_trace("notify -"); + } + never_inline void notify() const override { diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp index 6d125d92..75428bfe 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp @@ -115,9 +115,7 @@ TrackerDialog_PT::TrackerDialog_PT(const QString& module_name) : }); // refresh threshold display on auto-threshold checkbox state change - tie_setting(s.auto_threshold, - this, - [this](bool) { s.threshold_slider.notify(); }); + tie_setting(s.auto_threshold, this, [this](bool) { s.threshold_slider.notify_(); }); tie_setting(s.enable_point_filter, ui.enable_point_filter); tie_setting(s.point_filter_coefficient, ui.point_filter_slider); -- cgit v1.2.3