- Extending Qt Creator Manual
- QtCreator
- IOptionsPage
- Extending Qt Creator Manual 13.0.0

# IOptionsPage Class

class Core::IOptionsPage

The IOptionsPage class is an interface for providing pages for the Options dialog (called Preferences on macOS). More...

Header: | #include <coreplugin/dialogs/ioptionspage.h>

- List of all members, including inherited members

## Public Functions

| IOptionsPage(bool registerGlobally = true)
virtual void | apply()
Utils::Id | category() const
Utils::FilePath | categoryIconPath() const
QString | displayCategory() const
QString | displayName() const
virtual void | finish()
Utils::Id | id() const
virtual bool | matches(const QRegularExpression &regexp) const
void | setWidgetCreator(const Core::IOptionsPage::WidgetCreator &widgetCreator)
virtual QWidget * | widget()

## Static Public Members

const QList<Core::IOptionsPage *> | allOptionsPages()

## Protected Functions

virtual QStringList | keywords() const
void | setCategoryIconPath(const Utils::FilePath &categoryIconPath)
void | setDisplayName(const QString &displayName)
void | setId(Utils::Id id)

## Detailed Description

## Member Function Documentation

### IOptionsPage::IOptionsPage(bool registerGlobally = true)

Constructs an options page 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().

### Utils::Id IOptionsPage::category() const

Returns the unique id for the category that the options page should be displayed in. This id is used for sorting the list on the left side of the Options dialog.

### Utils::FilePath IOptionsPage::categoryIconPath() const

Returns the path to the category icon of the options page. This icon will be read from this path and displayed in the list on the left side of the Options dialog.

See also setCategoryIconPath().

### QString IOptionsPage::displayCategory() const

Returns the translated category name of the options page. This name is displayed in the list on the left side of the Options dialog.

### QString IOptionsPage::displayName() const

Returns the translated display name of the options page.

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().

### Utils::Id IOptionsPage::id() const

Returns a unique identifier for referencing the options page.

See also setId().

### `[virtual protected]` QStringList IOptionsPage::keywords() const

Returns a list of ui strings that are used inside the widget.

### `[virtual]` bool IOptionsPage::matches(const QRegularExpression &regexp) const

Is used by the Options dialog search filter to match regexp 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::setCategoryIconPath(const Utils::FilePath &categoryIconPath)

Sets categoryIconPath as the path to the category icon of the options page.

See also categoryIconPath().

### `[protected]` void IOptionsPage::setDisplayName(const QString &displayName)

Sets displayName as the display name of the options page.

See also displayName().

### `[protected]` void IOptionsPage::setId(Utils::Id id)

Sets the id of the options page.

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.