Class: QgsMapCanvasAnnotationItem

class qgis.gui.QgsMapCanvasAnnotationItem

Bases: PyQt5.QtCore.QObject, QgsMapCanvasItem

An interactive map canvas item which displays a QgsAnnotation.

New in version 3.0.

QgsMapCanvasAnnotationItem(annotation: QgsAnnotation, mapCanvas: QgsMapCanvas) Constructor for QgsMapCanvasAnnotationItem.

Methods

annotation

Returns the item’s annotation.

boundingRect

rtype

QRectF

childEvent

connectNotify

contextMenuEvent

cursorShapeForAction

Returns matching cursor shape for a mouse move action.

customEvent

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

focusInEvent

focusOutEvent

hoverEnterEvent

hoverLeaveEvent

hoverMoveEvent

inputMethodEvent

inputMethodQuery

isSignalConnected

itemChange

keyPressEvent

keyReleaseEvent

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveActionForPosition

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

paint

param painter

prepareGeometryChange

receivers

sceneEvent

sceneEventFilter

sender

senderSignalIndex

setRenderContextVariables

Sets render context parameters

timerEvent

updateCanvas

schedules map canvas for repaint

updateMicroFocus

updatePosition

wheelEvent

Attributes

MoveFramePosition

MoveMapPosition

NoAction

ResizeFrameDown

ResizeFrameLeft

ResizeFrameLeftDown

ResizeFrameLeftUp

ResizeFrameRight

ResizeFrameRightDown

ResizeFrameRightUp

ResizeFrameUp

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)