Class: QgsOptionsDialogBase

class qgis.gui.QgsOptionsDialogBase

Bases: PyQt5.QtWidgets.QDialog

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:

# Start with copy of qgsoptionsdialog_template.ui and build options/properties dialog. # 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

QgsOptionsDialogBase(settingsKey: str, parent: QWidget = None, fl: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags(), settings: QgsSettings = None) Constructor

Parameters
actionEvent(self, QActionEvent)
addPage(self, title: str, tooltip: str, icon: QIcon, widget: QWidget, path: Iterable[str] = [])

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

See also

insertPage()

New in version 3.14.

Parameters
  • title (str) –

  • tooltip (str) –

  • icon (QIcon) –

  • widget (QWidget) –

  • path (Iterable[str] = []) –

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
iconOnly(self) bool

Determine if the options list is in icon only mode

Return type

bool

initOptionsBase(self, restoreUi: bool = True, title: str = '')

Set up the base ui connections for vertical tabs.

Parameters
  • restoreUi (bool = True) – Whether to restore the base ui at this time.

  • title (str = '') – the window title

initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
insertPage(self, title: str, tooltip: str, icon: QIcon, widget: QWidget, before: str, path: Iterable[str] = [])

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

See also

addPage()

New in version 3.14.

Parameters
  • title (str) –

  • tooltip (str) –

  • icon (QIcon) –

  • widget (QWidget) –

  • before (str) –

  • path (Iterable[str] = []) –

isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int]
optionsStackedWidget_CurrentChanged(self, index: int)

Select relevant tab on current page change

Parameters

index (int) –

optionsStackedWidget_WidgetRemoved(self, index: int)

Remove tab and unregister widgets on page remove

Parameters

index (int) –

paintEvent(self, e: QPaintEvent)
Parameters

e (QPaintEvent) –

receivers(self, PYQT_SIGNAL) int
registerTextSearchWidgets(self)

register widgets in the dialog to search for text in it it is automatically called if a line edit has “mSearchLineEdit” as object name.

New in version 3.0.

resizeAlltabs(self, index: int)

Resizes all tabs when the dialog is resized

Parameters

index (int) – current tab index

New in version 3.10.

resizeEvent(self, QResizeEvent)
restoreLastPage(self)

Refocus the active tab from the last time the dialog was shown.

New in version 3.14.

restoreOptionsBaseUi(self, title: str = '')

Restore the base ui. Sometimes useful to do at end of subclass’s constructor.

Parameters

title (str = '') – the window title (it does not need to be defined if previously given to initOptionsBase();

searchText(self, text: str)

searchText searches for a text in all the pages of the stacked widget and highlight the results

Parameters

text (str) – the text to search

New in version 3.0.

sender(self) QObject
senderSignalIndex(self) int
setCurrentPage(self, page: str)

Sets the dialog page (by object name) to show.

New in version 3.14.

Parameters

page (str) –

setSettings(self, settings: QgsSettings)
Parameters

settings (QgsSettings) –

sharedPainter(self) QPainter
showEvent(self, e: QShowEvent)
Parameters

e (QShowEvent) –

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
updateOptionsListVerticalTabs(self)

Update tabs on the splitter move

updateWindowTitle(self)
warnAboutMissingObjects(self)
wheelEvent(self, QWheelEvent)