QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsMapCanvasAnnotationItem Class Reference

An interactive map canvas item which displays a QgsAnnotation. More...

#include <qgsmapcanvasannotationitem.h>

Inheritance diagram for QgsMapCanvasAnnotationItem:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 QgsMapCanvasAnnotationItem (QgsAnnotation *annotation, QgsMapCanvas *mapCanvas)
 Constructor for QgsMapCanvasAnnotationItem.
 
QgsAnnotationannotation ()
 Returns the item's annotation.
 
const QgsAnnotationannotation () const
 Returns the item's annotation.
 
QRectF boundingRect () const override
 
Qt::CursorShape cursorShapeForAction (MouseMoveAction moveAction) const
 Returns matching cursor shape for a mouse move action.
 
MouseMoveAction moveActionForPosition (QPointF pos) const
 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
 
- Public Member Functions inherited from QgsMapCanvasItem
QRectF boundingRect () const override
 
QgsRectangle rect () const
 returns canvas item rectangle in map units
 
void setRect (const QgsRectangle &r, bool resetRotation=true)
 sets canvas item rectangle in map units
 
QPointF toCanvasCoordinates (const QgsPointXY &point) const
 transformation from map coordinates to screen coordinates
 
QgsPointXY toMapCoordinates (QPoint point) const
 transformation from screen coordinates to map coordinates
 

Additional Inherited Members

- Protected Member Functions inherited from QgsMapCanvasItem
 QgsMapCanvasItem (QgsMapCanvas *mapCanvas)
 protected constructor: cannot be constructed directly
 
 ~QgsMapCanvasItem () override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
 
bool setRenderContextVariables (QPainter *p, QgsRenderContext &context) const
 Sets render context parameters.
 
void updateCanvas ()
 schedules map canvas for repaint
 
- Protected Attributes inherited from QgsMapCanvasItem
QSizeF mItemSize
 cached size of the item (to return in boundingRect())
 
QgsMapCanvasmMapCanvas = nullptr
 pointer to map canvas
 
QgsRectangle mRect
 cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) used to re-position and re-size the item on zoom/pan while waiting for the renderer to complete.
 
double mRectRotation
 

Detailed Description

An interactive map canvas item which displays a QgsAnnotation.

Definition at line 38 of file qgsmapcanvasannotationitem.h.

Member Enumeration Documentation

◆ MouseMoveAction

Mouse actions for interacting with item.

Enumerator
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.

Definition at line 56 of file qgsmapcanvasannotationitem.h.

Constructor & Destructor Documentation

◆ QgsMapCanvasAnnotationItem()

QgsMapCanvasAnnotationItem::QgsMapCanvasAnnotationItem ( QgsAnnotation annotation,
QgsMapCanvas mapCanvas 
)

Constructor for QgsMapCanvasAnnotationItem.

Definition at line 35 of file qgsmapcanvasannotationitem.cpp.

Member Function Documentation

◆ annotation() [1/2]

QgsAnnotation * QgsMapCanvasAnnotationItem::annotation ( )
inline

Returns the item's annotation.

Definition at line 88 of file qgsmapcanvasannotationitem.h.

◆ annotation() [2/2]

const QgsAnnotation * QgsMapCanvasAnnotationItem::annotation ( ) const
inline

Returns the item's annotation.

Note
not available in Python bindings

Definition at line 80 of file qgsmapcanvasannotationitem.h.

◆ boundingRect()

QRectF QgsMapCanvasAnnotationItem::boundingRect ( ) const
override

Definition at line 88 of file qgsmapcanvasannotationitem.cpp.

◆ cursorShapeForAction()

Qt::CursorShape QgsMapCanvasAnnotationItem::cursorShapeForAction ( MouseMoveAction  moveAction) const

Returns matching cursor shape for a mouse move action.

Definition at line 268 of file qgsmapcanvasannotationitem.cpp.

◆ moveActionForPosition()

QgsMapCanvasAnnotationItem::MouseMoveAction QgsMapCanvasAnnotationItem::moveActionForPosition ( QPointF  pos) const

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

Definition at line 199 of file qgsmapcanvasannotationitem.cpp.

◆ paint()

void QgsMapCanvasAnnotationItem::paint ( QPainter *  painter)
overridevirtual

function to be implemented by derived classes

Implements QgsMapCanvasItem.

Definition at line 310 of file qgsmapcanvasannotationitem.cpp.

◆ updatePosition()

void QgsMapCanvasAnnotationItem::updatePosition ( )
overridevirtual

called on changed extent or resize event to update position of the item

Reimplemented from QgsMapCanvasItem.

Definition at line 60 of file qgsmapcanvasannotationitem.cpp.


The documentation for this class was generated from the following files: