Fix settings objects, instances can be started from the GUI now
This commit is contained in:
@ -26,7 +26,10 @@ void BasicSettingsObject::changeSetting(const Setting &setting, QVariant value)
|
||||
{
|
||||
if (contains(setting.id()))
|
||||
{
|
||||
config.setValue(setting.configKey(), value);
|
||||
if(value.isValid())
|
||||
config.setValue(setting.configKey(), value);
|
||||
else
|
||||
config.remove(setting.configKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,10 @@ void INISettingsObject::changeSetting(const Setting &setting, QVariant value)
|
||||
{
|
||||
if (contains(setting.id()))
|
||||
{
|
||||
m_ini.set(setting.configKey(), value);
|
||||
if(value.isValid())
|
||||
m_ini.set(setting.configKey(), value);
|
||||
else
|
||||
m_ini.remove(setting.configKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,16 @@ QVariant Setting::get() const
|
||||
{
|
||||
SettingsObject *sbase = qobject_cast<SettingsObject *>(parent());
|
||||
if (!sbase)
|
||||
{
|
||||
return defValue();
|
||||
}
|
||||
else
|
||||
return sbase->retrieveValue(*this);
|
||||
{
|
||||
QVariant test = sbase->retrieveValue(*this);
|
||||
if(!test.isValid())
|
||||
return defValue();
|
||||
return test;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant Setting::defValue() const
|
||||
|
Reference in New Issue
Block a user