QtCanpool 3.3.0
载入中...
搜索中...
未找到
QxApp::QxPropertyEditor类 参考

A form built from a list of QxProperty descriptors. 更多...

#include <qxapp/qxpropertyeditor.h>

类 QxApp::QxPropertyEditor 继承关系图:

Public 成员函数

 QxPropertyEditor (QWidget *parent=0)
 
 ~QxPropertyEditor () override
 
int count () const
 
QStringList keys () const
 The keys of the properties, in the order they were added.
 
bool contains (const QString &key) const
 
void addProperty (const QxProperty &property)
 Adds property to the section the last addGroup() opened, or to the plain form when there is none yet.
 
void addGroup (const QString &title, const QList< QxProperty > &properties)
 Opens a section titled title and adds properties to it.
 
QVariant value (const QString &key) const
 The current value of key, or an invalid QVariant when there is no such property.
 
void setValue (const QString &key, const QVariant &value)
 
void setAllValues (const QHash< QString, QVariant > &values)
 Sets every key of values that this editor knows and takes the result as the new baseline, so isModified() is false right after this.
 
QHash< QString, QVariant > allValues () const
 The current value of every property.
 
bool isModified () const
 Whether the current values differ from the ones setAllValues() took as a baseline.
 
void reset ()
 Sets every property back to its defaultValue.
 
void resetToInitial ()
 Sets every property back to the values setAllValues() was given.
 
void valueChanged (const QString &key, const QVariant &value)
 A value changed, whether by the user or by the application.
 
void modifiedChanged (bool modified)
 isModified() changed.
 

详细描述

A form built from a list of QxProperty descriptors.

The editor is the key/value half of a settings dialog: it turns descriptors into controls, keeps the current value of every one of them, and reports when those values no longer match what they started as. It knows nothing about where a value came from or where it should end up - reading and writing a configuration file is the dialog's job (see QxSettingsDialog), and that split is what keeps this class testable without a settings backend behind it.

editor.addGroup(tr("Appearance"), {theme, fontSize});
editor.addProperty(showLineNumbers);
editor.setAllValues(loaded); // the baseline
connect(&editor, &QxPropertyEditor::modifiedChanged, this, [](bool on) { applyButton->setEnabled(on); });
A form built from a list of QxProperty descriptors.
void setAllValues(const QHash< QString, QVariant > &values)
Sets every key of values that this editor knows and takes the result as the new baseline,...
void addGroup(const QString &title, const QList< QxProperty > &properties)
Opens a section titled title and adds properties to it.
void addProperty(const QxProperty &property)
Adds property to the section the last addGroup() opened, or to the plain form when there is none yet.
void modifiedChanged(bool modified)
isModified() changed.

Sections work the way a form is read: addGroup() opens one and the properties added after it land inside it, until the next addGroup(). A property added before any group goes into the plain form at the top.

Two kinds of "back to normal" are offered, because they answer different questions: reset() goes back to the defaults a caller declared - what a fresh installation would have - while resetToInitial() goes back to the values handed to setAllValues(), which is what "discard my edits" means.

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

构造及析构函数说明

◆ QxPropertyEditor()

QxApp::QxPropertyEditor::QxPropertyEditor ( QWidget *  parent = 0)
explicit

在文件 qxpropertyeditor.cpp 第 534 行定义.

◆ ~QxPropertyEditor()

QxApp::QxPropertyEditor::~QxPropertyEditor ( )
override

在文件 qxpropertyeditor.cpp 第 543 行定义.

成员函数说明

◆ addGroup()

void QxApp::QxPropertyEditor::addGroup ( const QString &  title,
const QList< QxProperty > &  properties 
)

Opens a section titled title and adds properties to it.

在文件 qxpropertyeditor.cpp 第 586 行定义.

◆ addProperty()

void QxApp::QxPropertyEditor::addProperty ( const QxProperty &  property)

Adds property to the section the last addGroup() opened, or to the plain form when there is none yet.

A property whose key is already known is refused: two controls writing the same key would fight over it.

在文件 qxpropertyeditor.cpp 第 570 行定义.

◆ allValues()

QHash< QString, QVariant > QxApp::QxPropertyEditor::allValues ( ) const

The current value of every property.

在文件 qxpropertyeditor.cpp 第 650 行定义.

◆ contains()

bool QxApp::QxPropertyEditor::contains ( const QString &  key) const

在文件 qxpropertyeditor.cpp 第 564 行定义.

◆ count()

int QxApp::QxPropertyEditor::count ( ) const

在文件 qxpropertyeditor.cpp 第 548 行定义.

◆ isModified()

bool QxApp::QxPropertyEditor::isModified ( ) const

Whether the current values differ from the ones setAllValues() took as a baseline.

在文件 qxpropertyeditor.cpp 第 660 行定义.

◆ keys()

QStringList QxApp::QxPropertyEditor::keys ( ) const

The keys of the properties, in the order they were added.

在文件 qxpropertyeditor.cpp 第 554 行定义.

◆ modifiedChanged()

void QxApp::QxPropertyEditor::modifiedChanged ( bool  modified)

isModified() changed.

◆ reset()

void QxApp::QxPropertyEditor::reset ( )

Sets every property back to its defaultValue.

在文件 qxpropertyeditor.cpp 第 666 行定义.

◆ resetToInitial()

void QxApp::QxPropertyEditor::resetToInitial ( )

Sets every property back to the values setAllValues() was given.

在文件 qxpropertyeditor.cpp 第 675 行定义.

◆ setAllValues()

void QxApp::QxPropertyEditor::setAllValues ( const QHash< QString, QVariant > &  values)

Sets every key of values that this editor knows and takes the result as the new baseline, so isModified() is false right after this.

Keys that are not properties here are reported and skipped rather than stored.

在文件 qxpropertyeditor.cpp 第 630 行定义.

◆ setValue()

void QxApp::QxPropertyEditor::setValue ( const QString &  key,
const QVariant &  value 
)

在文件 qxpropertyeditor.cpp 第 612 行定义.

◆ value()

QVariant QxApp::QxPropertyEditor::value ( const QString &  key) const

The current value of key, or an invalid QVariant when there is no such property.

在文件 qxpropertyeditor.cpp 第 602 行定义.

◆ valueChanged()

void QxApp::QxPropertyEditor::valueChanged ( const QString &  key,
const QVariant &  value 
)

A value changed, whether by the user or by the application.


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