Class: QgsMapCanvasAnnotationItem

class qgis.gui.QgsMapCanvasAnnotationItem(annotation: QgsAnnotation, mapCanvas: QgsMapCanvas)

Bases: PyQt5.QtCore.QObject, QgsMapCanvasItem

Constructor for QgsMapCanvasAnnotationItem.

An interactive map canvas item which displays a QgsAnnotation.

New in version 3.0.

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

Returns the item’s annotation.

Return type

QgsAnnotation

boundingRect(self) → QRectF
Return type

QRectF

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QGraphicsSceneContextMenuEvent)
cursorShapeForAction(self, moveAction: QgsMapCanvasAnnotationItem.MouseMoveAction) → Qt.CursorShape

Returns matching cursor shape for a mouse move action.

Parameters

moveAction (QgsMapCanvasAnnotationItem.MouseMoveAction) –

Return type

Qt.CursorShape

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QGraphicsSceneDragDropEvent)
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)
dragMoveEvent(self, QGraphicsSceneDragDropEvent)
dropEvent(self, QGraphicsSceneDragDropEvent)
focusInEvent(self, QFocusEvent)
focusOutEvent(self, QFocusEvent)
hoverEnterEvent(self, QGraphicsSceneHoverEvent)
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)
hoverMoveEvent(self, QGraphicsSceneHoverEvent)
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)
moveActionForPosition(self, pos: Union[QPointF, QPoint])QgsMapCanvasAnnotationItem.MouseMoveAction

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

Parameters

pos (Union[QPointF) –

Return type

QgsMapCanvasAnnotationItem.MouseMoveAction

paint(self, painter: QPainter)
Parameters

painter (QPainter) –

prepareGeometryChange(self)
receivers(self, PYQT_SIGNAL) → int
sceneEvent(self, QEvent) → bool
sceneEventFilter(self, QGraphicsItem, QEvent) → bool
sender(self) → QObject
senderSignalIndex(self) → int
setRenderContextVariables(self, p: QPainter, context: QgsRenderContext) → bool

Sets render context parameters

Parameters
  • p – painter for rendering

  • context – out: configured context

Returns

True in case of success

timerEvent(self, QTimerEvent)
updateCanvas(self)

schedules map canvas for repaint

updateMicroFocus(self)
updatePosition(self)
wheelEvent(self, QGraphicsSceneWheelEvent)