1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtWidgets module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QGRAPHICSSCENEEVENT_H
41#define QGRAPHICSSCENEEVENT_H
42
43#include <QtWidgets/qtwidgetsglobal.h>
44#include <QtCore/qcoreevent.h>
45#include <QtCore/qpoint.h>
46#include <QtCore/qscopedpointer.h>
47#include <QtCore/qrect.h>
48#include <QtGui/qpolygon.h>
49#include <QtCore/qset.h>
50#if QT_DEPRECATED_SINCE(5, 5)
51#include <QtCore/qhash.h>
52#endif
53
54QT_REQUIRE_CONFIG(graphicsview);
55
56QT_BEGIN_NAMESPACE
57
58class QMimeData;
59class QPointF;
60class QSizeF;
61class QWidget;
62
63class QGraphicsSceneEventPrivate;
64class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent
65{
66public:
67 explicit QGraphicsSceneEvent(Type type);
68 ~QGraphicsSceneEvent();
69
70 QWidget *widget() const;
71 void setWidget(QWidget *widget);
72
73protected:
74 QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None);
75 QScopedPointer<QGraphicsSceneEventPrivate> d_ptr;
76 Q_DECLARE_PRIVATE(QGraphicsSceneEvent)
77private:
78 Q_DISABLE_COPY(QGraphicsSceneEvent)
79};
80
81class QGraphicsSceneMouseEventPrivate;
82class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent
83{
84public:
85 explicit QGraphicsSceneMouseEvent(Type type = None);
86 ~QGraphicsSceneMouseEvent();
87
88 QPointF pos() const;
89 void setPos(const QPointF &pos);
90
91 QPointF scenePos() const;
92 void setScenePos(const QPointF &pos);
93
94 QPoint screenPos() const;
95 void setScreenPos(const QPoint &pos);
96
97 QPointF buttonDownPos(Qt::MouseButton button) const;
98 void setButtonDownPos(Qt::MouseButton button, const QPointF &pos);
99
100 QPointF buttonDownScenePos(Qt::MouseButton button) const;
101 void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos);
102
103 QPoint buttonDownScreenPos(Qt::MouseButton button) const;
104 void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos);
105
106 QPointF lastPos() const;
107 void setLastPos(const QPointF &pos);
108
109 QPointF lastScenePos() const;
110 void setLastScenePos(const QPointF &pos);
111
112 QPoint lastScreenPos() const;
113 void setLastScreenPos(const QPoint &pos);
114
115 Qt::MouseButtons buttons() const;
116 void setButtons(Qt::MouseButtons buttons);
117
118 Qt::MouseButton button() const;
119 void setButton(Qt::MouseButton button);
120
121 Qt::KeyboardModifiers modifiers() const;
122 void setModifiers(Qt::KeyboardModifiers modifiers);
123
124 Qt::MouseEventSource source() const;
125 void setSource(Qt::MouseEventSource source);
126
127 Qt::MouseEventFlags flags() const;
128 void setFlags(Qt::MouseEventFlags);
129
130private:
131 Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent)
132 Q_DISABLE_COPY(QGraphicsSceneMouseEvent)
133};
134
135class QGraphicsSceneWheelEventPrivate;
136class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent
137{
138public:
139 explicit QGraphicsSceneWheelEvent(Type type = None);
140 ~QGraphicsSceneWheelEvent();
141
142 QPointF pos() const;
143 void setPos(const QPointF &pos);
144
145 QPointF scenePos() const;
146 void setScenePos(const QPointF &pos);
147
148 QPoint screenPos() const;
149 void setScreenPos(const QPoint &pos);
150
151 Qt::MouseButtons buttons() const;
152 void setButtons(Qt::MouseButtons buttons);
153
154 Qt::KeyboardModifiers modifiers() const;
155 void setModifiers(Qt::KeyboardModifiers modifiers);
156
157 int delta() const;
158 void setDelta(int delta);
159
160 Qt::Orientation orientation() const;
161 void setOrientation(Qt::Orientation orientation);
162
163private:
164 Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent)
165 Q_DISABLE_COPY(QGraphicsSceneWheelEvent)
166};
167
168class QGraphicsSceneContextMenuEventPrivate;
169class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent
170{
171public:
172 enum Reason { Mouse, Keyboard, Other };
173
174 explicit QGraphicsSceneContextMenuEvent(Type type = None);
175 ~QGraphicsSceneContextMenuEvent();
176
177 QPointF pos() const;
178 void setPos(const QPointF &pos);
179
180 QPointF scenePos() const;
181 void setScenePos(const QPointF &pos);
182
183 QPoint screenPos() const;
184 void setScreenPos(const QPoint &pos);
185
186 Qt::KeyboardModifiers modifiers() const;
187 void setModifiers(Qt::KeyboardModifiers modifiers);
188
189 Reason reason() const;
190 void setReason(Reason reason);
191
192private:
193 Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent)
194 Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent)
195};
196
197class QGraphicsSceneHoverEventPrivate;
198class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent
199{
200public:
201 explicit QGraphicsSceneHoverEvent(Type type = None);
202 ~QGraphicsSceneHoverEvent();
203
204 QPointF pos() const;
205 void setPos(const QPointF &pos);
206
207 QPointF scenePos() const;
208 void setScenePos(const QPointF &pos);
209
210 QPoint screenPos() const;
211 void setScreenPos(const QPoint &pos);
212
213 QPointF lastPos() const;
214 void setLastPos(const QPointF &pos);
215
216 QPointF lastScenePos() const;
217 void setLastScenePos(const QPointF &pos);
218
219 QPoint lastScreenPos() const;
220 void setLastScreenPos(const QPoint &pos);
221
222 Qt::KeyboardModifiers modifiers() const;
223 void setModifiers(Qt::KeyboardModifiers modifiers);
224
225private:
226 Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent)
227 Q_DISABLE_COPY(QGraphicsSceneHoverEvent)
228};
229
230class QGraphicsSceneHelpEventPrivate;
231class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent
232{
233public:
234 explicit QGraphicsSceneHelpEvent(Type type = None);
235 ~QGraphicsSceneHelpEvent();
236
237 QPointF scenePos() const;
238 void setScenePos(const QPointF &pos);
239
240 QPoint screenPos() const;
241 void setScreenPos(const QPoint &pos);
242
243private:
244 Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent)
245 Q_DISABLE_COPY(QGraphicsSceneHelpEvent)
246};
247
248class QGraphicsSceneDragDropEventPrivate;
249class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent
250{
251public:
252 explicit QGraphicsSceneDragDropEvent(Type type = None);
253 ~QGraphicsSceneDragDropEvent();
254
255 QPointF pos() const;
256 void setPos(const QPointF &pos);
257
258 QPointF scenePos() const;
259 void setScenePos(const QPointF &pos);
260
261 QPoint screenPos() const;
262 void setScreenPos(const QPoint &pos);
263
264 Qt::MouseButtons buttons() const;
265 void setButtons(Qt::MouseButtons buttons);
266
267 Qt::KeyboardModifiers modifiers() const;
268 void setModifiers(Qt::KeyboardModifiers modifiers);
269
270 Qt::DropActions possibleActions() const;
271 void setPossibleActions(Qt::DropActions actions);
272
273 Qt::DropAction proposedAction() const;
274 void setProposedAction(Qt::DropAction action);
275 void acceptProposedAction();
276
277 Qt::DropAction dropAction() const;
278 void setDropAction(Qt::DropAction action);
279
280 QWidget *source() const;
281 void setSource(QWidget *source);
282
283 const QMimeData *mimeData() const;
284 void setMimeData(const QMimeData *data);
285
286private:
287 Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent)
288 Q_DISABLE_COPY(QGraphicsSceneDragDropEvent)
289};
290
291class QGraphicsSceneResizeEventPrivate;
292class Q_WIDGETS_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent
293{
294 Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent)
295 Q_DISABLE_COPY(QGraphicsSceneResizeEvent)
296public:
297 QGraphicsSceneResizeEvent();
298 ~QGraphicsSceneResizeEvent();
299
300 QSizeF oldSize() const;
301 void setOldSize(const QSizeF &size);
302
303 QSizeF newSize() const;
304 void setNewSize(const QSizeF &size);
305};
306
307class QGraphicsSceneMoveEventPrivate;
308class Q_WIDGETS_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent
309{
310 Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent)
311 Q_DISABLE_COPY(QGraphicsSceneMoveEvent)
312public:
313 QGraphicsSceneMoveEvent();
314 ~QGraphicsSceneMoveEvent();
315
316 QPointF oldPos() const;
317 void setOldPos(const QPointF &pos);
318
319 QPointF newPos() const;
320 void setNewPos(const QPointF &pos);
321};
322
323#ifndef QT_NO_DEBUG_STREAM
324Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGraphicsSceneEvent *);
325#endif
326
327QT_END_NAMESPACE
328
329#endif
330