mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
qPref: only save settings that aren't the default
This brings us back to the previous behavior. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d88f865793
commit
e71b049498
7 changed files with 30 additions and 27 deletions
|
@ -9,14 +9,17 @@ void qPrefPrivate::copy_txt(const char **name, const QString &string)
|
|||
*name = copy_qstring(string);
|
||||
}
|
||||
|
||||
void qPrefPrivate::propSetValue(const QString &key, const QVariant &value)
|
||||
void qPrefPrivate::propSetValue(const QString &key, const QVariant &value, const QVariant &defaultValue)
|
||||
{
|
||||
// REMARK: making s static (which would be logical) does NOT work
|
||||
// because it gets initialized too early.
|
||||
// Having it as a local variable is light weight, because it is an
|
||||
// interface class.
|
||||
QSettings s;
|
||||
s.setValue(key, value);
|
||||
if (value != defaultValue)
|
||||
s.setValue(key, value);
|
||||
else
|
||||
s.remove(key);
|
||||
}
|
||||
|
||||
QVariant qPrefPrivate::propValue(const QString &key, const QVariant &defaultValue)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue