From f0216a3c53d43918295f1bd81975b391f4e5ed3b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 5 Oct 2018 15:54:01 +0200 Subject: options: don't use typeindex w/ lambdas Rename traits' functions to be more explicit. Most of the changes are pretty old and I can't read them at this time, sorry. Adjust usages. Issue: #825 Reported-by: @DanielKinsman --- options/base-value.hpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'options/base-value.hpp') diff --git a/options/base-value.hpp b/options/base-value.hpp index 750f93f1..6a4709ee 100644 --- a/options/base-value.hpp +++ b/options/base-value.hpp @@ -15,7 +15,6 @@ #include #include -#include #include #define OTR_OPTIONS_SLOT(t) void setValue(t datum) { store_(datum); } @@ -29,13 +28,12 @@ class OTR_OPTIONS_EXPORT value_ : public QObject friend class detail::connector; - using comparator = bool(*)(const QVariant& val1, const QVariant& val2); template using signal_sig = void(value_::*)(cv_qualified) const; public: QString name() const { return self_name; } - value_(bundle const& b, const QString& name, comparator cmp, std::type_index type_idx); + value_(bundle const& b, const QString& name); ~value_() override; // no C++17 "constexpr inline" for data declarations in MSVC @@ -68,8 +66,6 @@ signals: protected: bundle b; QString self_name; - comparator cmp; - std::type_index type_index; virtual void store_variant(const QVariant& x) = 0; @@ -77,8 +73,7 @@ protected: void store_(const t& datum) { using traits = detail::value_traits; - using stored_type = typename traits::stored_type; - store_variant(QVariant::fromValue(datum)); + store_variant(traits::qvariant_from_value(datum)); } public slots: @@ -98,11 +93,10 @@ public slots: OTR_OPTIONS_SLOT(const QList&) OTR_OPTIONS_SLOT(const QList&) - 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(value_* val); + friend void ::options::detail::set_value_to_default(value_* val); }; } //ns options -- cgit v1.2.3