QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgslayoutviewmouseevent.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutviewmouseevent.h
3 -------------------------
4 Date : July 2017
5 Copyright : (C) 2017 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 QGSLAYOUTVIEWMOUSEEVENT_H
17#define QGSLAYOUTVIEWMOUSEEVENT_H
18
19#include <QMouseEvent>
20
21#include "qgis_gui.h"
22
23class QgsLayoutView;
24class QGraphicsLineItem;
25class QgsLayoutItem;
26
34class GUI_EXPORT QgsLayoutViewMouseEvent : public QMouseEvent
35{
36#ifdef SIP_RUN
38 if ( dynamic_cast<QgsLayoutViewMouseEvent *>( sipCpp ) )
39 sipType = sipType_QgsLayoutViewMouseEvent;
40 else
41 sipType = 0;
43#endif
44
45 public:
52 QgsLayoutViewMouseEvent( QgsLayoutView *view, QMouseEvent *event, bool snap = false );
53
62 void snapPoint( QGraphicsLineItem *horizontalSnapLine = nullptr, QGraphicsLineItem *verticalSnapLine = nullptr, const QList<QgsLayoutItem *> &ignoreItems = QList<QgsLayoutItem *>() );
63
67 QPointF layoutPoint() const;
68
74 QPointF snappedPoint() const { return mSnappedPoint; }
75
80 bool isSnapped() const { return mSnapped; }
81
82 private:
84 QgsLayoutView *mView = nullptr;
85
86 bool mSnapped = false;
87 QPointF mLayoutPoint;
88 QPointF mSnappedPoint;
89};
90
91#endif // QGSLAYOUTVIEWMOUSEEVENT_H
Base class for graphical items within a QgsLayout.
A QgsLayoutViewMouseEvent is the result of a user interaction with the mouse on a QgsLayoutView.
bool isSnapped() const
Returns true if point was snapped, e.g.
QPointF snappedPoint() const
Returns the snapped event point location in layout coordinates.
A graphical widget to display and interact with QgsLayouts.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_END
Definition qgis_sip.h:208