DtkCore
DTK Core module
|
DSettingsBackend is interface of DSettings storage class. 更多...
信号 | |
void | optionChanged (const QString &key, const QVariant &value) |
emitted when option value changed. 更多... | |
void | sync () |
private signal, please do not use it. 更多... | |
void | setOption (const QString &key, const QVariant &value) |
private signal, please do not use it. 更多... | |
Public 成员函数 | |
DSettingsBackend (QObject *parent=Q_NULLPTR) | |
virtual QStringList | keys () const =0 |
return all key of storage. 更多... | |
virtual QVariant | getOption (const QString &key) const =0 |
get value by key. 更多... | |
virtual void | doSync ()=0 |
do the real sync action. 更多... | |
Protected 成员函数 | |
virtual void | doSetOption (const QString &key, const QVariant &value)=0 |
write key / value to storage. 更多... | |
DSettingsBackend is interface of DSettings storage class.
\inmodule dtkcore
Simaple example:
How to read/write key and value: \code // init a storage backend QTemporaryFile tmpFile; tmpFile.open(); auto backend = new Dtk::Core::QSettingBackend(tmpFile.fileName()); // read settings from json auto settings = Dtk::Core::DSettings::fromJsonFile(":/resources/data/dfm-settings.json"); settings->setBackend(backend); // read value auto opt = settings->option("base.new_tab_windows.new_window_path"); qDebug() << opt->value(); // modify value opt->setValue("Test") qDebug() << opt->value();
|
protectedpure virtual |
write key / value to storage.
设置key对应的值,并使用存储后端进行存储。
|
pure virtual |
do the real sync action.
开始进行同步。
|
pure virtual |
get value by key.
获取 key 对应的值。
在 Dtk::Core::DSettingsDConfigBackend, Dtk::Core::GSettingsBackend , 以及 Dtk::Core::QSettingBackend 内被实现.
|
pure virtual |
return all key of storage.
返回全部键值。
在 Dtk::Core::DSettingsDConfigBackend, Dtk::Core::GSettingsBackend , 以及 Dtk::Core::QSettingBackend 内被实现.
|
signal |
emitted when option value changed.
DSettingsOption的值发生变化时发出的信号.
key 发生改变的 option 键,value 对应键的值.
|
signal |
private signal, please do not use it.
私有信号,请勿使用.
|
signal |
private signal, please do not use it.
私有信号,请勿使用。