DtkCore
DTK Core module
|
DSettingsOption is the base key/value item of DSettings. 更多...
Public 槽 | |
void | setValue (QVariant value) |
Set current value of option. 更多... | |
void | setData (const QString &dataType, QVariant value) |
Set custom data. 更多... | |
信号 | |
void | valueChanged (QVariant value) |
Emit when option value change. 更多... | |
void | dataChanged (const QString &dataType, QVariant value) |
Emit when option data change. 更多... | |
Public 成员函数 | |
DSettingsOption (QObject *parent=Q_NULLPTR) | |
QPointer< DSettingsGroup > | parentGroup () const |
Get direct parent group of this option. 更多... | |
void | setParentGroup (QPointer< DSettingsGroup > parentGroup) |
Change the direct parent group of this option. 更多... | |
QString | key () const |
Return the full key of this option, include all parent. 更多... | |
QString | name () const |
Get display name of the option, it may be translated. 更多... | |
bool | canReset () const |
Check this option can be reset to default value. if false, reset action will not take effect. 更多... | |
QVariant | defaultValue () const |
Default value of this option, must config in this json desciption file. 更多... | |
QVariant | value () const |
Get current value of option. 更多... | |
QVariant | data (const QString &dataType) const |
Custom data of option, like QObject::property. dataType 数据类型. 更多... | |
QString | viewType () const |
UI widget type of this option. 更多... | |
bool | isHidden () const |
Check this option will show on DSettings dialog. 更多... | |
静态 Public 成员函数 | |
static QPointer< DSettingsOption > | fromJson (const QString &prefixKey, const QJsonObject &json) |
Convert QJsonObject to DSettingsOption. 更多... | |
属性 | |
QVariant | value |
Current value of this option. | |
DSettingsOption is the base key/value item of DSettings.
\inmodule dtkcore
DSettingsOption是DSettings的基本单元,用于存放一对键-值数据。
bool Dtk::Core::DSettingsOption::canReset | ( | ) | const |
Check this option can be reset to default value. if false, reset action will not take effect.
选项是否可以重置,如果可以重置,在调用reset方法后,选项的值会变成初始值.
QVariant Dtk::Core::DSettingsOption::data | ( | const QString & | dataType | ) | const |
Custom data of option, like QObject::property. dataType 数据类型.
选项的附件data,用于未选项设置一些额外的辅助属性.
|
signal |
Emit when option data change.
选项的附件的额外数据变化时发出改信息,可以看作这个值的属性发生变化.
dataType 改变的数据类型, value 改变的数据.
QVariant Dtk::Core::DSettingsOption::defaultValue | ( | ) | const |
Default value of this option, must config in this json desciption file.
选项的默认值.
|
static |
Convert QJsonObject to DSettingsOption.
从json对象中反序列化出一个选项对象.
prefixKey instead parse prefix key from parent. prefixKey 选项的前缀 json is an QJsonObejct instance. json 待反序列化的json对象
bool Dtk::Core::DSettingsOption::isHidden | ( | ) | const |
Check this option will show on DSettings dialog.
检查选项是否会在界面上显示.
QString Dtk::Core::DSettingsOption::key | ( | ) | const |
Return the full key of this option, include all parent.
当前选项的键值.
QString Dtk::Core::DSettingsOption::name | ( | ) | const |
Get display name of the option, it may be translated.
当前选项的名称.
QPointer< DSettingsGroup > Dtk::Core::DSettingsOption::parentGroup | ( | ) | const |
Get direct parent group of this option.
当前选项的直接上级组。
|
slot |
Set custom data.
\brief Override default value of json \a value ‍/
void DSettingsOption::setDefault(QVariant value) { Q_D(DSettingsOption); d->defalutValue = value; }
/*!
为选项添加自定义属性. dataType is data id, just a unique string. value of the data id. dataType 选项的扎属性数据id,对每个选项必须唯一 value 选项id对应的值
void Dtk::Core::DSettingsOption::setParentGroup | ( | QPointer< DSettingsGroup > | parentGroup | ) |
Change the direct parent group of this option.
修改但前选项的上级组.
parentGroup 上级组.
|
slot |
Set current value of option.
设置选项的当前值.
value 选项的当前值.
QVariant Dtk::Core::DSettingsOption::value | ( | ) | const |
Get current value of option.
选项的当前值.
|
signal |
Emit when option value change.
选项的数据变化时发出改信息.
value 发生改变的数据.
QString Dtk::Core::DSettingsOption::viewType | ( | ) | const |
UI widget type of this option.
选项的控件类型.