Qt Utilities  5.6.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Public Member Functions | Protected Member Functions | Friends | List of all members
Dialogs::OptionPage Class Referenceabstract

The OptionPage class is the base class for SettingsDialog pages. More...

#include <optionpage.h>

Inheritance diagram for Dialogs::OptionPage:
[legend]

Public Member Functions

 OptionPage (QWidget *parentWindow=nullptr)
 Constructs a option page. More...
 
virtual ~OptionPage ()
 Destroys the option page. More...
 
QWidget * parentWindow () const
 Returns the parent window of the option page. More...
 
QWidget * widget ()
 Returns the widget for the option page. More...
 
bool hasBeenShown () const
 Returns an indication whether the option page has been shown yet. More...
 
virtual bool apply ()=0
 Applies altered settings. More...
 
virtual void reset ()=0
 Discards altered settings and resets relevant widgets. More...
 
bool matches (const QString &searchKeyWord)
 Returns whether the pages matches the specified searchKeyWord. More...
 
const QStringList & errors () const
 Returns the errors which haven been occurred when applying the changes. More...
 

Protected Member Functions

virtual QWidget * setupWidget ()=0
 Creates the widget for the page. More...
 
QStringList & errors ()
 Returns the errors which haven been occurred when applying the changes. More...
 

Friends

class SettingsDialog
 

Detailed Description

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 15 of file optionpage.h.

Constructor & Destructor Documentation

◆ OptionPage()

Dialogs::OptionPage::OptionPage ( QWidget *  parentWindow = nullptr)
explicit

Constructs a option page.

Definition at line 21 of file optionpage.cpp.

◆ ~OptionPage()

Dialogs::OptionPage::~OptionPage ( )
virtual

Destroys the option page.

Definition at line 30 of file optionpage.cpp.

Member Function Documentation

◆ apply()

Dialogs::OptionPage::apply ( )
pure virtual

Applies altered settings.

Implemented in Dialogs::UiFileBasedOptionPage< UiClass >.

◆ errors() [1/2]

const QStringList & Dialogs::OptionPage::errors ( ) const
inline

Returns the errors which haven been occurred when applying the changes.

Definition at line 63 of file optionpage.h.

◆ errors() [2/2]

QStringList & Dialogs::OptionPage::errors ( )
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 74 of file optionpage.h.

◆ hasBeenShown()

bool Dialogs::OptionPage::hasBeenShown ( ) const
inline

Returns an indication whether the option page has been shown yet.

Definition at line 55 of file optionpage.h.

◆ matches()

bool Dialogs::OptionPage::matches ( const QString &  searchKeyWord)

Returns whether the pages matches the specified searchKeyWord.

Definition at line 58 of file optionpage.cpp.

◆ parentWindow()

QWidget * Dialogs::OptionPage::parentWindow ( ) const
inline

Returns the parent window of the option page.

Definition at line 47 of file optionpage.h.

◆ reset()

Dialogs::OptionPage::reset ( )
pure virtual

Discards altered settings and resets relevant widgets.

Implemented in Dialogs::UiFileBasedOptionPage< UiClass >.

◆ setupWidget()

Dialogs::OptionPage::setupWidget ( )
protectedpure virtual

Creates the widget for the page.

Called in the first invocation of widget().

Implemented in Dialogs::UiFileBasedOptionPage< UiClass >.

◆ widget()

QWidget * Dialogs::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 42 of file optionpage.cpp.

Friends And Related Function Documentation

◆ SettingsDialog

friend class SettingsDialog
friend

Definition at line 17 of file optionpage.h.


The documentation for this class was generated from the following files: