From eeddec10f1f5a9374290438bab4abf246912e5ca Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 26 May 2016 16:58:28 +0200 Subject: compat/options: switch to correct QVariant usage --- opentrack-compat/options.hpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/opentrack-compat/options.hpp b/opentrack-compat/options.hpp index 2ed05f80..19b36152 100644 --- a/opentrack-compat/options.hpp +++ b/opentrack-compat/options.hpp @@ -52,25 +52,6 @@ template using mem = std::shared_ptr; namespace options { template using map = std::map; - template - // don't elide usages of the function, qvariant default implicit - // conversion results in nonsensical runtime behavior -sh - inline t qcruft_to_t (const QVariant& datum); - - template<> inline unsigned qcruft_to_t(const QVariant &t) { return t.toUInt(); } - - template<> inline int qcruft_to_t(const QVariant& t) { return t.toInt(); } - - template<> inline QString qcruft_to_t(const QVariant& t) { return t.toString(); } - - template<> inline bool qcruft_to_t(const QVariant& t) { return t.toBool(); } - - template<> inline double qcruft_to_t(const QVariant& t) { return t.toDouble(); } - - template<> inline QVariant qcruft_to_t(const QVariant& t) { return t; } - - template<> inline float qcruft_to_t(const QVariant& t) { return t.toFloat(); } - // snapshot of qsettings group at given time class OPENTRACK_COMPAT_EXPORT group { private: @@ -92,7 +73,7 @@ namespace options { { auto value = kvs.find(k); if (value != kvs.cend()) - return qcruft_to_t(value->second); + return value->second.value(); return t(); } }; @@ -183,7 +164,7 @@ namespace options { template void store(const t& datum) { - b->store_kv(self_name, datum); + b->store_kv(self_name, QVariant::fromValue(datum)); emit valueChanged(static_cast(datum)); } public slots: -- cgit v1.2.3