QtCanpool 3.3.0
载入中...
搜索中...
未找到
QxApp::QxProperty结构体 参考

One setting, described well enough to be edited. 更多...

#include <qxapp/qxproperty.h>

Public 类型

enum  Type {
  Bool , Int , Double , String ,
  Text , Enum , Color , Font ,
  Path
}
 The kind of value the property takes, and therefore the control it is edited with. 更多...
 
enum  PathMode { ExistingFile , AnyFile , Directory }
 What the browse button of a Path property is looking for. 更多...
 

Public 属性

QString key
 Stable name the value is stored under.
 
QString label
 Text shown next to the control; the key is used when it is empty.
 
Type type = String
 
QVariant value
 The current value.
 
QVariant defaultValue
 The value the property has when nobody has set it.
 
QStringList choices
 The choices an Enum offers; unused by every other type.
 
QString tooltip
 Text shown when the pointer rests on the control.
 
PathMode pathMode = ExistingFile
 What the browse button picks, for Path.
 
bool readOnly = false
 Whether the control is shown disabled.
 

详细描述

One setting, described well enough to be edited.

A property is a value with a name, not a row of widgets: it says what the setting is called, what kind of value it takes, what it is worth now and what it is worth when nobody has said anything. QxPropertyEditor turns a list of them into a form, and a settings dialog turns them into keys of a configuration file.

QxProperty theme;
theme.key = QStringLiteral("appearance/theme");
theme.label = tr("Theme");
theme.choices = QStringList{tr("Light"), tr("Dark")};
theme.value = QStringLiteral("Light");
theme.defaultValue = QStringLiteral("Light");
One setting, described well enough to be edited.
Definition qxproperty.h:44
QStringList choices
The choices an Enum offers; unused by every other type.
Definition qxproperty.h:79
QVariant defaultValue
The value the property has when nobody has set it.
Definition qxproperty.h:77
QString key
Stable name the value is stored under.
Definition qxproperty.h:70
QVariant value
The current value.
Definition qxproperty.h:75
QString label
Text shown next to the control; the key is used when it is empty.
Definition qxproperty.h:72
@ Enum
a combo box over choices
Definition qxproperty.h:54

The key is the part that has to be stable: it is what the value is stored under, so renaming it abandons every value a user ever chose. The label, the tooltip and the choices are presentation and may be translated freely.

The struct is plain data on purpose - there is nothing to inherit from and no state to hide, so a caller can build one with aggregate initialisation or keep a static table of them.

在文件 qxproperty.h 第 44 行定义.

成员枚举类型说明

◆ PathMode

What the browse button of a Path property is looking for.

枚举值
ExistingFile 

a file that has to be there

AnyFile 

a file, whether or not it exists yet

Directory 

a folder

在文件 qxproperty.h 第 62 行定义.

◆ Type

The kind of value the property takes, and therefore the control it is edited with.

枚举值
Bool 

a check box

Int 

a spin box

Double 

a spin box with decimals

String 

a single line edit

Text 

a multi line edit

Enum 

a combo box over choices

Color 

a colour button

Font 

a font button

Path 

a line edit with a browse button

在文件 qxproperty.h 第 48 行定义.

类成员变量说明

◆ choices

QStringList QxApp::QxProperty::choices

The choices an Enum offers; unused by every other type.

在文件 qxproperty.h 第 79 行定义.

◆ defaultValue

QVariant QxApp::QxProperty::defaultValue

The value the property has when nobody has set it.

在文件 qxproperty.h 第 77 行定义.

◆ key

QString QxApp::QxProperty::key

Stable name the value is stored under.

Never translate it.

在文件 qxproperty.h 第 70 行定义.

◆ label

QString QxApp::QxProperty::label

Text shown next to the control; the key is used when it is empty.

在文件 qxproperty.h 第 72 行定义.

◆ pathMode

PathMode QxApp::QxProperty::pathMode = ExistingFile

What the browse button picks, for Path.

在文件 qxproperty.h 第 83 行定义.

◆ readOnly

bool QxApp::QxProperty::readOnly = false

Whether the control is shown disabled.

在文件 qxproperty.h 第 85 行定义.

◆ tooltip

QString QxApp::QxProperty::tooltip

Text shown when the pointer rests on the control.

在文件 qxproperty.h 第 81 行定义.

◆ type

Type QxApp::QxProperty::type = String

在文件 qxproperty.h 第 73 行定义.

◆ value

QVariant QxApp::QxProperty::value

The current value.

在文件 qxproperty.h 第 75 行定义.


该结构体的文档由以下文件生成: