mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-17 22:25:37 +00:00
Qt: Don't store floats in settings as QVariant data
This commit is contained in:
parent
da0059fb21
commit
ccbe6f0c42
|
@ -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)
|
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)
|
void QtSettingsInterface::SetBoolValue(const char* section, const char* key, bool value)
|
||||||
|
@ -76,7 +76,7 @@ std::vector<std::string> QtSettingsInterface::GetStringList(const char* section,
|
||||||
{
|
{
|
||||||
QVariant value = m_settings.value(GetFullKey(section, key));
|
QVariant value = m_settings.value(GetFullKey(section, key));
|
||||||
if (value.type() == QVariant::String)
|
if (value.type() == QVariant::String)
|
||||||
return { value.toString().toStdString() };
|
return {value.toString().toStdString()};
|
||||||
else if (value.type() != QVariant::StringList)
|
else if (value.type() != QVariant::StringList)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ void BindWidgetToNormalizedSetting(QtHostInterface* hi, WidgetType* widget, cons
|
||||||
|
|
||||||
Accessor::connectValueChanged(widget, [hi, widget, setting_name, range]() {
|
Accessor::connectValueChanged(widget, [hi, widget, setting_name, range]() {
|
||||||
const float new_value = (static_cast<float>(Accessor::getIntValue(widget)) / range);
|
const float new_value = (static_cast<float>(Accessor::getIntValue(widget)) / range);
|
||||||
hi->putSettingValue(setting_name, new_value);
|
hi->putSettingValue(setting_name, QString::number(new_value));
|
||||||
hi->applySettings();
|
hi->applySettings();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue