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

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>

类 QxApp::QxSettingsDialog 继承关系图:

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.

QxSettingsDialog dialog(shell.settings());
dialog.addPage(QStringLiteral("general"), generalIcon, tr("General"), generalProperties);
dialog.addPage(QStringLiteral("editor"), editorIcon, tr("Editor"), editorProperties);
dialog.addGroup(QStringLiteral("editor"), tr("Indentation"), indentationProperties);
dialog.exec();
A settings dialog: a list of pages on the left, a key/value form on the right and the three things a ...

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 行定义.

构造及析构函数说明

◆ QxSettingsDialog()

QxApp::QxSettingsDialog::QxSettingsDialog ( QxCore ::QxSettings *  settings,
QWidget *  parent = 0 
)
explicit

在文件 qxsettingsdialog.cpp 第 161 行定义.

◆ ~QxSettingsDialog()

QxApp::QxSettingsDialog::~QxSettingsDialog ( )
override

在文件 qxsettingsdialog.cpp 第 171 行定义.

成员函数说明

◆ accept()

void QxApp::QxSettingsDialog::accept ( )
override

Applies and closes.

在文件 qxsettingsdialog.cpp 第 329 行定义.

◆ addGroup()

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 行定义.

◆ addPage()

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 行定义.

◆ applied()

void QxApp::QxSettingsDialog::applied ( )

The values have been written and synced.

◆ apply()

void QxApp::QxSettingsDialog::apply ( )

Writes every value to the settings object and syncs it.

在文件 qxsettingsdialog.cpp 第 296 行定义.

◆ currentPageChanged()

void QxApp::QxSettingsDialog::currentPageChanged ( const QString &  id)

◆ currentPageId()

QString QxApp::QxSettingsDialog::currentPageId ( ) const

在文件 qxsettingsdialog.cpp 第 262 行定义.

◆ editor()

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 行定义.

◆ isModified()

bool QxApp::QxSettingsDialog::isModified ( ) const

Whether anything on any page differs from what it was loaded as.

在文件 qxsettingsdialog.cpp 第 272 行定义.

◆ pageIds()

QStringList QxApp::QxSettingsDialog::pageIds ( ) const

在文件 qxsettingsdialog.cpp 第 245 行定义.

◆ reject()

void QxApp::QxSettingsDialog::reject ( )
override

Discards the edits and closes.

在文件 qxsettingsdialog.cpp 第 335 行定义.

◆ reload()

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 行定义.

◆ reset()

void QxApp::QxSettingsDialog::reset ( )

Sets every property of every page back to the default its descriptor declares.

在文件 qxsettingsdialog.cpp 第 285 行定义.

◆ setCurrentPage()

void QxApp::QxSettingsDialog::setCurrentPage ( const QString &  id)

在文件 qxsettingsdialog.cpp 第 318 行定义.

◆ settings()

QxSettings * QxApp::QxSettingsDialog::settings ( ) const

在文件 qxsettingsdialog.cpp 第 176 行定义.

◆ showEvent()

void QxApp::QxSettingsDialog::showEvent ( QShowEvent *  event)
overrideprotected

在文件 qxsettingsdialog.cpp 第 349 行定义.


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