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
51QT_REQUIRE_CONFIG(graphicsview);
52
53QT_BEGIN_NAMESPACE
54
55class QMimeData;
56class QPointF;
57class QSizeF;
58class QWidget;
59
60class QGraphicsSceneEventPrivate;
61class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent
62{
63public:
64 explicit QGraphicsSceneEvent(Type type);
65 ~QGraphicsSceneEvent();
66
67 QWidget *widget() const;
68 void setWidget(QWidget *widget);
69
70protected:
71 QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None);
72 QScopedPointer<QGraphicsSceneEventPrivate> d_ptr;
73 Q_DECLARE_PRIVATE(QGraphicsSceneEvent)
74private:
75 Q_DISABLE_COPY(QGraphicsSceneEvent)
76};
77
78class QGraphicsSceneMouseEventPrivate;
79class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent
80{
81public:
82 explicit QGraphicsSceneMouseEvent(Type type = None);
83 ~QGraphicsSceneMouseEvent();
84
85 QPointF pos() const;
86 void setPos(const QPointF &pos);
87
88 QPointF scenePos() const;
89 void setScenePos(const QPointF &pos);
90
91 QPoint screenPos() const;
92 void setScreenPos(const QPoint &pos);
93
94 QPointF buttonDownPos(Qt::MouseButton button) const;
95 void setButtonDownPos(Qt::MouseButton button, const QPointF &pos);
96
97 QPointF buttonDownScenePos(Qt::MouseButton button) const;
98 void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos);
99
100 QPoint buttonDownScreenPos(Qt::MouseButton button) const;
101 void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos);
102
103 QPointF lastPos() const;
104 void setLastPos(const QPointF &pos);
105
106 QPointF lastScenePos() const;
107 void setLastScenePos(const QPointF &pos);
108
109 QPoint lastScreenPos() const;
110 void setLastScreenPos(const QPoint &pos);
111
112 Qt::MouseButtons buttons() const;
113 void setButtons(Qt::MouseButtons buttons);
114
115 Qt::MouseButton button() const;
116 void setButton(Qt::MouseButton button);
117
118 Qt::KeyboardModifiers modifiers() const;
119 void setModifiers(Qt::KeyboardModifiers modifiers);
120
121 Qt::MouseEventSource source() const;
122 void setSource(Qt::MouseEventSource source);
123
124 Qt::MouseEventFlags flags() const;
125 void setFlags(Qt::MouseEventFlags);
126
127private:
128 Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent)
129 Q_DISABLE_COPY(QGraphicsSceneMouseEvent)
130};
131
132class QGraphicsSceneWheelEventPrivate;
133class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent
134{
135public:
136 explicit QGraphicsSceneWheelEvent(Type type = None);
137 ~QGraphicsSceneWheelEvent();
138
139 QPointF pos() const;
140 void setPos(const QPointF &pos);
141
142 QPointF scenePos() const;
143 void setScenePos(const QPointF &pos);
144
145 QPoint screenPos() const;
146 void setScreenPos(const QPoint &pos);
147
148 Qt::MouseButtons buttons() const;
149 void setButtons(Qt::MouseButtons buttons);
150
151 Qt::KeyboardModifiers modifiers() const;
152 void setModifiers(Qt::KeyboardModifiers modifiers);
153
154 int delta() const;
155 void setDelta(int delta);
156
157 Qt::Orientation orientation() const;
158 void setOrientation(Qt::Orientation orientation);
159
160private:
161 Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent)
162 Q_DISABLE_COPY(QGraphicsSceneWheelEvent)
163};
164
165class QGraphicsSceneContextMenuEventPrivate;
166class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent
167{
168public:
169 enum Reason { Mouse, Keyboard, Other };
170
171 explicit QGraphicsSceneContextMenuEvent(Type type = None);
172 ~QGraphicsSceneContextMenuEvent();
173
174 QPointF pos() const;
175 void setPos(const QPointF &pos);
176
177 QPointF scenePos() const;
178 void setScenePos(const QPointF &pos);
179
180 QPoint screenPos() const;
181 void setScreenPos(const QPoint &pos);
182
183 Qt::KeyboardModifiers modifiers() const;
184 void setModifiers(Qt::KeyboardModifiers modifiers);
185
186 Reason reason() const;
187 void setReason(Reason reason);
188
189private:
190 Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent)
191 Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent)
192};
193
194class QGraphicsSceneHoverEventPrivate;
195class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent
196{
197public:
198 explicit QGraphicsSceneHoverEvent(Type type = None);
199 ~QGraphicsSceneHoverEvent();
200
201 QPointF pos() const;
202 void setPos(const QPointF &pos);
203
204 QPointF scenePos() const;
205 void setScenePos(const QPointF &pos);
206
207 QPoint screenPos() const;
208 void setScreenPos(const QPoint &pos);
209
210 QPointF lastPos() const;
211 void setLastPos(const QPointF &pos);
212
213 QPointF lastScenePos() const;
214 void setLastScenePos(const QPointF &pos);
215
216 QPoint lastScreenPos() const;
217 void setLastScreenPos(const QPoint &pos);
218
219 Qt::KeyboardModifiers modifiers() const;
220 void setModifiers(Qt::KeyboardModifiers modifiers);
221
222private:
223 Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent)
224 Q_DISABLE_COPY(QGraphicsSceneHoverEvent)
225};
226
227class QGraphicsSceneHelpEventPrivate;
228class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent
229{
230public:
231 explicit QGraphicsSceneHelpEvent(Type type = None);
232 ~QGraphicsSceneHelpEvent();
233
234 QPointF scenePos() const;
235 void setScenePos(const QPointF &pos);
236
237 QPoint screenPos() const;
238 void setScreenPos(const QPoint &pos);
239
240private:
241 Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent)
242 Q_DISABLE_COPY(QGraphicsSceneHelpEvent)
243};
244
245class QGraphicsSceneDragDropEventPrivate;
246class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent
247{
248public:
249 explicit QGraphicsSceneDragDropEvent(Type type = None);
250 ~QGraphicsSceneDragDropEvent();
251
252 QPointF pos() const;
253 void setPos(const QPointF &pos);
254
255 QPointF scenePos() const;
256 void setScenePos(const QPointF &pos);
257
258 QPoint screenPos() const;
259 void setScreenPos(const QPoint &pos);
260
261 Qt::MouseButtons buttons() const;
262 void setButtons(Qt::MouseButtons buttons);
263
264 Qt::KeyboardModifiers modifiers() const;
265 void setModifiers(Qt::KeyboardModifiers modifiers);
266
267 Qt::DropActions possibleActions() const;
268 void setPossibleActions(Qt::DropActions actions);
269
270 Qt::DropAction proposedAction() const;
271 void setProposedAction(Qt::DropAction action);
272 void acceptProposedAction();
273
274 Qt::DropAction dropAction() const;
275 void setDropAction(Qt::DropAction action);
276
277 QWidget *source() const;
278 void setSource(QWidget *source);
279
280 const QMimeData *mimeData() const;
281 void setMimeData(const QMimeData *data);
282
283private:
284 Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent)
285 Q_DISABLE_COPY(QGraphicsSceneDragDropEvent)
286};
287
288class QGraphicsSceneResizeEventPrivate;
289class Q_WIDGETS_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent
290{
291 Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent)
292 Q_DISABLE_COPY(QGraphicsSceneResizeEvent)
293public:
294 QGraphicsSceneResizeEvent();
295 ~QGraphicsSceneResizeEvent();
296
297 QSizeF oldSize() const;
298 void setOldSize(const QSizeF &size);
299
300 QSizeF newSize() const;
301 void setNewSize(const QSizeF &size);
302};
303
304class QGraphicsSceneMoveEventPrivate;
305class Q_WIDGETS_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent
306{
307 Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent)
308 Q_DISABLE_COPY(QGraphicsSceneMoveEvent)
309public:
310 QGraphicsSceneMoveEvent();
311 ~QGraphicsSceneMoveEvent();
312
313 QPointF oldPos() const;
314 void setOldPos(const QPointF &pos);
315
316 QPointF newPos() const;
317 void setNewPos(const QPointF &pos);
318};
319
320#ifndef QT_NO_DEBUG_STREAM
321Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGraphicsSceneEvent *);
322#endif
323
324QT_END_NAMESPACE
325
326#endif
327