QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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 "qgis_gui.h"
20
21#include <QMouseEvent>
22
23#define SIP_NO_FILE
24
25class QgsModelGraphicsView;
26
36class GUI_EXPORT QgsModelViewMouseEvent : public QMouseEvent
37{
38 public:
45 QgsModelViewMouseEvent( QgsModelGraphicsView *view, QMouseEvent *event, bool snaps );
46
50 void snapPoint();
51
55 QPointF modelPoint() const;
56
62 QPointF snappedPoint() const { return mSnappedPoint; }
63
68 bool isSnapped() const { return mSnapped; }
69
70
71 private:
73 QgsModelGraphicsView *mView = nullptr;
74
75 QPointF mModelPoint;
76 bool mSnapped = false;
77 QPointF mSnappedPoint;
78};
79
80#endif // QGSMODELVIEWMOUSEEVENT_H
QgsModelViewMouseEvent(QgsModelGraphicsView *view, QMouseEvent *event, bool snaps)
Constructor for QgsModelViewMouseEvent.
bool isSnapped() const
Returns true if point was snapped, e.g.
void snapPoint()
Manually triggers a snap for the mouse event position using the model's snapper.
QPointF modelPoint() const
Returns the event point location in model coordinates.
QPointF snappedPoint() const
Returns the snapped event point location in model coordinates.