IOptionsPage Class
(Core::IOptionsPage)The IOptionsPage class is an interface for providing pages for the Options dialog (called Preferences on macOS). More...
Header: | #include <IOptionsPage> |
Public Types
typedef | WidgetCreator |
Public Functions
IOptionsPage(QObject *parent = nullptr, bool registerGlobally = true) | |
virtual void | apply() |
Core::Id | category() const |
QIcon | categoryIcon() const |
QString | displayCategory() const |
QString | displayName() const |
virtual void | finish() |
Core::Id | id() const |
virtual bool | matches(const QString &searchKeyWord) const |
void | setWidgetCreator(const Core::IOptionsPage::WidgetCreator &widgetCreator) |
virtual QWidget * | widget() |
Static Public Members
const QList<Core::IOptionsPage *> | allOptionsPages() |
Protected Functions
void | setCategory(Core::Id category) |
void | setCategoryIcon(const Utils::Icon &categoryIcon) |
void | setCategoryIconPath(const QString &categoryIconPath) |
void | setDisplayCategory(const QString &displayCategory) |
void | setDisplayName(const QString &displayName) |
void | setId(Core::Id id) |
Detailed Description
The IOptionsPage class is an interface for providing pages for the Options dialog (called Preferences on macOS).
Member Function Documentation
IOptionsPage::IOptionsPage(QObject *parent = nullptr, bool registerGlobally = true)
Constructs an options page with the given parent and registers it at the global options page pool if registerGlobally is true
.
[static]
const QList<Core::IOptionsPage *> IOptionsPage::allOptionsPages()
Returns a list of all options pages.
[virtual]
void IOptionsPage::apply()
Called when selecting the Apply button on the options page dialog. Should detect whether any changes were made and store those.
Either override this function in a derived class, or set a widget creator.
See also setWidgetCreator().
Core::Id IOptionsPage::category() const
See also setCategory().
QIcon IOptionsPage::categoryIcon() const
Returns the category icon of the options page. This icon is displayed in the list on the left side of the Options dialog.
See also setCategoryIcon().
QString IOptionsPage::displayCategory() const
See also setDisplayCategory().
QString IOptionsPage::displayName() const
See also setDisplayName().
[virtual]
void IOptionsPage::finish()
Called directly before the Options dialog closes. Here you should delete the widget that was created in widget() to free resources.
Either override this function in a derived class, or set a widget creator.
See also setWidgetCreator().
Core::Id IOptionsPage::id() const
See also setId().
[virtual]
bool IOptionsPage::matches(const QString &searchKeyWord) const
Is used by the Options dialog search filter to match searchKeyWord to this options page. This defaults to take the widget and then looks for all child labels, check boxes, push buttons, and group boxes. Should return true
when a match is found.
[protected]
void IOptionsPage::setCategory(Core::Id category)
See also category().
[protected]
void IOptionsPage::setCategoryIcon(const Utils::Icon &categoryIcon)
See also categoryIcon().
[protected]
void IOptionsPage::setCategoryIconPath(const QString &categoryIconPath)
Sets categoryIconPath as the path to the category icon of the options page.
[protected]
void IOptionsPage::setDisplayCategory(const QString &displayCategory)
See also displayCategory().
[protected]
void IOptionsPage::setDisplayName(const QString &displayName)
See also displayName().
[protected]
void IOptionsPage::setId(Core::Id id)
See also id().
void IOptionsPage::setWidgetCreator(const Core::IOptionsPage::WidgetCreator &widgetCreator)
Sets the widgetCreator callback to create page widgets on demand. The widget will be destroyed on finish().
[virtual]
QWidget *IOptionsPage::widget()
Returns the widget to show in the Options dialog. You should create a widget lazily here, and delete it again in the finish() method. This method can be called multiple times, so you should only create a new widget if the old one was deleted.
Alternatively, use setWidgetCreator() to set a callback function that is used to lazily create a widget in time.
Either override this function in a derived class, or set a widget creator.