Skip to content

GraphicsRectItem

Qt Base Class: QGraphicsRectItem

Signature: QGraphicsRectItem(self, parent: Optional[PySide6.QtWidgets.QGraphicsItem] = None) -> None QGraphicsRectItem(self, rect: Union[PySide6.QtCore.QRectF, PySide6.QtCore.QRect], parent: Optional[PySide6.QtWidgets.QGraphicsItem] = None) -> None QGraphicsRectItem(self, x: float, y: float, w: float, h: float, parent: Optional[PySide6.QtWidgets.QGraphicsItem] = None) -> None

Base classes

Name Children Inherits
AbstractGraphicsShapeItemMixin
prettyqt.widgets.abstractgraphicsshapeitem
QGraphicsRectItem
PySide6.QtWidgets
QGraphicsRectItem(self, parent: Optional[PySide6.QtWidgets.QGraphicsItem] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473296166096["widgets.GraphicsRectItem"]
  1473293714592["widgets.AbstractGraphicsShapeItemMixin"]
  1473293706784["widgets.GraphicsItemMixin"]
  140713234304496["builtins.object"]
  1473290842848["QtWidgets.QGraphicsRectItem"]
  1473290838944["QtWidgets.QAbstractGraphicsShapeItem"]
  1473290795024["QtWidgets.QGraphicsItem"]
  1473291690208["Shiboken.Object"]
  1473293714592 --> 1473296166096
  1473293706784 --> 1473293714592
  140713234304496 --> 1473293706784
  1473290842848 --> 1473296166096
  1473290838944 --> 1473290842848
  1473290795024 --> 1473290838944
  1473291690208 --> 1473290795024
  140713234304496 --> 1473291690208

🛈 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 __setstate__(self, state):
        super().__setstate__(state)
        self.setRect(state["rect"])