Class: QgsLayoutItemPolyline

Layout item for node based polyline shapes.

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutItemPolyline

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.

class qgis.core.QgsLayoutItemPolyline[source]

Bases: QgsLayoutNodesItem

__init__(layout: QgsLayout | None)

Constructor for QgsLayoutItemPolyline for the specified layout.

Parameters:

layout (Optional[QgsLayout])

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

Constructor for QgsLayoutItemPolyline for the specified polyline and layout.

Parameters:
  • polyline (QPolygonF)

  • layout (Optional[QgsLayout])

ArrowHead = 1
class MarkerMode

Bases: int

NoMarker = 0
SvgMarker = 2
arrowHeadFillColor(self) QColor[source]

Returns the color used to fill the arrow head.

Return type:

QColor

arrowHeadStrokeColor(self) QColor[source]

Returns the color used to draw the stroke around the the arrow head.

Return type:

QColor

arrowHeadStrokeWidth(self) float[source]

Returns the pen width in millimeters for the stroke of the arrow head.

Return type:

float

arrowHeadWidth(self) float[source]

Returns the width of line arrow heads in mm.

Return type:

float

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

Returns a new polyline item for the specified layout.

The caller takes responsibility for deleting the returned object.

Parameters:

layout (Optional[QgsLayout])

Return type:

Optional[QgsLayoutItemPolyline]

endMarker(self) QgsLayoutItemPolyline.MarkerMode[source]

Returns the end marker mode, which controls what marker is drawn at the end of the line.

See also

setEndMarker()

See also

startMarker()

Return type:

QgsLayoutItemPolyline.MarkerMode

endSvgMarkerPath(self) str[source]

Returns the path the an SVG marker drawn at the end of the line.

Return type:

str

setArrowHeadFillColor(self, color: QColor | Qt.GlobalColor)[source]

Sets the color used to fill the arrow head.

Parameters:

color (Union[QColor, Qt.GlobalColor])

setArrowHeadStrokeColor(self, color: QColor | Qt.GlobalColor)[source]

Sets the color used to draw the stroke around the arrow head.

Parameters:

color (Union[QColor, Qt.GlobalColor])

setArrowHeadStrokeWidth(self, width: float)[source]

Sets the pen width in millimeters for the stroke of the arrow head

Parameters:

width (float)

setArrowHeadWidth(self, width: float)[source]

Sets the width of line arrow heads in mm.

See also

arrowHeadWidth()

Parameters:

width (float)

setEndMarker(self, mode: QgsLayoutItemPolyline.MarkerMode)[source]

Sets the end marker mode, which controls what marker is drawn at the end of the line.

See also

endMarker()

See also

setStartMarker()

Parameters:

mode (QgsLayoutItemPolyline.MarkerMode)

setEndSvgMarkerPath(self, path: str | None)[source]

Sets the path to a SVG marker to draw at the end of the line.

Parameters:

path (Optional[str])

setStartMarker(self, mode: QgsLayoutItemPolyline.MarkerMode)[source]

Sets the start marker mode, which controls what marker is drawn at the start of the line.

See also

startMarker()

See also

setEndMarker()

Parameters:

mode (QgsLayoutItemPolyline.MarkerMode)

setStartSvgMarkerPath(self, path: str | None)[source]

Sets the path to a SVG marker to draw at the start of the line.

Parameters:

path (Optional[str])

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

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

See also

symbol()

Parameters:

symbol (Optional[QgsLineSymbol])

startMarker(self) QgsLayoutItemPolyline.MarkerMode[source]

Returns the start marker mode, which controls what marker is drawn at the start of the line.

See also

setStartMarker()

See also

endMarker()

Return type:

QgsLayoutItemPolyline.MarkerMode

startSvgMarkerPath(self) str[source]

Returns the path the an SVG marker drawn at the start of the line.

Return type:

str

symbol(self) QgsLineSymbol | None[source]

Returns the line symbol used to draw the shape.

See also

setSymbol()

Return type:

Optional[QgsLineSymbol]