Skip to content

StackedLayout

Qt Base Class: QStackedLayout

Signature: QStackedLayout(self) -> None QStackedLayout(self, parent: PySide6.QtWidgets.QWidget) -> None QStackedLayout(self, parentLayout: PySide6.QtWidgets.QLayout) -> None

Base classes

Name Children Inherits
LayoutMixin
prettyqt.widgets.layout
QStackedLayout
PySide6.QtWidgets
QStackedLayout(self) -> None

⋔ Inheritance diagram

graph TD
  1473296367152["widgets.StackedLayout"]
  1473296333968["widgets.LayoutMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473296346656["widgets.LayoutItemMixin"]
  1473365792352["QtWidgets.QStackedLayout"]
  1473365768928["QtWidgets.QLayout"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473290791120["QtWidgets.QLayoutItem"]
  1473296333968 --> 1473296367152
  1473299815024 --> 1473296333968
  140713234304496 --> 1473299815024
  1473296346656 --> 1473296333968
  140713234304496 --> 1473296346656
  1473365792352 --> 1473296367152
  1473365768928 --> 1473365792352
  1473288842240 --> 1473365768928
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208
  1473290791120 --> 1473365768928
  1473291690208 --> 1473290791120

🛈 DocStrings

Bases: LayoutMixin, QStackedLayout

Layout containing stack of widgets where only one widget is visible at a time.

Source code in prettyqt\widgets\stackedlayout.py
class StackedLayout(widgets.LayoutMixin, widgets.QStackedLayout):
    """Layout containing stack of widgets where only one widget is visible at a time."""

    ID = "stacked"

    def _get_map(self):
        maps = super()._get_map()
        maps |= {"stackingMode": STACKING_MODE}
        return maps

    def set_stacking_mode(self, mode: StackingModeStr):
        self.setStackingMode(STACKING_MODE[mode])

    def get_stacking_mode(self) -> StackingModeStr:
        return STACKING_MODE.inverse[self.stackingMode()]

    def __add__(self, other: widgets.QWidget | widgets.QLayout):
        self.add(other)
        return self

    def set_current_widget(self, widget: widgets.QWidget):
        self.setCurrentWidget(widget)

⌗ Property table

Qt Property Type Doc
objectName QString
spacing int
contentsMargins QMargins
sizeConstraint QLayout::SizeConstraint
currentIndex int
stackingMode QStackedLayout::StackingMode