QgsMapCanvasAnnotationItem class

An interactive map canvas item which displays a QgsAnnotation.

Base classes

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

Public types

enum MouseMoveAction { NoAction, MoveMapPosition, MoveFramePosition, ResizeFrameUp, ResizeFrameDown, ResizeFrameLeft, ResizeFrameRight, ResizeFrameLeftUp, ResizeFrameRightUp, ResizeFrameLeftDown, ResizeFrameRightDown }
Mouse actions for interacting with item.

Constructors, destructors, conversion operators

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

Public functions

auto annotation() const -> const QgsAnnotation*
Returns the item's annotation.
auto annotation() -> QgsAnnotation*
Returns the item's annotation.
auto cursorShapeForAction(MouseMoveAction moveAction) const -> Qt::CursorShape
Returns matching cursor shape for a mouse move action.
auto moveActionForPosition(QPointF pos) const -> MouseMoveAction
Returns the mouse move behavior for a given position in scene coordinates.
void paint(QPainter* painter) override
function to be implemented by derived classes
void updatePosition() override
called on changed extent or resize event to update position of the item

Enum documentation

enum QgsMapCanvasAnnotationItem::MouseMoveAction

Mouse actions for interacting with item.

Enumerators
NoAction

No action.

MoveMapPosition

Moving annotation map position.

MoveFramePosition

Moving position of frame relative to annotation.

ResizeFrameUp

Resize frame up.

ResizeFrameDown

Resize frame down.

ResizeFrameLeft

Resize frame left.

ResizeFrameRight

Resize frame right.

ResizeFrameLeftUp

Resize frame left up.

ResizeFrameRightUp

Resize frame right up.

ResizeFrameLeftDown

Resize frame left down.

ResizeFrameRightDown

Resize frame right down.

Function documentation

const QgsAnnotation* QgsMapCanvasAnnotationItem::annotation() const

Returns the item's annotation.