Skip to content

GraphicsRectItem

Base classes

Name Children Inherits
AbstractGraphicsShapeItemMixin
prettyqt.widgets.abstractgraphicsshapeitem
QGraphicsRectItem
PySide6.QtWidgets
QGraphicsRectItem(self, rect: PySide6.QtCore.QRectF | PySide6.QtCore.QRect, /, parent: PySide6.QtWidgets.QGraphicsItem | None \= None) -> None

⋔ Inheritance diagram

graph TD
  23978195["widgets.GraphicsRectItem"]
  1457645213["widgets.AbstractGraphicsShapeItemMixin"]
  1638127052["widgets.GraphicsItemMixin"]
  2751680898["builtins.object"]
  1731243348["QtWidgets.QGraphicsRectItem"]
  3535066864["QtWidgets.QAbstractGraphicsShapeItem"]
  2584426969["QtWidgets.QGraphicsItem"]
  37984305["Shiboken.Object"]
  1457645213 --> 23978195
  1638127052 --> 1457645213
  2751680898 --> 1638127052
  2751680898 --> 1457645213
  1731243348 --> 23978195
  3535066864 --> 1731243348
  2584426969 --> 3535066864
  37984305 --> 2584426969
  2751680898 --> 37984305

🛈 DocStrings

Bases: AbstractGraphicsShapeItemMixin, QGraphicsRectItem

Rectangle item that you can add to a QGraphicsScene.

Source code in prettyqt/widgets/graphicsrectitem.py
class GraphicsRectItem(widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsRectItem):
    """Rectangle item that you can add to a QGraphicsScene."""

    def __repr__(self):
        return get_repr(self, self.get_rect())

    def get_rect(self) -> core.RectF:
        return core.RectF(self.rect())

    def serialize_fields(self):
        return dict(rect=self.get_rect())

    def __getstate__(self):
        return self.serialize_fields()

    def __setstate__(self, state):
        self.setRect(state["rect"])

    def __reduce__(self):
        return type(self), (), self.__getstate__()

:fa-brands-github: Show source on GitHub