From 74dff816c07737b7e697e5d63222e59a9fefe23e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 1 Jul 2022 15:42:26 +0200 Subject: compat/macros: move cv_qualified to options/ --- options/base-value.hpp | 1 + options/tie.hpp | 4 ++-- options/value-traits.hpp | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'options') diff --git a/options/base-value.hpp b/options/base-value.hpp index d0fa42cf..eb8c89b7 100644 --- a/options/base-value.hpp +++ b/options/base-value.hpp @@ -26,6 +26,7 @@ class OTR_OPTIONS_EXPORT value_ : public QObject { Q_OBJECT + template using cv_qualified = detail::cv_qualified; template using signal_sig = void(value_::*)(cv_qualified) const; diff --git a/options/tie.hpp b/options/tie.hpp index 5cd8cbbc..46ade075 100644 --- a/options/tie.hpp +++ b/options/tie.hpp @@ -56,14 +56,14 @@ void tie_setting(value& v, QComboBox* cb, From&& fn_to_index, To&& fn_to_valu &v, [&v, cb, fn_to_value](int idx) { v = fn_to_value(idx, cb->currentData()); }, v.DIRECT_CONNTYPE); value_::connect(&v, value_::value_changed(), - cb, [cb, fn_to_index](cv_qualified& v) { cb->setCurrentIndex(fn_to_index(v)); }, + cb, [cb, fn_to_index](detail::cv_qualified& v) { cb->setCurrentIndex(fn_to_index(v)); }, v.DIRECT_CONNTYPE); } template void tie_setting(value& v, QLabel* lb, F&& fun) { - auto closure = [lb, fun](cv_qualified v) { lb->setText(fun(v)); }; + auto closure = [lb, fun](detail::cv_qualified v) { lb->setText(fun(v)); }; closure(v()); value_::connect(&v, value_::value_changed(), diff --git a/options/value-traits.hpp b/options/value-traits.hpp index 308e110c..145cd924 100644 --- a/options/value-traits.hpp +++ b/options/value-traits.hpp @@ -9,6 +9,11 @@ #include namespace options::detail { +template +using cv_qualified = + std::conditional_t>, + std::remove_cvref_t, + std::add_lvalue_reference_t>>>; template struct default_value_traits -- cgit v1.2.3