Class: QgsOptionsDialogBase

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

Bases: PyQt5.QtWidgets.QDialog

Constructor

Parameters
  • settingsKey (str) – QgsSettings subgroup key for saving/restore ui states, e.g. “ProjectProperties”.

  • parent (QWidget = None) – parent object (owner)

  • fl (Union[Qt.WindowFlags) – widget flags

  • settings (QgsSettings = None) – custom QgsSettings pointer

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

Methods

actionEvent

addPage

Adds a new page to the dialog pages.

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

eventFilter

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

iconOnly

Determine if the options list is in icon only mode

initOptionsBase

Set up the base ui connections for vertical tabs.

initPainter

inputMethodEvent

insertPage

Inserts a new page into the dialog pages.

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

optionsStackedWidget_CurrentChanged

Select relevant tab on current page change

optionsStackedWidget_WidgetRemoved

Remove tab and unregister widgets on page remove

paintEvent

param e

receivers

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.

resizeAlltabs

Resizes all tabs when the dialog is resized

resizeEvent

restoreLastPage

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

restoreOptionsBaseUi

Restore the base ui.

searchText

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

sender

senderSignalIndex

setCurrentPage

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

setSettings

param settings

sharedPainter

showEvent

param e

tabletEvent

timerEvent

updateMicroFocus

updateOptionsListVerticalTabs

Update tabs on the splitter move

updateWindowTitle

warnAboutMissingObjects

wheelEvent

actionEvent(self, QActionEvent)
addPage(self, title: str, tooltip: str, icon: QIcon, widget: QWidget)

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.

See also

insertPage()

New in version 3.14.

Parameters
  • title (str) –

  • tooltip (str) –

  • icon (QIcon) –

  • widget (QWidget) –

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)

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.

See also

addPage()

New in version 3.14.

Parameters
  • title (str) –

  • tooltip (str) –

  • icon (QIcon) –

  • widget (QWidget) –

  • before (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)