Class: QgsTabWidget

The QgsTabWidget class is the same as the QTabWidget but with additional methods to temporarily hide/show tabs.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsTabWidget

Base classes

QTabWidget

QWidget

QObject

QPaintDevice

Methods

hideTab

Hides the tab with the given widget

realTabIndex

Returns the index of the tab with the given widget.

setTabStyle

Sets the optional custom labelStyle for the tab identified by tabIndex.

setTabVisible

Control the visibility for the tab with the given widget.

showTab

Shows the tab with the given widget

tabInserted

Is called internally whenever a new tab has been inserted.

tabRemoved

Is called internally whenever a tab has been removed.

class qgis.gui.QgsTabWidget[source]

Bases: QTabWidget

__init__(parent: QWidget | None = None)

Create a new QgsTabWidget with the optionally provided parent.

Parameters:

parent (Optional[QWidget] = None)

hideTab(self, tab: QWidget | None)[source]

Hides the tab with the given widget

Parameters:

tab (Optional[QWidget])

realTabIndex(self, widget: QWidget | None) int[source]

Returns the index of the tab with the given widget. This index is not the same as the one provided to insertTab and removeTab since these methods are not aware of hidden tabs.

Parameters:

widget (Optional[QWidget])

Return type:

int

setTabStyle(self, tabIndex: int, labelStyle: QgsAttributeEditorElement.LabelStyle)[source]

Sets the optional custom labelStyle for the tab identified by tabIndex.

Added in version 3.26.

Parameters:
setTabVisible(self, tab: QWidget | None, visible: bool)[source]

Control the visibility for the tab with the given widget.

Parameters:
  • tab (Optional[QWidget])

  • visible (bool)

showTab(self, tab: QWidget | None)[source]

Shows the tab with the given widget

Parameters:

tab (Optional[QWidget])

tabInserted(self, index: int)[source]

Is called internally whenever a new tab has been inserted.

Is used to keep track of currently available and visible tabs.

Parameters:

index (int)

tabRemoved(self, index: int)[source]

Is called internally whenever a tab has been removed.

Is used to keep track of currently available and visible tabs.

Parameters:

index (int)