summaryrefslogtreecommitdiffhomepage
path: root/options/value-traits.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-07-01 18:07:03 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-07-01 18:07:03 +0200
commita67e8630caf20e7f48151024e9e68dd9271d75c7 (patch)
treee7418eabdfb4abd6ca88c0ba6a427ca5a40e7c32 /options/value-traits.hpp
parent74dff816c07737b7e697e5d63222e59a9fefe23e (diff)
options/value: add `QObject::connect` wrapper
This is useful not just to save on complexity in call sites, but also because I plan on using the Verdigris library to remove needless `valueChanged()` and `setValue()` overloads from each `value<t>` instance. Also fix a bug in `options/tie.hpp` where `QComboBox::setCurrentIndex` was erroneously called as `Qt::DirectConnection`.
Diffstat (limited to 'options/value-traits.hpp')
-rw-r--r--options/value-traits.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/options/value-traits.hpp b/options/value-traits.hpp
index 145cd924..e676f942 100644
--- a/options/value-traits.hpp
+++ b/options/value-traits.hpp
@@ -15,6 +15,17 @@ using cv_qualified =
std::remove_cvref_t<t>,
std::add_lvalue_reference_t<std::add_const_t<std::remove_cvref_t<t>>>>;
+template<typename t, typename = void>
+struct maybe_enum_type {
+ using type = t;
+};
+template<typename t>
+struct maybe_enum_type<t, std::enable_if_t<std::is_enum_v<t>>> {
+ using type = int;
+};
+
+template<typename t> using maybe_enum_type_t = typename maybe_enum_type<t>::type;
+
template<typename t, typename u = t, typename Enable = void>
struct default_value_traits
{