Skip to content

PageLayout

Base classes

Name Children Inherits
QPageLayout
PySide6.QtGui
QPageLayout(self, /) -> None

⋔ Inheritance diagram

graph TD
  1460120279["gui.PageLayout"]
  3154823237["QtGui.QPageLayout"]
  37984305["Shiboken.Object"]
  2751680898["builtins.object"]
  3154823237 --> 1460120279
  37984305 --> 3154823237
  2751680898 --> 37984305

🛈 DocStrings

Bases: QPageLayout

Describes the size, orientation and margins of a page.

Source code in prettyqt/gui/pagelayout.py
class PageLayout(gui.QPageLayout):
    """Describes the size, orientation and margins of a page."""

    def __repr__(self):
        return get_repr(self)

    def set_units(self, unit: UnitStr | gui.QPageLayout.Unit):
        """Set unit.

        Args:
            unit: unit
        """
        self.setUnits(UNITS.get_enum_value(unit))

    def get_units(self) -> UnitStr:
        """Get the current unit.

        Returns:
            unit
        """
        return UNITS.inverse[self.units()]

    def set_mode(self, mode: ModeStr | gui.QPageLayout.Mode):
        """Set mode.

        Args:
            mode: mode
        """
        self.setMode(MODES.get_enum_value(mode))

    def get_mode(self) -> ModeStr:
        """Get the current mode.

        Returns:
            mode
        """
        return MODES.inverse[self.mode()]

    def set_orientation(self, orientation: OrientationStr | gui.QPageLayout.Orientation):
        """Set orientation.

        Args:
            orientation: orientation
        """
        self.setOrientation(ORIENTATIONS.get_enum_value(orientation))

    def get_orientation(self) -> OrientationStr:
        """Get the current orientation.

        Returns:
            orientation
        """
        return ORIENTATIONS.inverse[self.orientation()]

    def get_page_size(self) -> gui.PageSize:
        return gui.PageSize(self.pageSize())

get_mode() -> ModeStr

Get the current mode.

Source code in prettyqt/gui/pagelayout.py
def get_mode(self) -> ModeStr:
    """Get the current mode.

    Returns:
        mode
    """
    return MODES.inverse[self.mode()]

get_orientation() -> OrientationStr

Get the current orientation.

Source code in prettyqt/gui/pagelayout.py
def get_orientation(self) -> OrientationStr:
    """Get the current orientation.

    Returns:
        orientation
    """
    return ORIENTATIONS.inverse[self.orientation()]

get_units() -> UnitStr

Get the current unit.

Source code in prettyqt/gui/pagelayout.py
def get_units(self) -> UnitStr:
    """Get the current unit.

    Returns:
        unit
    """
    return UNITS.inverse[self.units()]

set_mode(mode: ModeStr | gui.QPageLayout.Mode)

Set mode.

Parameters:

Name Type Description Default
mode ModeStr | Mode

mode

required
Source code in prettyqt/gui/pagelayout.py
def set_mode(self, mode: ModeStr | gui.QPageLayout.Mode):
    """Set mode.

    Args:
        mode: mode
    """
    self.setMode(MODES.get_enum_value(mode))

set_orientation(orientation: OrientationStr | gui.QPageLayout.Orientation)

Set orientation.

Parameters:

Name Type Description Default
orientation OrientationStr | Orientation

orientation

required
Source code in prettyqt/gui/pagelayout.py
def set_orientation(self, orientation: OrientationStr | gui.QPageLayout.Orientation):
    """Set orientation.

    Args:
        orientation: orientation
    """
    self.setOrientation(ORIENTATIONS.get_enum_value(orientation))

set_units(unit: UnitStr | gui.QPageLayout.Unit)

Set unit.

Parameters:

Name Type Description Default
unit UnitStr | Unit

unit

required
Source code in prettyqt/gui/pagelayout.py
def set_units(self, unit: UnitStr | gui.QPageLayout.Unit):
    """Set unit.

    Args:
        unit: unit
    """
    self.setUnits(UNITS.get_enum_value(unit))

:fa-brands-github: Show source on GitHub