Skip to content

GraphicsPolygonItem

Base classes

Name Children Inherits
AbstractGraphicsShapeItemMixin
prettyqt.widgets.abstractgraphicsshapeitem
QGraphicsPolygonItem
PySide6.QtWidgets
QGraphicsPolygonItem(self, polygon: PySide6.QtGui.QPolygonF | collections.abc.Sequence[PySide6.QtCore.QPointF] | PySide6.QtGui.QPolygon | PySide6.QtCore.QRectF, /, parent: PySide6.QtWidgets.QGraphicsItem | None \= None) -> None

⋔ Inheritance diagram

graph TD
  3656843281["widgets.GraphicsPolygonItem"]
  1457645213["widgets.AbstractGraphicsShapeItemMixin"]
  1638127052["widgets.GraphicsItemMixin"]
  2751680898["builtins.object"]
  1947510131["QtWidgets.QGraphicsPolygonItem"]
  3535066864["QtWidgets.QAbstractGraphicsShapeItem"]
  2584426969["QtWidgets.QGraphicsItem"]
  37984305["Shiboken.Object"]
  1457645213 --> 3656843281
  1638127052 --> 1457645213
  2751680898 --> 1638127052
  2751680898 --> 1457645213
  1947510131 --> 3656843281
  3535066864 --> 1947510131
  2584426969 --> 3535066864
  37984305 --> 2584426969
  2751680898 --> 37984305

🛈 DocStrings

Bases: AbstractGraphicsShapeItemMixin, QGraphicsPolygonItem

Polygon item that you can add to a QGraphicsScene.

Source code in prettyqt/widgets/graphicspolygonitem.py
class GraphicsPolygonItem(
    widgets.AbstractGraphicsShapeItemMixin, widgets.QGraphicsPolygonItem
):
    """Polygon item that you can add to a QGraphicsScene."""

    def get_polygon(self) -> gui.PolygonF:
        return gui.PolygonF(self.polygon())

    def set_fill_rule(self, rule: constants.FillRuleStr | constants.FillRule):
        self.setFillRule(constants.FILL_RULE.get_enum_value(rule))

    def get_fill_rule(self) -> constants.FillRuleStr:
        return constants.FILL_RULE.inverse[self.fillRule()]

:fa-brands-github: Show source on GitHub