Class: QgsPlotMouseEvent¶
- class qgis.gui.QgsPlotMouseEvent¶
Bases:
PyQt5.QtGui.QMouseEvent
A
QgsPlotMouseEvent
is the result of a user interaction with the mouse on aQgsPlotCanvas
.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.
New in version 3.26.
QgsPlotMouseEvent(canvas:
QgsPlotCanvas
, event: QMouseEvent) Creates a new QgsPlotMouseEvent.- Parameters:
canvas – The map canvas on which the event occurred
event – The original mouse event
QgsPlotMouseEvent(canvas:
QgsPlotCanvas
, type: QEvent.Type, pos: QPoint, button: Qt.MouseButton = Qt.NoButton, buttons: Union[Qt.MouseButtons, Qt.MouseButton] = Qt.NoButton, modifiers: Union[Qt.KeyboardModifiers, Qt.KeyboardModifier] = Qt.NoModifier) Creates a new QgsPlotMouseEvent.- Parameters:
canvas – The canvas on which the event occurred
type – The type of the event
pos – The pixel position of the mouse
button – The pressed button
buttons – Further buttons that are pressed
modifiers – Keyboard modifiers
QgsPlotMouseEvent(
QgsPlotMouseEvent
)Methods
Returns
True
if the point can be snapped to the plot.Returns the point in map coordinates corresponding to the event.
Returns the point snapped to the plot, if possible.
- isSnapped(self) bool ¶
Returns
True
if the point can be snapped to the plot.- Return type:
bool
- mapPoint(self) QgsPoint ¶
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.
- Return type:
- snappedPoint(self) QgsPointXY ¶
Returns the point snapped to the plot, if possible.
Returns the original canvas point if snapping was not possible.
- Return type: