Class: QgsMapCanvasAnnotationItem

An interactive map canvas item which displays a QgsAnnotation.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapCanvasAnnotationItem

Base classes

QObject

QgsMapCanvasItem

An abstract class for items that can be placed on the map canvas.

QGraphicsItem

Methods

annotation

Returns the item's annotation.

cursorShapeForAction

Returns matching cursor shape for a mouse move action.

moveActionForPosition

Returns the mouse move behavior for a given position in scene coordinates

Attributes

MoveFramePosition

MoveMapPosition

NoAction

ResizeFrameDown

ResizeFrameLeft

ResizeFrameLeftDown

ResizeFrameLeftUp

ResizeFrameRight

ResizeFrameRightDown

ResizeFrameRightUp

ResizeFrameUp

class qgis.gui.QgsMapCanvasAnnotationItem[source]

Bases: QObject, QgsMapCanvasItem

__init__(annotation: QgsAnnotation | None, mapCanvas: QgsMapCanvas | None)

Constructor for QgsMapCanvasAnnotationItem.

Parameters:
class MouseMoveAction

Bases: int

MoveFramePosition = 2
MoveMapPosition = 1
NoAction = 0
ResizeFrameDown = 4
ResizeFrameLeft = 5
ResizeFrameLeftDown = 9
ResizeFrameLeftUp = 7
ResizeFrameRight = 6
ResizeFrameRightDown = 10
ResizeFrameRightUp = 8
ResizeFrameUp = 3
annotation(self) QgsAnnotation | None[source]

Returns the item’s annotation.

Return type:

Optional[QgsAnnotation]

cursorShapeForAction(self, moveAction: QgsMapCanvasAnnotationItem.MouseMoveAction) Qt.CursorShape[source]

Returns matching cursor shape for a mouse move action.

Parameters:

moveAction (QgsMapCanvasAnnotationItem.MouseMoveAction)

Return type:

Qt.CursorShape

moveActionForPosition(self, pos: QPointF | QPoint) QgsMapCanvasAnnotationItem.MouseMoveAction[source]

Returns the mouse move behavior for a given position in scene coordinates

Parameters:

pos (Union[QPointF, QPoint])

Return type:

QgsMapCanvasAnnotationItem.MouseMoveAction