Class: QgsGeometryRubberBand

class qgis.gui.QgsGeometryRubberBand

Bases: QgsMapCanvasItem

A rubberband class for QgsAbstractGeometry (considering curved geometries).

QgsGeometryRubberBand(mapCanvas: Optional[QgsMapCanvas], geomType: Qgis.GeometryType = Qgis.GeometryType.Line) Constructor for QgsGeometryRubberBand of the given geomType, shown in the specified mapCanvas.

Methods

contextMenuEvent

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

focusInEvent

focusOutEvent

geometry

Returns a pointer to the geometry

geometryType

Returns which geometry is handled by the rubber band, polygon or line

hoverEnterEvent

hoverLeaveEvent

hoverMoveEvent

inputMethodEvent

inputMethodQuery

itemChange

keyPressEvent

keyReleaseEvent

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveVertex

Moves vertex to new position (in map coordinates)

paint

param painter:

prepareGeometryChange

sceneEvent

sceneEventFilter

setBrushStyle

Sets brush style

setFillColor

Sets fill color for vertex markers

setGeometry

Sets geometry (takes ownership).

setGeometryType

Sets which geometry is handled by the rubber band, polygon or line

setIconType

Sets vertex marker icon type

setLineStyle

Sets pen style

setRenderContextVariables

Sets render context parameters

setStrokeColor

Sets stroke color for vertex markers

setStrokeWidth

Sets stroke width

setVertexDrawingEnabled

Sets whether the vertices are drawn

updateCanvas

schedules map canvas for repaint

updateMicroFocus

updatePosition

wheelEvent

Attributes

ICON_BOX

ICON_CIRCLE

ICON_CROSS

ICON_FULL_BOX

ICON_NONE

ICON_X

ICON_BOX = 3
ICON_CIRCLE = 4
ICON_CROSS = 1
ICON_FULL_BOX = 5
ICON_NONE = 0
ICON_X = 2
class IconType

Bases: int

contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent | None)
dragEnterEvent(self, event: QGraphicsSceneDragDropEvent | None)
dragLeaveEvent(self, event: QGraphicsSceneDragDropEvent | None)
dragMoveEvent(self, event: QGraphicsSceneDragDropEvent | None)
dropEvent(self, event: QGraphicsSceneDragDropEvent | None)
focusInEvent(self, event: QFocusEvent | None)
focusOutEvent(self, event: QFocusEvent | None)
geometry(self) QgsAbstractGeometry | None

Returns a pointer to the geometry

Return type:

Optional[QgsAbstractGeometry]

geometryType(self) Qgis.GeometryType

Returns which geometry is handled by the rubber band, polygon or line

Return type:

Qgis.GeometryType

hoverEnterEvent(self, event: QGraphicsSceneHoverEvent | None)
hoverLeaveEvent(self, event: QGraphicsSceneHoverEvent | None)
hoverMoveEvent(self, event: QGraphicsSceneHoverEvent | None)
inputMethodEvent(self, event: QInputMethodEvent | None)
inputMethodQuery(self, query: Qt.InputMethodQuery) Any
itemChange(self, change: QGraphicsItem.GraphicsItemChange, value: Any) Any
keyPressEvent(self, event: QKeyEvent | None)
keyReleaseEvent(self, event: QKeyEvent | None)
mouseDoubleClickEvent(self, event: QGraphicsSceneMouseEvent | None)
mouseMoveEvent(self, event: QGraphicsSceneMouseEvent | None)
mousePressEvent(self, event: QGraphicsSceneMouseEvent | None)
mouseReleaseEvent(self, event: QGraphicsSceneMouseEvent | None)
moveVertex(self, id: QgsVertexId, newPos: QgsPoint)

Moves vertex to new position (in map coordinates)

Parameters:
paint(self, painter: QPainter | None)
Parameters:

painter (Optional[QPainter])

prepareGeometryChange(self)
sceneEvent(self, event: QEvent | None) bool
sceneEventFilter(self, watched: QGraphicsItem | None, event: QEvent | None) bool
setBrushStyle(self, brushStyle: Qt.BrushStyle)

Sets brush style

Parameters:

brushStyle (Qt.BrushStyle)

setFillColor(self, c: QColor | Qt.GlobalColor)

Sets fill color for vertex markers

Parameters:

c (Union[QColor)

setGeometry(self, geom: QgsAbstractGeometry | None)

Sets geometry (takes ownership). Geometry is expected to be in map coordinates

Parameters:

geom (Optional[QgsAbstractGeometry])

setGeometryType(self, geometryType: Qgis.GeometryType)

Sets which geometry is handled by the rubber band, polygon or line

Parameters:

geometryType (Qgis.GeometryType)

setIconType(self, iconType: QgsGeometryRubberBand.IconType)

Sets vertex marker icon type

Parameters:

iconType (QgsGeometryRubberBand.IconType)

setLineStyle(self, penStyle: Qt.PenStyle)

Sets pen style

Parameters:

penStyle (Qt.PenStyle)

setRenderContextVariables(self, p: QPainter | None, context: QgsRenderContext) bool

Sets render context parameters

Parameters:
  • p – painter for rendering

  • context – out: configured context

Returns:

True in case of success

setStrokeColor(self, c: QColor | Qt.GlobalColor)

Sets stroke color for vertex markers

Parameters:

c (Union[QColor)

setStrokeWidth(self, width: int)

Sets stroke width

Parameters:

width (int)

setVertexDrawingEnabled(self, isVerticesDrawn: bool)

Sets whether the vertices are drawn

Parameters:

isVerticesDrawn (bool)

updateCanvas(self)

schedules map canvas for repaint

updateMicroFocus(self)
updatePosition(self)
wheelEvent(self, event: QGraphicsSceneWheelEvent | None)