|
QtCanpool 3.3.0
|
A settings dialog: a list of pages on the left, a key/value form on the right and the three things a settings dialog is expected to do - apply, discard and go back to the defaults. 更多...
#include <qxapp/qxsettingsdialog.h>

Public 成员函数 | |
| QxSettingsDialog (QxCore ::QxSettings *settings, QWidget *parent=0) | |
| ~QxSettingsDialog () override | |
| QxCore::QxSettings * | settings () const |
| void | addPage (const QString &id, const QIcon &icon, const QString &title, const QList< QxProperty > &properties) |
| Adds a page: an entry in the list on the left and a form on the right holding properties. | |
| void | addGroup (const QString &pageId, const QString &title, const QList< QxProperty > &properties) |
| Opens a group inside the page pageId and adds properties to it. | |
| QStringList | pageIds () const |
| QxPropertyEditor * | editor (const QString &pageId) const |
| The form of the page pageId, or null when there is no such page. | |
| QString | currentPageId () const |
| bool | isModified () const |
| Whether anything on any page differs from what it was loaded as. | |
| void | reload () |
| Reads every page back out of the settings object; the dialog does this itself whenever it is shown. | |
| void | reset () |
| Sets every property of every page back to the default its descriptor declares. | |
| void | apply () |
| Writes every value to the settings object and syncs it. | |
| void | setCurrentPage (const QString &id) |
| void | accept () override |
| Applies and closes. | |
| void | reject () override |
| Discards the edits and closes. | |
| void | applied () |
| The values have been written and synced. | |
| void | currentPageChanged (const QString &id) |
Protected 成员函数 | |
| void | showEvent (QShowEvent *event) override |
A settings dialog: a list of pages on the left, a key/value form on the right and the three things a settings dialog is expected to do - apply, discard and go back to the defaults.
The dialog is the half that knows about storage. QxPropertyEditor keeps the values and knows nothing about where they came from; this class reads them out of a QxSettings object when it is shown and writes them back when they are applied.
The key of a property is the path it is stored under, so it is the part that has to be stable and untranslated; the title of a page and the label of a property are presentation and may be translated freely. A key that is not in the settings object reads as the defaultValue of its descriptor, which is what makes a first run look like a configured one.
Migration is deliberately not here. Upgrading a stored layout from one release to the next is start-up work - it has to run before anything reads the configuration, and it may need to touch keys no dialog shows - so it stays with QxSettings::migrate() and the application's start-up path.
The dialog does not own the settings object; the application does, and it usually keeps one instance for the whole run.
在文件 qxsettingsdialog.h 第 63 行定义.
|
explicit |
在文件 qxsettingsdialog.cpp 第 161 行定义.
|
override |
在文件 qxsettingsdialog.cpp 第 171 行定义.
|
override |
Applies and closes.
在文件 qxsettingsdialog.cpp 第 329 行定义.
| void QxApp::QxSettingsDialog::addGroup | ( | const QString & | pageId, |
| const QString & | title, | ||
| const QList< QxProperty > & | properties | ||
| ) |
Opens a group inside the page pageId and adds properties to it.
A page can hold both grouped and ungrouped properties, so this is a way to structure a long page, not an alternative to addPage().
在文件 qxsettingsdialog.cpp 第 226 行定义.
| void QxApp::QxSettingsDialog::addPage | ( | const QString & | id, |
| const QIcon & | icon, | ||
| const QString & | title, | ||
| const QList< QxProperty > & | properties | ||
| ) |
Adds a page: an entry in the list on the left and a form on the right holding properties.
The id addresses the page in addGroup() and in editor(), so it has to be stable and unique.
在文件 qxsettingsdialog.cpp 第 182 行定义.
| void QxApp::QxSettingsDialog::applied | ( | ) |
The values have been written and synced.
| void QxApp::QxSettingsDialog::apply | ( | ) |
Writes every value to the settings object and syncs it.
在文件 qxsettingsdialog.cpp 第 296 行定义.
| void QxApp::QxSettingsDialog::currentPageChanged | ( | const QString & | id | ) |
| QString QxApp::QxSettingsDialog::currentPageId | ( | ) | const |
在文件 qxsettingsdialog.cpp 第 262 行定义.
| QxPropertyEditor * QxApp::QxSettingsDialog::editor | ( | const QString & | pageId | ) | const |
The form of the page pageId, or null when there is no such page.
在文件 qxsettingsdialog.cpp 第 255 行定义.
| bool QxApp::QxSettingsDialog::isModified | ( | ) | const |
Whether anything on any page differs from what it was loaded as.
在文件 qxsettingsdialog.cpp 第 272 行定义.
| QStringList QxApp::QxSettingsDialog::pageIds | ( | ) | const |
在文件 qxsettingsdialog.cpp 第 245 行定义.
|
override |
Discards the edits and closes.
在文件 qxsettingsdialog.cpp 第 335 行定义.
| void QxApp::QxSettingsDialog::reload | ( | ) |
Reads every page back out of the settings object; the dialog does this itself whenever it is shown.
在文件 qxsettingsdialog.cpp 第 278 行定义.
| void QxApp::QxSettingsDialog::reset | ( | ) |
Sets every property of every page back to the default its descriptor declares.
在文件 qxsettingsdialog.cpp 第 285 行定义.
| void QxApp::QxSettingsDialog::setCurrentPage | ( | const QString & | id | ) |
在文件 qxsettingsdialog.cpp 第 318 行定义.
| QxSettings * QxApp::QxSettingsDialog::settings | ( | ) | const |
在文件 qxsettingsdialog.cpp 第 176 行定义.
|
overrideprotected |
在文件 qxsettingsdialog.cpp 第 349 行定义.