summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-05-26 16:58:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-05-26 16:58:28 +0200
commiteeddec10f1f5a9374290438bab4abf246912e5ca (patch)
tree373529956c34432074083dceef8419fa0dd3b663 /opentrack-compat
parentea036f6f9fc40877515965a009a83f1c2c0cf73a (diff)
compat/options: switch to correct QVariant usage
Diffstat (limited to 'opentrack-compat')
-rw-r--r--opentrack-compat/options.hpp23
1 files 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<typename t> using mem = std::shared_ptr<t>;
namespace options {
template<typename k, typename v> using map = std::map<k, v>;
- template<typename t>
- // 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<unsigned>(const QVariant &t) { return t.toUInt(); }
-
- template<> inline int qcruft_to_t<int>(const QVariant& t) { return t.toInt(); }
-
- template<> inline QString qcruft_to_t<QString>(const QVariant& t) { return t.toString(); }
-
- template<> inline bool qcruft_to_t<bool>(const QVariant& t) { return t.toBool(); }
-
- template<> inline double qcruft_to_t<double>(const QVariant& t) { return t.toDouble(); }
-
- template<> inline QVariant qcruft_to_t<QVariant>(const QVariant& t) { return t; }
-
- template<> inline float qcruft_to_t<float>(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<t>(value->second);
+ return value->second.value<t>();
return t();
}
};
@@ -183,7 +164,7 @@ namespace options {
template<typename t>
void store(const t& datum)
{
- b->store_kv(self_name, datum);
+ b->store_kv(self_name, QVariant::fromValue(datum));
emit valueChanged(static_cast<t>(datum));
}
public slots: