QgsLayoutItemPolygon class
Layout item for node based polygon shapes.
Contents
Base classes
- class QgsLayoutNodesItem
- An abstract layout item that provides generic methods for node based shapes such as polygon or polylines.
Public static functions
- static auto create(QgsLayout* layout) -> QgsLayoutItemPolygon*
- Returns a new polygon item for the specified layout.
Constructors, destructors, conversion operators
- QgsLayoutItemPolygon(QgsLayout* layout)
- Constructor for QgsLayoutItemPolygon for the specified layout.
- QgsLayoutItemPolygon(const QPolygonF& polygon, QgsLayout* layout)
- Constructor for QgsLayoutItemPolygon for the specified polygon and layout.
Public functions
- auto displayName() const -> QString override
- Gets item display name.
- auto icon() const -> QIcon override
- Returns the item's icon.
- void setSymbol(QgsFillSymbol* symbol)
- Sets the symbol used to draw the shape.
- auto symbol() -> QgsFillSymbol*
- Returns the fill symbol used to draw the shape.
Protected functions
- auto _addNode(int nodeIndex, QPointF newNode, double radius) -> bool override
- Method called in addNode.
- void _draw(QgsLayoutItemRenderContext& context, const QStyleOptionGraphicsItem* itemStyle = nullptr) override
- Method called in paint.
- void _readXmlStyle(const QDomElement& elmt, const QgsReadWriteContext& context) override
- Method called in readXml.
- auto _removeNode(int nodeIndex) -> bool override
- Method called in removeNode.
- void _writeXmlStyle(QDomDocument& doc, QDomElement& elmt, const QgsReadWriteContext& context) const override
- Method called in writeXml.
Function documentation
static QgsLayoutItemPolygon* QgsLayoutItemPolygon:: create(QgsLayout* layout)
Returns a new polygon item for the specified layout.
The caller takes responsibility for deleting the returned object.
QString QgsLayoutItemPolygon:: displayName() const override
Gets item display name.
This is the item's id if set, and if not, a user-friendly string identifying item type.
void QgsLayoutItemPolygon:: setSymbol(QgsFillSymbol* symbol)
Sets the symbol used to draw the shape.
Ownership of symbol is not transferred.
QgsFillSymbol* QgsLayoutItemPolygon:: symbol()
Returns the fill symbol used to draw the shape.