diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-13 15:05:05 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-13 15:09:26 +0200 |
commit | 9a0822c445e56580fb3034224191ec825ea0274a (patch) | |
tree | 9fce6a93bb72a0db6b60015b58272abe0fba68ba /options/base-value.hpp | |
parent | 887dd41c5d67c30bd1e9631920d8fc1c3dd1a3f0 (diff) |
options/tie: change "tie" overloads
Adjust usages.
There are ODR issues with MSVC and it doesn't support
C++17 "static inline constexpr" _variables_. Otherwise,
"signal_fun" could be a variable and not a function.
The usages in accela/ewma2 dialog are more verbose now
but the original API was silly.
Diffstat (limited to 'options/base-value.hpp')
-rw-r--r-- | options/base-value.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/options/base-value.hpp b/options/base-value.hpp index 4f90e3fc..5106908d 100644 --- a/options/base-value.hpp +++ b/options/base-value.hpp @@ -22,13 +22,25 @@ namespace options { class OTR_OPTIONS_EXPORT base_value : public QObject { Q_OBJECT + friend class detail::connector; using comparator = bool(*)(const QVariant& val1, const QVariant& val2); + template<typename t> + using signal_sig = void(base_value::*)(cv_qualified<t>) const; public: QString name() const { return self_name; } base_value(bundle b, const QString& name, comparator cmp, std::type_index type_idx); ~base_value() override; + + // MSVC has ODR problems in 15.4 + // no C++17 "constexpr inline" for data declarations in MSVC + template<typename t> + constexpr static auto signal_fun() + { + return static_cast<signal_sig<t>>(&base_value::valueChanged); + } + signals: OPENTRACK_DEFINE_SIGNAL(double); OPENTRACK_DEFINE_SIGNAL(float); @@ -80,6 +92,8 @@ public slots: virtual void reload() = 0; virtual void bundle_value_changed() const = 0; virtual void set_to_default() = 0; + + friend void ::options::detail::set_base_value_to_default(base_value* val); }; } //ns options |