Class: QgsLayoutItemPolyline¶
- class qgis.core.QgsLayoutItemPolyline¶
Bases:
QgsLayoutNodesItem
Layout item for node based polyline shapes.
New in version 3.0.
QgsLayoutItemPolyline(layout:
QgsLayout
) Constructor forQgsLayoutItemPolyline
for the specifiedlayout
.QgsLayoutItemPolyline(polyline: QPolygonF, layout:
QgsLayout
) Constructor forQgsLayoutItemPolyline
for the specifiedpolyline
andlayout
.Methods
- param visitor:
Adjusts the specified
point
at which areference
position of the item sits and returns the top left corner of the item, if reference point were placed at the specified position.Applies any present data defined size overrides to the specified layout
size
.Applies any item-specific size constraint handling to a given
targetSize
in layout units.Returns the color used to fill the arrow head.
Returns the color used to draw the stroke around the the arrow head.
Returns the pen width in millimeters for the stroke of the arrow head.
Returns the width of line arrow heads in mm.
Compute an euclidean distance between 2 nodes.
Returns a new polyline item for the specified
layout
.- rtype:
str
Draws the background for the item.
Draws a debugging rectangle of the item's current bounds within the specified painter.
Draws the frame around the item.
Draws a "refreshing" overlay icon on the item.
Returns the end marker mode, which controls what marker is drawn at the end of the line.
Returns the path the an SVG marker drawn at the end of the line.
Returns the path to use when drawing the item's frame or background.
- rtype:
QIcon
Returns the current position (in layout units) of a
reference
point for the item.Sets object properties from a DOM element
- param element:
Refresh item's background color, considering data defined colors.
Refresh item's blend mode, considering data defined blend mode.
Refresh item's frame, considering data defined colors and frame size.
Refreshes an item's position by rechecking it against any possible overrides such as data defined positioning.
Refreshes an item's rotation by rechecking it against any possible overrides such as data defined rotation.
Refreshes an item's size by rechecking it against any possible item fixed or minimum sizes.
Refresh item's opacity, considering data defined opacity.
Rescale the current shape according to the item's bounding box.
Sets the
color
used to fill the arrow head.Sets the
color
used to draw the stroke around the arrow head.Sets the pen
width
in millimeters for the stroke of the arrow headSets the
width
of line arrow heads in mm.Sets the end marker
mode
, which controls what marker is drawn at the end of the line.Sets the
path
to a SVG marker to draw at the end of the line.Sets a fixed
size
for the layout item, which prevents it from being freely resized.Sets the minimum allowed
size
for the layout item.Sets the start marker
mode
, which controls what marker is drawn at the start of the line.Sets the
path
to a SVG marker to draw at the start of the line.Sets the
symbol
used to draw the shape.- rtype:
QPainterPath
Returns the start marker mode, which controls what marker is drawn at the start of the line.
Returns the path the an SVG marker drawn at the start of the line.
Returns the line symbol used to draw the shape.
Returns the position for the reference point of the item, if the top-left of the item was placed at the specified
point
.- rtype:
int
Update the current scene rectangle for this item.
Stores object properties within an XML DOM element.
- param element:
Attributes
- ArrowHead = 1¶
- class MarkerMode¶
Bases:
int
- NoMarker = 0¶
- SvgMarker = 2¶
- accept(self, visitor: QgsStyleEntityVisitorInterface) bool ¶
- Parameters:
visitor (QgsStyleEntityVisitorInterface) –
- Return type:
bool
- adjustPointForReferencePosition(self, point: QPointF | QPoint, size: QSizeF, reference: QgsLayoutItem.ReferencePoint) QPointF ¶
Adjusts the specified
point
at which areference
position of the item sits and returns the top left corner of the item, if reference point were placed at the specified position.
- applyDataDefinedSize(self, size: QgsLayoutSize) QgsLayoutSize ¶
Applies any present data defined size overrides to the specified layout
size
.
- applyItemSizeConstraint(self, targetSize: QSizeF) QSizeF ¶
Applies any item-specific size constraint handling to a given
targetSize
in layout units. Subclasses can override this method if they need to apply advanced logic regarding item sizes, which cannot be covered bysetFixedSize()
orsetMinimumSize()
. Item size constraints are applied after fixed, minimum and data defined size constraints.See also
See also
- arrowHeadFillColor(self) QColor ¶
Returns the color used to fill the arrow head.
See also
See also
- Return type:
QColor
- arrowHeadStrokeColor(self) QColor ¶
Returns the color used to draw the stroke around the the arrow head.
See also
See also
- Return type:
QColor
- arrowHeadStrokeWidth(self) float ¶
Returns the pen width in millimeters for the stroke of the arrow head.
See also
See also
- Return type:
float
- arrowHeadWidth(self) float ¶
Returns the width of line arrow heads in mm.
See also
- Return type:
float
- childEvent(self, QChildEvent)¶
- computeDistance(self, pt1: QPointF | QPoint, pt2: QPointF | QPoint) float ¶
Compute an euclidean distance between 2 nodes.
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QGraphicsSceneContextMenuEvent)¶
- create(layout: QgsLayout) QgsLayoutItemPolyline ¶
Returns a new polyline item for the specified
layout
.The caller takes responsibility for deleting the returned object.
- Parameters:
layout (QgsLayout) –
- Return type:
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- displayName(self) str ¶
- Return type:
str
- dragEnterEvent(self, QGraphicsSceneDragDropEvent)¶
- dragLeaveEvent(self, QGraphicsSceneDragDropEvent)¶
- dragMoveEvent(self, QGraphicsSceneDragDropEvent)¶
- draw(self, context: QgsLayoutItemRenderContext)¶
- drawBackground(self, context: QgsRenderContext)¶
Draws the background for the item.
See also
- drawDebugRect(self, painter: QPainter)¶
Draws a debugging rectangle of the item’s current bounds within the specified painter.
- Parameters:
painter – destination QPainter
- drawFrame(self, context: QgsRenderContext)¶
Draws the frame around the item.
See also
- drawRefreshingOverlay(self, painter: QPainter, itemStyle: QStyleOptionGraphicsItem)¶
Draws a “refreshing” overlay icon on the item.
New in version 3.32.
- dropEvent(self, QGraphicsSceneDragDropEvent)¶
- endMarker(self) QgsLayoutItemPolyline.MarkerMode ¶
Returns the end marker mode, which controls what marker is drawn at the end of the line.
See also
See also
- Return type:
- endSvgMarkerPath(self) str ¶
Returns the path the an SVG marker drawn at the end of the line.
See also
See also
- Return type:
str
- focusInEvent(self, QFocusEvent)¶
- focusOutEvent(self, QFocusEvent)¶
- framePath(self) QPainterPath ¶
Returns the path to use when drawing the item’s frame or background.
See also
See also
New in version 3.16.
- hoverEnterEvent(self, QGraphicsSceneHoverEvent)¶
- hoverLeaveEvent(self, QGraphicsSceneHoverEvent)¶
- hoverMoveEvent(self, QGraphicsSceneHoverEvent)¶
- icon(self) QIcon ¶
- Return type:
QIcon
- inputMethodEvent(self, QInputMethodEvent)¶
- inputMethodQuery(self, Qt.InputMethodQuery) Any ¶
- isSignalConnected(self, QMetaMethod) bool ¶
- itemChange(self, QGraphicsItem.GraphicsItemChange, Any) Any ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)¶
- mouseMoveEvent(self, QGraphicsSceneMouseEvent)¶
- mousePressEvent(self, QGraphicsSceneMouseEvent)¶
- mouseReleaseEvent(self, QGraphicsSceneMouseEvent)¶
- positionAtReferencePoint(self, reference: QgsLayoutItem.ReferencePoint) QPointF ¶
Returns the current position (in layout units) of a
reference
point for the item.
- prepareGeometryChange(self)¶
- readObjectPropertiesFromElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Sets object properties from a DOM element
- Parameters:
parentElement – is the parent DOM element for the object
document – DOM document
context – read write context
- Returns:
True
if read was successful
See also
- readPropertiesFromElement(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
- Parameters:
element (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
bool
- receivers(self, PYQT_SIGNAL) int ¶
- refreshBackgroundColor(self, updateItem: bool = True)¶
Refresh item’s background color, considering data defined colors. If
updateItem
is set toFalse
, the item will not be automatically updated after the frame color is set and a later call toupdate()
must be made.
- refreshBlendMode(self)¶
Refresh item’s blend mode, considering data defined blend mode.
- refreshFrame(self, updateItem: bool = True)¶
Refresh item’s frame, considering data defined colors and frame size. If
updateItem
is set toFalse
, the item will not be automatically updated after the frame is set and a later call toupdate()
must be made.
- refreshItemPosition(self)¶
Refreshes an item’s position by rechecking it against any possible overrides such as data defined positioning.
See also
- refreshItemRotation(self, origin: QPointF | QPoint = None)¶
Refreshes an item’s rotation by rechecking it against any possible overrides such as data defined rotation.
The optional
origin
point specifies the origin (in item coordinates) around which the rotation should be applied.See also
See also
- refreshItemSize(self)¶
Refreshes an item’s size by rechecking it against any possible item fixed or minimum sizes.
See also
See also
See also
- refreshOpacity(self, updateItem: bool = True)¶
Refresh item’s opacity, considering data defined opacity. If
updateItem
is set toFalse
the item will not be automatically updated after the opacity is set and a later call toupdate()
must be made.
- rescaleToFitBoundingBox(self)¶
Rescale the current shape according to the item’s bounding box. Useful when the shape is resized thanks to the rubber band.
- sceneEvent(self, QEvent) bool ¶
- sceneEventFilter(self, QGraphicsItem, QEvent) bool ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setArrowHeadFillColor(self, color: QColor | Qt.GlobalColor | QGradient)¶
Sets the
color
used to fill the arrow head.See also
See also
- Parameters:
color (Union[QColor) –
- setArrowHeadStrokeColor(self, color: QColor | Qt.GlobalColor | QGradient)¶
Sets the
color
used to draw the stroke around the arrow head.See also
See also
- Parameters:
color (Union[QColor) –
- setArrowHeadStrokeWidth(self, width: float)¶
Sets the pen
width
in millimeters for the stroke of the arrow headSee also
See also
- Parameters:
width (float) –
- setArrowHeadWidth(self, width: float)¶
Sets the
width
of line arrow heads in mm.See also
- Parameters:
width (float) –
- setEndMarker(self, mode: QgsLayoutItemPolyline.MarkerMode)¶
Sets the end marker
mode
, which controls what marker is drawn at the end of the line.See also
See also
- Parameters:
mode (QgsLayoutItemPolyline.MarkerMode) –
- setEndSvgMarkerPath(self, path: str)¶
Sets the
path
to a SVG marker to draw at the end of the line.See also
See also
- Parameters:
path (str) –
- setFixedSize(self, size: QgsLayoutSize)¶
Sets a fixed
size
for the layout item, which prevents it from being freely resized. Set an empty size if item can be freely resized.See also
fixedSize()
See also
- setMinimumSize(self, size: QgsLayoutSize)¶
Sets the minimum allowed
size
for the layout item. Set an empty size if item can be freely resized.See also
minimumSize()
See also
- setStartMarker(self, mode: QgsLayoutItemPolyline.MarkerMode)¶
Sets the start marker
mode
, which controls what marker is drawn at the start of the line.See also
See also
- Parameters:
mode (QgsLayoutItemPolyline.MarkerMode) –
- setStartSvgMarkerPath(self, path: str)¶
Sets the
path
to a SVG marker to draw at the start of the line.See also
See also
- Parameters:
path (str) –
- setSymbol(self, symbol: QgsLineSymbol)¶
Sets the
symbol
used to draw the shape. Ownership ofsymbol
is not transferred.See also
- Parameters:
symbol (QgsLineSymbol) –
- shape(self) QPainterPath ¶
- Return type:
QPainterPath
- startMarker(self) QgsLayoutItemPolyline.MarkerMode ¶
Returns the start marker mode, which controls what marker is drawn at the start of the line.
See also
See also
- Return type:
- startSvgMarkerPath(self) str ¶
Returns the path the an SVG marker drawn at the start of the line.
See also
See also
- Return type:
str
- symbol(self) QgsLineSymbol ¶
Returns the line symbol used to draw the shape.
See also
- Return type:
- timerEvent(self, QTimerEvent)¶
- topLeftToReferencePoint(self, point: QgsLayoutPoint) QgsLayoutPoint ¶
Returns the position for the reference point of the item, if the top-left of the item was placed at the specified
point
.
- type(self) int ¶
- Return type:
int
- updateBoundingRect(self)¶
- updateMicroFocus(self)¶
- updateSceneRect(self)¶
Update the current scene rectangle for this item.
- wheelEvent(self, QGraphicsSceneWheelEvent)¶
- writeObjectPropertiesToElement(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Stores object properties within an XML DOM element.
- Parameters:
parentElement – is the parent DOM element to store the object’s properties in
document – DOM document
context – read write context
- Returns:
True
if write was successful
See also
- writePropertiesToElement(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
- Parameters:
element (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
bool