QgsOptionsDialogBase class
A base dialog for options and properties dialogs that offers vertical tabs.
Contents
It handles saving/restoring of geometry, splitter and current tab states, switching vertical tabs between icon/text to icon-only modes (splitter collapsed to left), and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots
To use: 1) Start with copy of qgsoptionsdialog_template.ui and build options/properties dialog. 2) In source file for dialog, inherit this class instead of QDialog, then in constructor: ... setupUi( this ); // set up .ui file objects initOptionsBase( false ); // set up this class to use .ui objects, optionally restoring base ui ... restoreOptionsBaseUi(); // restore the base ui with initOptionsBase or use this later on
Derived classes
- class QgsDataSourceManagerDialog
- The QgsDataSourceManagerDialog class embeds the browser panel and all the provider dialogs.
Constructors, destructors, conversion operators
- QgsOptionsDialogBase(const QString& settingsKey, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr, QgsSettings* settings = nullptr)
- Constructor.
Public functions
- auto iconOnly() -> bool
- Determine if the options list is in icon only mode.
- void initOptionsBase(bool restoreUi = true, const QString& title = QString())
- Set up the base ui connections for vertical tabs.
- void restoreOptionsBaseUi(const QString& title = QString())
- Restore the base ui.
Public slots
- void searchText(const QString& text)
- searchText searches for a text in all the pages of the stacked widget and highlight the results
Protected functions
- void registerTextSearchWidgets()
- register widgets in the dialog to search for text in it it is automatically called if a line edit has "mSearchLineEdit" as object name.
Protected slots
- void optionsStackedWidget_CurrentChanged(int index) virtual
- Select relevant tab on current page change.
- void optionsStackedWidget_WidgetRemoved(int index) virtual
- Remove tab and unregister widgets on page remove.
- void updateOptionsListVerticalTabs() virtual
- Update tabs on the splitter move.
Function documentation
QgsOptionsDialogBase:: QgsOptionsDialogBase(const QString& settingsKey,
QWidget* parent = nullptr,
Qt::WindowFlags fl = nullptr,
QgsSettings* settings = nullptr)
Constructor.
| Parameters | |
|---|---|
| settingsKey | QgsSettings subgroup key for saving/restore ui states, e.g. "ProjectProperties". |
| parent | parent object (owner) |
| fl | widget flags |
| settings | custom QgsSettings pointer |
void QgsOptionsDialogBase:: initOptionsBase(bool restoreUi = true,
const QString& title = QString())
Set up the base ui connections for vertical tabs.
| Parameters | |
|---|---|
| restoreUi | Whether to restore the base ui at this time. |
| title | the window title |
void QgsOptionsDialogBase:: restoreOptionsBaseUi(const QString& title = QString())
Restore the base ui.
| Parameters | |
|---|---|
| title | the window title (it does not need to be defined if previously given to initOptionsBase(); |
Sometimes useful to do at end of subclass's constructor.
void QgsOptionsDialogBase:: searchText(const QString& text) public slot
searchText searches for a text in all the pages of the stacked widget and highlight the results
| Parameters | |
|---|---|
| text | the text to search |
void QgsOptionsDialogBase:: registerTextSearchWidgets() protected
register widgets in the dialog to search for text in it it is automatically called if a line edit has "mSearchLineEdit" as object name.