Qt Utilities 6.14.4
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
QtUtilities::OptionPage Class Referenceabstract

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

#include <optionpage.h>

Inheritance diagram for QtUtilities::OptionPage:
[legend]

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
 

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

Constructor & Destructor Documentation

◆ OptionPage()

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

Constructs a option page.

Definition at line 25 of file optionpage.cpp.

◆ ~OptionPage()

QtUtilities::OptionPage::~OptionPage ( )
virtual

Destroys the option page.

Definition at line 35 of file optionpage.cpp.

Member Function Documentation

◆ apply()

virtual bool QtUtilities::OptionPage::apply ( )
pure virtual

Applies altered settings.

Remarks
The SettingsDialog and any other classes/functions of this library will not call this method if the option page has not been shown yet. Hence it is (no longer) necessary to use OptionPage::hasBeenShown() to check whether the page has been initialized yet.

Implemented in QtUtilities::UiFileBasedOptionPage< UiClass >.

◆ errors() [1/2]

QStringList & QtUtilities::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 97 of file optionpage.h.

◆ errors() [2/2]

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

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

Definition at line 84 of file optionpage.h.

◆ hasBeenShown()

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

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

Remarks
If this is true, the method OptionPage::setupWidget() has already been called.

Definition at line 75 of file optionpage.h.

◆ matches()

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

Returns whether the pages matches the specified searchKeyWord.

Definition at line 64 of file optionpage.cpp.

◆ parentWindow()

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

Returns the parent window of the option page.

Definition at line 65 of file optionpage.h.

◆ reset()

virtual void QtUtilities::OptionPage::reset ( )
pure virtual

Discards altered settings and resets relevant widgets.

Remarks
The SettingsDialog and any other classes/functions of this library will not call this method if the option page has not been shown yet. Hence it is (no longer) necessary to use OptionPage::hasBeenShown() to check whether the page has been initialized yet.

Implemented in QtUtilities::UiFileBasedOptionPage< UiClass >.

◆ setupWidget()

virtual QWidget * QtUtilities::OptionPage::setupWidget ( )
protectedpure virtual

Creates the widget for the page.

Called on the first invocation of widget().

Implemented in QtUtilities::UiFileBasedOptionPage< UiClass >.

◆ widget()

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.

Friends And Related Symbol Documentation

◆ SettingsDialog

friend class SettingsDialog
friend

Definition at line 35 of file optionpage.h.


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