QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
A base dialog for options and properties dialogs that offers vertical tabs. More...
#include <qgsoptionsdialogbase.h>
Public Slots | |
void | searchText (const QString &text) |
searchText searches for a text in all the pages of the stacked widget and highlight the results | |
Public Member Functions | |
QgsOptionsDialogBase (const QString &settingsKey, QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags(), QgsSettings *settings=nullptr) | |
Constructor. | |
~QgsOptionsDialogBase () override | |
void | addPage (const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QStringList &path=QStringList(), const QString &key=QString()) |
Adds a new page to the dialog pages. | |
bool | iconOnly () |
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 | insertPage (const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QString &before, const QStringList &path=QStringList(), const QString &key=QString()) |
Inserts a new page into the dialog pages. | |
void | resizeAlltabs (int index) |
Resizes all tabs when the dialog is resized. | |
void | restoreLastPage () |
Refocus the active tab from the last time the dialog was shown. | |
void | restoreOptionsBaseUi (const QString &title=QString()) |
Restore the base ui. | |
void | setCurrentPage (const QString &page) |
Sets the dialog page (by object name) to show. | |
void | setSettings (QgsSettings *settings) |
Protected Slots | |
virtual void | optionsStackedWidget_CurrentChanged (int index) |
Select relevant tab on current page change. | |
virtual void | optionsStackedWidget_WidgetRemoved (int index) |
Remove tab and unregister widgets on page remove. | |
virtual void | updateOptionsListVerticalTabs () |
Update tabs on the splitter move. | |
void | warnAboutMissingObjects () |
Protected Member Functions | |
QStandardItem * | createItem (const QString &name, const QString &tooltip, const QString &icon) |
Creates a new QStandardItem with the specified name, tooltip and icon. | |
void | paintEvent (QPaintEvent *e) override |
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. | |
void | showEvent (QShowEvent *e) override |
virtual void | updateWindowTitle () |
Protected Attributes | |
bool | mDelSettings = false |
QString | mDialogTitle |
bool | mIconOnly = false |
bool | mInit = false |
QDialogButtonBox * | mOptButtonBox = nullptr |
QListWidget * | mOptListWidget = nullptr |
QString | mOptsKey |
QSplitter * | mOptSplitter = nullptr |
QStackedWidget * | mOptStackedWidget = nullptr |
QStandardItemModel * | mOptTreeModel = nullptr |
QTreeView * | mOptTreeView = nullptr |
QList< QPair< QgsOptionsDialogHighlightWidget *, int > > | mRegisteredSearchWidgets |
QgsFilterLineEdit * | mSearchLineEdit = nullptr |
QPointer< QgsSettings > | mSettings |
QgsOptionsProxyModel * | mTreeProxyModel = nullptr |
A base dialog for options and properties dialogs that offers vertical tabs.
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:
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 Definition at line 86 of file qgsoptionsdialogbase.h.
QgsOptionsDialogBase::QgsOptionsDialogBase | ( | const QString & | settingsKey, |
QWidget * | parent = nullptr , |
||
Qt::WindowFlags | fl = Qt::WindowFlags() , |
||
QgsSettings * | settings = nullptr |
||
) |
Constructor.
settingsKey | QgsSettings subgroup key for saving/restore ui states, e.g. "ProjectProperties". |
parent | parent object (owner) |
fl | widget flags |
settings | custom QgsSettings pointer |
Definition at line 45 of file qgsoptionsdialogbase.cpp.
|
override |
Definition at line 52 of file qgsoptionsdialogbase.cpp.
void QgsOptionsDialogBase::addPage | ( | const QString & | title, |
const QString & | tooltip, | ||
const QIcon & | icon, | ||
QWidget * | widget, | ||
const QStringList & | path = QStringList() , |
||
const QString & | key = QString() |
||
) |
Adds a new page to the dialog pages.
The title, tooltip and icon arguments dictate the page list item title, tooltip and icon respectively.
The page content is specified via the widget argument. Ownership of widget is transferred to the dialog.
Since QGIS 3.22, the optional path argument can be used to set the path of the item's entry in the tree view (for dialogs which show a tree view of options pages only).
Since QGIS 3.32, the optional key argument can be used to set an untranslated key that path can refer to in following calls. Default to title.
Definition at line 329 of file qgsoptionsdialogbase.cpp.
|
protected |
Creates a new QStandardItem with the specified name, tooltip and icon.
Definition at line 705 of file qgsoptionsdialogbase.cpp.
|
inline |
Determine if the options list is in icon only mode.
Definition at line 136 of file qgsoptionsdialogbase.h.
void QgsOptionsDialogBase::initOptionsBase | ( | bool | restoreUi = true , |
const QString & | title = QString() |
||
) |
Set up the base ui connections for vertical tabs.
restoreUi | Whether to restore the base ui at this time. |
title | the window title |
Definition at line 69 of file qgsoptionsdialogbase.cpp.
void QgsOptionsDialogBase::insertPage | ( | const QString & | title, |
const QString & | tooltip, | ||
const QIcon & | icon, | ||
QWidget * | widget, | ||
const QString & | before, | ||
const QStringList & | path = QStringList() , |
||
const QString & | key = QString() |
||
) |
Inserts a new page into the dialog pages.
The title, tooltip and icon arguments dictate the page list item title, tooltip and icon respectively.
The page content is specified via the widget argument. Ownership of widget is transferred to the dialog.
The before argument specifies the object name of an existing page. The new page will be inserted directly before the matching page.
Since QGIS 3.22, the optional path argument can be used to set the path of the item's entry in the tree view (for dialogs which show a tree view of options pages only).
Since QGIS 3.32, the optional key argument can be used to set an untranslated key that path can refer to in following calls. Default to title.
Definition at line 413 of file qgsoptionsdialogbase.cpp.
|
protectedvirtualslot |
Select relevant tab on current page change.
Definition at line 807 of file qgsoptionsdialogbase.cpp.
|
protectedvirtualslot |
Remove tab and unregister widgets on page remove.
Definition at line 825 of file qgsoptionsdialogbase.cpp.
|
overrideprotected |
Definition at line 739 of file qgsoptionsdialogbase.cpp.
|
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.
Definition at line 661 of file qgsoptionsdialogbase.cpp.
void QgsOptionsDialogBase::resizeAlltabs | ( | int | index | ) |
Resizes all tabs when the dialog is resized.
index | current tab index |
Definition at line 290 of file qgsoptionsdialogbase.cpp.
void QgsOptionsDialogBase::restoreLastPage | ( | ) |
Refocus the active tab from the last time the dialog was shown.
Definition at line 252 of file qgsoptionsdialogbase.cpp.
void QgsOptionsDialogBase::restoreOptionsBaseUi | ( | const QString & | title = QString() | ) |
Restore the base ui.
Sometimes useful to do at end of subclass's constructor.
title | the window title (it does not need to be defined if previously given to initOptionsBase(); |
Definition at line 208 of file qgsoptionsdialogbase.cpp.
|
slot |
searchText searches for a text in all the pages of the stacked widget and highlight the results
text | the text to search |
Definition at line 517 of file qgsoptionsdialogbase.cpp.
void QgsOptionsDialogBase::setCurrentPage | ( | const QString & | page | ) |
Sets the dialog page (by object name) to show.
Definition at line 314 of file qgsoptionsdialogbase.cpp.
void QgsOptionsDialogBase::setSettings | ( | QgsSettings * | settings | ) |
Definition at line 197 of file qgsoptionsdialogbase.cpp.
|
overrideprotected |
Definition at line 712 of file qgsoptionsdialogbase.cpp.
|
protectedvirtualslot |
Update tabs on the splitter move.
Definition at line 764 of file qgsoptionsdialogbase.cpp.
|
protectedvirtual |
Definition at line 747 of file qgsoptionsdialogbase.cpp.
|
protectedslot |
Definition at line 847 of file qgsoptionsdialogbase.cpp.
|
protected |
Definition at line 239 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 234 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 235 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 224 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 232 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 225 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 223 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 231 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 230 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 227 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 226 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 221 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 233 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 238 of file qgsoptionsdialogbase.h.
|
protected |
Definition at line 228 of file qgsoptionsdialogbase.h.