-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreferences.cpp
More file actions
38 lines (31 loc) · 1014 Bytes
/
preferences.cpp
File metadata and controls
38 lines (31 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "preferences.h"
#include <QSettings>
QVariant loadPref(QSettings *pref, const QString &key) {
return pref->value(key);
}
QVariant loadPref(QSettings *pref, const QString &group, const QString &key) {
pref->beginGroup(group);
auto value = pref->value(key);
pref->endGroup();
return value;
}
QVariant loadPref(QSettings *pref, const QString &key,
const QVariant &defValue) {
return pref->value(key, defValue);
}
QVariant loadPref(QSettings *pref, const QString &group, const QString &key,
const QVariant &defValue) {
pref->beginGroup(group);
auto value = pref->value(key, defValue);
pref->endGroup();
return value;
}
void savePref(QSettings *pref, const QString &key, const QVariant &value) {
pref->setValue(key, value);
}
void savePref(QSettings *pref, const QString &group, const QString &key,
const QVariant &value) {
pref->beginGroup(group);
pref->setValue(key, value);
pref->endGroup();
}