summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-15 15:32:29 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-16 00:03:41 +0200
commit6eea58b542d59e08b4630535b0dbe78d37e6c705 (patch)
tree1f1c5ccb49c8195f67fdb3dd55ab6634838da66f /compat
parenteda1973442f61e7c85eba31bec8e271c07b24095 (diff)
compat/options: cast to the right type for bigger than word things
Diffstat (limited to 'compat')
-rw-r--r--compat/options.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/compat/options.hpp b/compat/options.hpp
index 432ed52a..454cc99a 100644
--- a/compat/options.hpp
+++ b/compat/options.hpp
@@ -160,6 +160,13 @@ namespace options {
#define OPENTRACK_DEFINE_SLOT(t) void setValue(t datum) { store(datum); }
#define OPENTRACK_DEFINE_SIGNAL(t) void valueChanged(t)
+ namespace detail {
+ template<typename t> struct value_type_traits { using type = t;};
+ template<> struct value_type_traits<QString> { using type = const QString&; };
+ template<> struct value_type_traits<slider_value> { using type = const slider_value&; };
+ template<typename t> using value_type_t = typename value_type_traits<t>::type;
+ }
+
class OPENTRACK_COMPAT_EXPORT base_value : public QObject
{
Q_OBJECT
@@ -181,7 +188,7 @@ namespace options {
void store(const t& datum)
{
b->store_kv(self_name, QVariant::fromValue(datum));
- emit valueChanged(static_cast<t>(datum));
+ emit valueChanged(static_cast<detail::value_type_t<t>>(datum));
}
void store(float datum)
{