QGIS API Documentation  3.21.0-Master (5b68dc587e)
Public Member Functions | List of all members
QgsModelViewMouseEvent Class Reference

A QgsModelViewMouseEvent is the result of a user interaction with the mouse on a QgsModelGraphicsView. More...

#include <qgsmodelviewmouseevent.h>

Inheritance diagram for QgsModelViewMouseEvent:
Inheritance graph
[legend]

Public Member Functions

 QgsModelViewMouseEvent (QgsModelGraphicsView *view, QMouseEvent *event, bool snaps)
 Constructor for QgsModelViewMouseEvent. More...
 
bool isSnapped () const
 Returns true if point was snapped, e.g. More...
 
QPointF modelPoint () const
 Returns the event point location in model coordinates. More...
 
QPointF snappedPoint () const
 Returns the snapped event point location in model coordinates. More...
 
void snapPoint ()
 Manually triggers a snap for the mouse event position using the model's snapper. More...
 

Detailed Description

A QgsModelViewMouseEvent is the result of a user interaction with the mouse on a QgsModelGraphicsView.

It is sent whenever the user moves, clicks, releases or double clicks the mouse. In addition to the coordinates in pixel space it also knows the coordinates the model space.

Since
QGIS 3.14

Definition at line 36 of file qgsmodelviewmouseevent.h.

Constructor & Destructor Documentation

◆ QgsModelViewMouseEvent()

QgsModelViewMouseEvent::QgsModelViewMouseEvent ( QgsModelGraphicsView *  view,
QMouseEvent *  event,
bool  snaps 
)

Constructor for QgsModelViewMouseEvent.

Should only be required to be called from the QgsModelGraphicsView.

Parameters
viewThe view in which the event occurred.
eventThe original mouse event
snapsset to true if the event should be snapped

Definition at line 20 of file qgsmodelviewmouseevent.cpp.

Member Function Documentation

◆ isSnapped()

bool QgsModelViewMouseEvent::isSnapped ( ) const
inline

Returns true if point was snapped, e.g.

to grid.

See also
snappedPoint()

Definition at line 70 of file qgsmodelviewmouseevent.h.

◆ modelPoint()

QPointF QgsModelViewMouseEvent::modelPoint ( ) const

Returns the event point location in model coordinates.

Definition at line 44 of file qgsmodelviewmouseevent.cpp.

◆ snappedPoint()

QPointF QgsModelViewMouseEvent::snappedPoint ( ) const
inline

Returns the snapped event point location in model coordinates.

The snapped point will consider all possible snapping methods, such as snapping to grid.

See also
isSnapped()

Definition at line 64 of file qgsmodelviewmouseevent.h.

◆ snapPoint()

void QgsModelViewMouseEvent::snapPoint ( )

Manually triggers a snap for the mouse event position using the model's snapper.

Definition at line 36 of file qgsmodelviewmouseevent.cpp.


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