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

A QgsPlotMouseEvent is the result of a user interaction with the mouse on a QgsPlotCanvas. More...

#include <qgsplotmouseevent.h>

Inheritance diagram for QgsPlotMouseEvent:
Inheritance graph
[legend]

Public Member Functions

 QgsPlotMouseEvent (QgsPlotCanvas *canvas, QEvent::Type type, QPoint pos, Qt::MouseButton button=Qt::NoButton, Qt::MouseButtons buttons=Qt::NoButton, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
 Creates a new QgsPlotMouseEvent.
 
 QgsPlotMouseEvent (QgsPlotCanvas *canvas, QMouseEvent *event)
 Creates a new QgsPlotMouseEvent.
 
bool isSnapped ()
 Returns true if the point can be snapped to the plot.
 
QgsPoint mapPoint () const
 Returns the point in map coordinates corresponding to the event.
 
QgsPointXY snappedPoint ()
 Returns the point snapped to the plot, if possible.
 

Detailed Description

A QgsPlotMouseEvent is the result of a user interaction with the mouse on a QgsPlotCanvas.

The event is sent whenever the user moves, clicks, releases or double clicks the mouse.

In addition to the coordinates in pixel space the event may have knowledge about geographic coordinates corresponding to the event.

Since
QGIS 3.26

Definition at line 39 of file qgsplotmouseevent.h.

Constructor & Destructor Documentation

◆ QgsPlotMouseEvent() [1/2]

QgsPlotMouseEvent::QgsPlotMouseEvent ( QgsPlotCanvas canvas,
QMouseEvent *  event 
)

Creates a new QgsPlotMouseEvent.

Parameters
canvasThe map canvas on which the event occurred
eventThe original mouse event

Definition at line 20 of file qgsplotmouseevent.cpp.

◆ QgsPlotMouseEvent() [2/2]

QgsPlotMouseEvent::QgsPlotMouseEvent ( QgsPlotCanvas canvas,
QEvent::Type  type,
QPoint  pos,
Qt::MouseButton  button = Qt::NoButton,
Qt::MouseButtons  buttons = Qt::NoButton,
Qt::KeyboardModifiers  modifiers = Qt::NoModifier 
)

Creates a new QgsPlotMouseEvent.

Parameters
canvasThe canvas on which the event occurred
typeThe type of the event
posThe pixel position of the mouse
buttonThe pressed button
buttonsFurther buttons that are pressed
modifiersKeyboard modifiers

Definition at line 25 of file qgsplotmouseevent.cpp.

Member Function Documentation

◆ isSnapped()

bool QgsPlotMouseEvent::isSnapped ( )

Returns true if the point can be snapped to the plot.

Definition at line 46 of file qgsplotmouseevent.cpp.

◆ mapPoint()

QgsPoint QgsPlotMouseEvent::mapPoint ( ) const

Returns the point in map coordinates corresponding to the event.

May return an empty point if the event cannot be converted to a map point.

Definition at line 32 of file qgsplotmouseevent.cpp.

◆ snappedPoint()

QgsPointXY QgsPlotMouseEvent::snappedPoint ( )

Returns the point snapped to the plot, if possible.

Returns the original canvas point if snapping was not possible.

Definition at line 37 of file qgsplotmouseevent.cpp.


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