summaryrefslogtreecommitdiffstats
path: root/libsettings
diff options
context:
space:
mode:
Diffstat (limited to 'libsettings')
-rw-r--r--libsettings/src/basicsettingsobject.cpp5
-rw-r--r--libsettings/src/inisettingsobject.cpp5
-rw-r--r--libsettings/src/setting.cpp9
3 files changed, 16 insertions, 3 deletions
diff --git a/libsettings/src/basicsettingsobject.cpp b/libsettings/src/basicsettingsobject.cpp
index 66a2c2c8..484928c8 100644
--- a/libsettings/src/basicsettingsobject.cpp
+++ b/libsettings/src/basicsettingsobject.cpp
@@ -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());
}
}
diff --git a/libsettings/src/inisettingsobject.cpp b/libsettings/src/inisettingsobject.cpp
index 75228865..8c4cc89d 100644
--- a/libsettings/src/inisettingsobject.cpp
+++ b/libsettings/src/inisettingsobject.cpp
@@ -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());
}
}
diff --git a/libsettings/src/setting.cpp b/libsettings/src/setting.cpp
index a224ad39..1a4f9e13 100644
--- a/libsettings/src/setting.cpp
+++ b/libsettings/src/setting.cpp
@@ -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