From ccbe6f0c423d70a2aa83949ef8e6a9fd1244a107 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 28 Feb 2020 17:00:07 +1000 Subject: [PATCH] Qt: Don't store floats in settings as QVariant data --- src/duckstation-qt/qtsettingsinterface.cpp | 4 ++-- src/duckstation-qt/settingwidgetbinder.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/duckstation-qt/qtsettingsinterface.cpp b/src/duckstation-qt/qtsettingsinterface.cpp index a9843da63..66aeefeb9 100644 --- a/src/duckstation-qt/qtsettingsinterface.cpp +++ b/src/duckstation-qt/qtsettingsinterface.cpp @@ -59,7 +59,7 @@ void QtSettingsInterface::SetIntValue(const char* section, const char* key, int void QtSettingsInterface::SetFloatValue(const char* section, const char* key, float value) { - m_settings.setValue(GetFullKey(section, key), QVariant(value)); + m_settings.setValue(GetFullKey(section, key), QString::number(value)); } void QtSettingsInterface::SetBoolValue(const char* section, const char* key, bool value) @@ -76,7 +76,7 @@ std::vector QtSettingsInterface::GetStringList(const char* section, { QVariant value = m_settings.value(GetFullKey(section, key)); if (value.type() == QVariant::String) - return { value.toString().toStdString() }; + return {value.toString().toStdString()}; else if (value.type() != QVariant::StringList) return {}; diff --git a/src/duckstation-qt/settingwidgetbinder.h b/src/duckstation-qt/settingwidgetbinder.h index 4d7832627..b58831911 100644 --- a/src/duckstation-qt/settingwidgetbinder.h +++ b/src/duckstation-qt/settingwidgetbinder.h @@ -172,7 +172,7 @@ void BindWidgetToNormalizedSetting(QtHostInterface* hi, WidgetType* widget, cons Accessor::connectValueChanged(widget, [hi, widget, setting_name, range]() { const float new_value = (static_cast(Accessor::getIntValue(widget)) / range); - hi->putSettingValue(setting_name, new_value); + hi->putSettingValue(setting_name, QString::number(new_value)); hi->applySettings(); }); }