DtkCore
DTK Core module
Dtk::Core::DSettingsOption类 参考

DSettingsOption is the base key/value item of DSettings. 更多...

类 Dtk::Core::DSettingsOption 继承关系图:

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< DSettingsGroupparentGroup () 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< DSettingsOptionfromJson (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的基本单元,用于存放一对键-值数据。

成员函数说明

◆ canReset()

bool Dtk::Core::DSettingsOption::canReset ( ) const

Check this option can be reset to default value. if false, reset action will not take effect.

选项是否可以重置,如果可以重置,在调用reset方法后,选项的值会变成初始值.

返回
true if can be reset.

◆ data()

QVariant Dtk::Core::DSettingsOption::data ( const QString &  dataType) const

Custom data of option, like QObject::property. dataType 数据类型.

选项的附件data,用于未选项设置一些额外的辅助属性.

返回
数据类型对应的数据.
参见
QObject::property
Dtk::Core::DSettingsOption::setData

◆ dataChanged

void Dtk::Core::DSettingsOption::dataChanged ( const QString &  dataType,
QVariant  value 
)
signal

Emit when option data change.

选项的附件的额外数据变化时发出改信息,可以看作这个值的属性发生变化.

dataType 改变的数据类型, value 改变的数据.

◆ defaultValue()

QVariant Dtk::Core::DSettingsOption::defaultValue ( ) const

Default value of this option, must config in this json desciption file.

选项的默认值.

返回
返回选项的默认值.

◆ fromJson()

QPointer< DSettingsOption > Dtk::Core::DSettingsOption::fromJson ( const QString &  prefixKey,
const QJsonObject &  json 
)
static

Convert QJsonObject to DSettingsOption.

从json对象中反序列化出一个选项对象.

prefixKey instead parse prefix key from parent. prefixKey 选项的前缀 json is an QJsonObejct instance. json 待反序列化的json对象

返回
返回解析完成后的 option 数据.

◆ isHidden()

bool Dtk::Core::DSettingsOption::isHidden ( ) const

Check this option will show on DSettings dialog.

检查选项是否会在界面上显示.

返回
true if option not bind to ui element.
如果显示则返回true,否则返回false。

◆ key()

QString Dtk::Core::DSettingsOption::key ( ) const

Return the full key of this option, include all parent.

当前选项的键值.

返回
返回当前选项的键值.

◆ name()

QString Dtk::Core::DSettingsOption::name ( ) const

Get display name of the option, it may be translated.

当前选项的名称.

返回
返回当前选项的名称.

◆ parentGroup()

QPointer< DSettingsGroup > Dtk::Core::DSettingsOption::parentGroup ( ) const

Get direct parent group of this option.

当前选项的直接上级组。

返回
返回当前选项的直接上级组.

◆ setData

void Dtk::Core::DSettingsOption::setData ( const QString &  dataType,
QVariant  value 
)
slot

Set custom data.

 \brief Override default value of json
 \a value
&zwj;/

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对应的值

参见
Dtk::Core::DSettingsOption::data
Dtk::Core::DSettingsOption::data

◆ setParentGroup()

void Dtk::Core::DSettingsOption::setParentGroup ( QPointer< DSettingsGroup parentGroup)

Change the direct parent group of this option.

修改但前选项的上级组.

parentGroup 上级组.

◆ setValue

void Dtk::Core::DSettingsOption::setValue ( QVariant  value)
slot

Set current value of option.

设置选项的当前值.

value 选项的当前值.

◆ value()

QVariant Dtk::Core::DSettingsOption::value ( ) const

Get current value of option.

选项的当前值.

返回
返回选项的当前值.

◆ valueChanged

void Dtk::Core::DSettingsOption::valueChanged ( QVariant  value)
signal

Emit when option value change.

选项的数据变化时发出改信息.

value 发生改变的数据.

◆ viewType()

QString Dtk::Core::DSettingsOption::viewType ( ) const

UI widget type of this option.

选项的控件类型.

返回
返回选项的控件类型.
参见
Dtk::Widget::DSettingsWidgetFactory

该类的文档由以下文件生成: