Skip to content

GraphicsAnchorLayout

Qt Base Class: QGraphicsAnchorLayout

Signature: QGraphicsAnchorLayout(self, parent: Optional[PySide6.QtWidgets.QGraphicsLayoutItem] = None) -> None

Base classes

Name Children Inherits
GraphicsLayoutMixin
prettyqt.widgets.graphicslayout
QGraphicsAnchorLayout
PySide6.QtWidgets
QGraphicsAnchorLayout(self, parent: Optional[PySide6.QtWidgets.QGraphicsLayoutItem] \= None) -> None

⋔ Inheritance diagram

🛈 DocStrings

Bases: GraphicsLayoutMixin, QGraphicsAnchorLayout

Source code in prettyqt\widgets\graphicsanchorlayout.py
class GraphicsAnchorLayout(widgets.GraphicsLayoutMixin, widgets.QGraphicsAnchorLayout):
    def add_anchor(
        self,
        first_item: widgets.QGraphicsLayoutItem,
        first_edge: constants.AnchorPointStr,
        second_item: widgets.QGraphicsLayoutItem,
        second_edge: constants.AnchorPointStr,
    ) -> widgets.QGraphicsAnchor:
        return self.addAnchor(
            first_item,
            constants.ANCHOR_POINT[first_edge],
            second_item,
            constants.ANCHOR_POINT[second_edge],
        )

    def get_anchor(
        self,
        first_item: widgets.QGraphicsLayoutItem,
        first_edge: constants.AnchorPointStr,
        second_item: widgets.QGraphicsLayoutItem,
        second_edge: constants.AnchorPointStr,
    ) -> widgets.QGraphicsAnchor:
        return self.anchor(
            first_item,
            constants.ANCHOR_POINT[first_edge],
            second_item,
            constants.ANCHOR_POINT[second_edge],
        )

    def add_anchors(
        self,
        first_item: widgets.QGraphicsLayoutItem,
        second_item: widgets.QGraphicsLayoutItem,
        orientation: constants.OrientationStr | constants.Orientation,
    ):
        self.addAnchors(
            first_item, second_item, constants.ORIENTATION.get_enum_value(orientation)
        )

    def add_corner_anchors(
        self,
        first_item: widgets.QGraphicsLayoutItem,
        first_corner: constants.CornerStr,
        second_item: widgets.QGraphicsLayoutItem,
        second_corner: constants.CornerStr,
    ):
        self.addCornerAnchors(
            first_item,
            constants.CORNER[first_corner],
            second_item,
            constants.CORNER[second_corner],
        )