QGIS API Documentation  3.21.0-Master (909859188c)
qgsmodelviewmouseevent.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmodelviewmouseevent.h
3  -------------------------
4  Date : March 2020
5  Copyright : (C) 2020 Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSMODELVIEWMOUSEEVENT_H
17 #define QGSMODELVIEWMOUSEEVENT_H
18 
19 #include <QMouseEvent>
20 
21 #include "qgis_gui.h"
22 
23 #define SIP_NO_FILE
24 
25 class QgsModelGraphicsView;
26 
36 class GUI_EXPORT QgsModelViewMouseEvent : public QMouseEvent
37 {
38 
39  public:
40 
47  QgsModelViewMouseEvent( QgsModelGraphicsView *view, QMouseEvent *event, bool snaps );
48 
52  void snapPoint();
53 
57  QPointF modelPoint() const;
58 
64  QPointF snappedPoint() const { return mSnappedPoint; }
65 
70  bool isSnapped() const { return mSnapped; }
71 
72 
73  private:
74 
76  QgsModelGraphicsView *mView = nullptr;
77 
78  QPointF mModelPoint;
79  bool mSnapped = false;
80  QPointF mSnappedPoint;
81 };
82 
83 #endif // QGSMODELVIEWMOUSEEVENT_H
A QgsModelViewMouseEvent is the result of a user interaction with the mouse on a QgsModelGraphicsView...
bool isSnapped() const
Returns true if point was snapped, e.g.
QPointF snappedPoint() const
Returns the snapped event point location in model coordinates.