Qt Utilities 6.14.3
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
|
The OptionPage class is the base class for SettingsDialog pages. More...
#include <optionpage.h>
Public Member Functions | |
OptionPage (QWidget *parentWindow=nullptr) | |
Constructs a option page. | |
virtual | ~OptionPage () |
Destroys the option page. | |
QWidget * | parentWindow () const |
Returns the parent window of the option page. | |
QWidget * | widget () |
Returns the widget for the option page. | |
bool | hasBeenShown () const |
Returns an indication whether the option page has been shown yet. | |
virtual bool | apply ()=0 |
Applies altered settings. | |
virtual void | reset ()=0 |
Discards altered settings and resets relevant widgets. | |
bool | matches (const QString &searchKeyWord) |
Returns whether the pages matches the specified searchKeyWord. | |
const QStringList & | errors () const |
Returns the errors which haven been occurred when applying the changes. | |
Protected Member Functions | |
virtual QWidget * | setupWidget ()=0 |
Creates the widget for the page. | |
QStringList & | errors () |
Returns the errors which haven been occurred when applying the changes. | |
Friends | |
class | SettingsDialog |
The OptionPage class is the base class for SettingsDialog pages.
The specified parentWindow might be used by some implementations as parent when showing dialogs.
Definition at line 34 of file optionpage.h.
|
explicit |
Constructs a option page.
Definition at line 25 of file optionpage.cpp.
|
virtual |
Destroys the option page.
Definition at line 35 of file optionpage.cpp.
|
pure virtual |
Applies altered settings.
Implemented in QtUtilities::UiFileBasedOptionPage< UiClass >.
|
inlineprotected |
Returns the errors which haven been occurred when applying the changes.
Error messages should be added when implementing apply() and something goes wrong. In this case, apply() should return false.
Definition at line 97 of file optionpage.h.
|
inline |
Returns the errors which haven been occurred when applying the changes.
Definition at line 84 of file optionpage.h.
|
inline |
Returns an indication whether the option page has been shown yet.
Definition at line 75 of file optionpage.h.
bool QtUtilities::OptionPage::matches | ( | const QString & | searchKeyWord | ) |
Returns whether the pages matches the specified searchKeyWord.
Definition at line 64 of file optionpage.cpp.
|
inline |
Returns the parent window of the option page.
Definition at line 65 of file optionpage.h.
|
pure virtual |
Discards altered settings and resets relevant widgets.
Implemented in QtUtilities::UiFileBasedOptionPage< UiClass >.
|
protectedpure virtual |
Creates the widget for the page.
Called on the first invocation of widget().
Implemented in QtUtilities::UiFileBasedOptionPage< UiClass >.
QWidget * QtUtilities::OptionPage::widget | ( | ) |
Returns the widget for the option page.
If the widget has not been constructed yet, a new widget will be constructed using the OptionPage::setupWidget() method and the current configuration is applied.
The option page keeps ownership over the returned widget.
Definition at line 48 of file optionpage.cpp.
|
friend |
Definition at line 35 of file optionpage.h.