|
QtCanpool 3.3.0
|
A form built from a list of QxProperty descriptors. 更多...
#include <qxapp/qxpropertyeditor.h>

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.
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 行定义.
|
explicit |
在文件 qxpropertyeditor.cpp 第 534 行定义.
|
override |
在文件 qxpropertyeditor.cpp 第 543 行定义.
| void QxApp::QxPropertyEditor::addGroup | ( | const QString & | title, |
| const QList< QxProperty > & | properties | ||
| ) |
Opens a section titled title and adds properties to it.
在文件 qxpropertyeditor.cpp 第 586 行定义.
| 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 行定义.
| QHash< QString, QVariant > QxApp::QxPropertyEditor::allValues | ( | ) | const |
The current value of every property.
在文件 qxpropertyeditor.cpp 第 650 行定义.
| bool QxApp::QxPropertyEditor::contains | ( | const QString & | key | ) | const |
在文件 qxpropertyeditor.cpp 第 564 行定义.
| int QxApp::QxPropertyEditor::count | ( | ) | const |
在文件 qxpropertyeditor.cpp 第 548 行定义.
| bool QxApp::QxPropertyEditor::isModified | ( | ) | const |
Whether the current values differ from the ones setAllValues() took as a baseline.
在文件 qxpropertyeditor.cpp 第 660 行定义.
| QStringList QxApp::QxPropertyEditor::keys | ( | ) | const |
The keys of the properties, in the order they were added.
在文件 qxpropertyeditor.cpp 第 554 行定义.
| void QxApp::QxPropertyEditor::modifiedChanged | ( | bool | modified | ) |
isModified() changed.
| void QxApp::QxPropertyEditor::reset | ( | ) |
Sets every property back to its defaultValue.
在文件 qxpropertyeditor.cpp 第 666 行定义.
| void QxApp::QxPropertyEditor::resetToInitial | ( | ) |
Sets every property back to the values setAllValues() was given.
在文件 qxpropertyeditor.cpp 第 675 行定义.
| 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 行定义.
| void QxApp::QxPropertyEditor::setValue | ( | const QString & | key, |
| const QVariant & | value | ||
| ) |
在文件 qxpropertyeditor.cpp 第 612 行定义.
| 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 行定义.
| void QxApp::QxPropertyEditor::valueChanged | ( | const QString & | key, |
| const QVariant & | value | ||
| ) |
A value changed, whether by the user or by the application.