Class: QgsLayoutItemPolygon

Layout item for node based polygon shapes.

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutItemPolygon

Base classes

QgsLayoutNodesItem

An abstract layout item that provides generic methods for node based shapes such as polygon or polylines.

QgsLayoutItem

Base class for graphical items within a QgsLayout.

QgsLayoutObject

A base class for objects which belong to a layout.

QObject

QgsExpressionContextGenerator

Abstract interface for generating an expression context.

QGraphicsRectItem

QAbstractGraphicsShapeItem

QGraphicsItem

QgsLayoutUndoObjectInterface

Interface for layout objects which support undo/redo commands.

Methods

setSymbol

Sets the symbol used to draw the shape.

symbol

Returns the fill symbol used to draw the shape.

Static Methods

create

Returns a new polygon item for the specified layout.

class qgis.core.QgsLayoutItemPolygon[source]

Bases: QgsLayoutNodesItem

__init__(layout: QgsLayout | None)

Constructor for QgsLayoutItemPolygon for the specified layout.

Parameters:

layout (Optional[QgsLayout])

__init__(polygon: QPolygonF, layout: QgsLayout | None)

Constructor for QgsLayoutItemPolygon for the specified polygon and layout.

Parameters:
  • polygon (QPolygonF)

  • layout (Optional[QgsLayout])

static create(layout: QgsLayout | None) QgsLayoutItemPolygon | None[source]

Returns a new polygon item for the specified layout.

The caller takes responsibility for deleting the returned object.

Parameters:

layout (Optional[QgsLayout])

Return type:

Optional[QgsLayoutItemPolygon]

setSymbol(self, symbol: QgsFillSymbol | None)[source]

Sets the symbol used to draw the shape. Ownership of symbol is not transferred.

See also

symbol()

Parameters:

symbol (Optional[QgsFillSymbol])

symbol(self) QgsFillSymbol | None[source]

Returns the fill symbol used to draw the shape.

See also

setSymbol()

Return type:

Optional[QgsFillSymbol]