summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/base-value.hpp1
-rw-r--r--options/tie.hpp4
-rw-r--r--options/value-traits.hpp5
3 files changed, 8 insertions, 2 deletions
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<typename t> using cv_qualified = detail::cv_qualified<t>;
template<typename t>
using signal_sig = void(value_::*)(cv_qualified<t>) 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<t>& 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<t>(),
- cb, [cb, fn_to_index](cv_qualified<t>& v) { cb->setCurrentIndex(fn_to_index(v)); },
+ cb, [cb, fn_to_index](detail::cv_qualified<t>& v) { cb->setCurrentIndex(fn_to_index(v)); },
v.DIRECT_CONNTYPE);
}
template<typename t, typename F>
void tie_setting(value<t>& v, QLabel* lb, F&& fun)
{
- auto closure = [lb, fun](cv_qualified<t> v) { lb->setText(fun(v)); };
+ auto closure = [lb, fun](detail::cv_qualified<t> v) { lb->setText(fun(v)); };
closure(v());
value_::connect(&v, value_::value_changed<t>(),
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 <QString>
namespace options::detail {
+template<typename t>
+using cv_qualified =
+ std::conditional_t<std::is_fundamental_v<std::remove_cvref_t<t>>,
+ std::remove_cvref_t<t>,
+ std::add_lvalue_reference_t<std::add_const_t<std::remove_cvref_t<t>>>>;
template<typename t, typename u = t, typename Enable = void>
struct default_value_traits