summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-01-13 05:51:57 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2022-01-13 05:52:31 +0100
commitc59bb67569bfe997f33410a6dafd2ef31749cd73 (patch)
tree35a27349705c74aab7c5a89a523ec4e42c769fe5 /src
parentSmall size and selection improvements for the settings page (diff)
downloadnheko-c59bb67569bfe997f33410a6dafd2ef31749cd73.tar.xz
Fix setting double values in setting spinboxes
Diffstat (limited to 'src')
-rw-r--r--src/UserSettingsPage.cpp13
-rw-r--r--src/UserSettingsPage.h3
2 files changed, 9 insertions, 7 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index c43727a2..c43733fb 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -1160,9 +1160,10 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
             return Options;
         case TimelineMaxWidth:
         case PrivacyScreenTimeout:
+            return Integer;
         case FontSize:
         case ScaleFactor:
-            return Number;
+            return Double;
         case MessageHoverHighlight:
         case EnlargeEmojiOnlyMessages:
         case Tray:
@@ -1345,7 +1346,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case ScaleFactor: {
-            if (value.canConvert<double>()) {
+            if (value.canConvert(QMetaType::Double)) {
                 utils::setScaleFactor(static_cast<float>(value.toDouble()));
                 return true;
             } else
@@ -1415,7 +1416,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case TimelineMaxWidth: {
-            if (value.userType() == QMetaType::Int) {
+            if (value.canConvert(QMetaType::Int)) {
                 i->setTimelineMaxWidth(value.toInt());
                 return true;
             } else
@@ -1472,7 +1473,7 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case PrivacyScreenTimeout: {
-            if (value.userType() == QMetaType::Int) {
+            if (value.canConvert(QMetaType::Int)) {
                 i->setPrivacyScreenTimeout(value.toInt());
                 return true;
             } else
@@ -1486,8 +1487,8 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
                 return false;
         }
         case FontSize: {
-            if (value.userType() == QMetaType::Double) {
-                i->setFontSize(value.toBool());
+            if (value.canConvert(QMetaType::Double)) {
+                i->setFontSize(value.toDouble());
                 return true;
             } else
                 return false;
diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h
index bcf34655..a44e0030 100644
--- a/src/UserSettingsPage.h
+++ b/src/UserSettingsPage.h
@@ -438,7 +438,8 @@ public:
         Toggle,
         ReadOnlyText,
         Options,
-        Number,
+        Integer,
+        Double,
         SectionTitle,
         SectionBar,
         KeyStatus,