1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QGRAPHICSSCENEEVENT_H |
5 | #define QGRAPHICSSCENEEVENT_H |
6 | |
7 | #include <QtWidgets/qtwidgetsglobal.h> |
8 | #include <QtCore/qcoreevent.h> |
9 | #include <QtCore/qpoint.h> |
10 | #include <QtCore/qscopedpointer.h> |
11 | #include <QtCore/qrect.h> |
12 | #include <QtGui/qpolygon.h> |
13 | #include <QtCore/qset.h> |
14 | |
15 | QT_REQUIRE_CONFIG(graphicsview); |
16 | |
17 | QT_BEGIN_NAMESPACE |
18 | |
19 | class QMimeData; |
20 | class QPointF; |
21 | class QSizeF; |
22 | class QWidget; |
23 | |
24 | class QGraphicsSceneEventPrivate; |
25 | class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent |
26 | { |
27 | public: |
28 | explicit QGraphicsSceneEvent(Type type); |
29 | ~QGraphicsSceneEvent(); |
30 | |
31 | QWidget *widget() const; |
32 | void setWidget(QWidget *widget); |
33 | |
34 | quint64 timestamp() const; |
35 | void setTimestamp(quint64 ts); |
36 | |
37 | protected: |
38 | QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); |
39 | QScopedPointer<QGraphicsSceneEventPrivate> d_ptr; |
40 | Q_DECLARE_PRIVATE(QGraphicsSceneEvent) |
41 | private: |
42 | Q_DISABLE_COPY(QGraphicsSceneEvent) |
43 | }; |
44 | |
45 | class QGraphicsSceneMouseEventPrivate; |
46 | class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent |
47 | { |
48 | public: |
49 | explicit QGraphicsSceneMouseEvent(Type type = None); |
50 | ~QGraphicsSceneMouseEvent(); |
51 | |
52 | QPointF pos() const; |
53 | void setPos(const QPointF &pos); |
54 | |
55 | QPointF scenePos() const; |
56 | void setScenePos(const QPointF &pos); |
57 | |
58 | QPoint screenPos() const; |
59 | void setScreenPos(const QPoint &pos); |
60 | |
61 | QPointF buttonDownPos(Qt::MouseButton button) const; |
62 | void setButtonDownPos(Qt::MouseButton button, const QPointF &pos); |
63 | |
64 | QPointF buttonDownScenePos(Qt::MouseButton button) const; |
65 | void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos); |
66 | |
67 | QPoint buttonDownScreenPos(Qt::MouseButton button) const; |
68 | void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos); |
69 | |
70 | QPointF lastPos() const; |
71 | void setLastPos(const QPointF &pos); |
72 | |
73 | QPointF lastScenePos() const; |
74 | void setLastScenePos(const QPointF &pos); |
75 | |
76 | QPoint lastScreenPos() const; |
77 | void setLastScreenPos(const QPoint &pos); |
78 | |
79 | Qt::MouseButtons buttons() const; |
80 | void setButtons(Qt::MouseButtons buttons); |
81 | |
82 | Qt::MouseButton button() const; |
83 | void setButton(Qt::MouseButton button); |
84 | |
85 | Qt::KeyboardModifiers modifiers() const; |
86 | void setModifiers(Qt::KeyboardModifiers modifiers); |
87 | |
88 | Qt::MouseEventSource source() const; |
89 | void setSource(Qt::MouseEventSource source); |
90 | |
91 | Qt::MouseEventFlags flags() const; |
92 | void setFlags(Qt::MouseEventFlags); |
93 | |
94 | private: |
95 | Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent) |
96 | Q_DISABLE_COPY(QGraphicsSceneMouseEvent) |
97 | }; |
98 | |
99 | class QGraphicsSceneWheelEventPrivate; |
100 | class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent |
101 | { |
102 | public: |
103 | explicit QGraphicsSceneWheelEvent(Type type = None); |
104 | ~QGraphicsSceneWheelEvent(); |
105 | |
106 | QPointF pos() const; |
107 | void setPos(const QPointF &pos); |
108 | |
109 | QPointF scenePos() const; |
110 | void setScenePos(const QPointF &pos); |
111 | |
112 | QPoint screenPos() const; |
113 | void setScreenPos(const QPoint &pos); |
114 | |
115 | Qt::MouseButtons buttons() const; |
116 | void setButtons(Qt::MouseButtons buttons); |
117 | |
118 | Qt::KeyboardModifiers modifiers() const; |
119 | void setModifiers(Qt::KeyboardModifiers modifiers); |
120 | |
121 | int delta() const; |
122 | void setDelta(int delta); |
123 | |
124 | Qt::Orientation orientation() const; |
125 | void setOrientation(Qt::Orientation orientation); |
126 | |
127 | Qt::ScrollPhase phase() const; |
128 | void setPhase(Qt::ScrollPhase scrollPhase); |
129 | |
130 | QPoint pixelDelta() const; |
131 | void setPixelDelta(QPoint delta); |
132 | |
133 | bool isInverted() const; |
134 | void setInverted(bool inverted); |
135 | |
136 | private: |
137 | Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent) |
138 | Q_DISABLE_COPY(QGraphicsSceneWheelEvent) |
139 | }; |
140 | |
141 | class QGraphicsSceneContextMenuEventPrivate; |
142 | class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent |
143 | { |
144 | public: |
145 | enum Reason { Mouse, Keyboard, Other }; |
146 | |
147 | explicit QGraphicsSceneContextMenuEvent(Type type = None); |
148 | ~QGraphicsSceneContextMenuEvent(); |
149 | |
150 | QPointF pos() const; |
151 | void setPos(const QPointF &pos); |
152 | |
153 | QPointF scenePos() const; |
154 | void setScenePos(const QPointF &pos); |
155 | |
156 | QPoint screenPos() const; |
157 | void setScreenPos(const QPoint &pos); |
158 | |
159 | Qt::KeyboardModifiers modifiers() const; |
160 | void setModifiers(Qt::KeyboardModifiers modifiers); |
161 | |
162 | Reason reason() const; |
163 | void setReason(Reason reason); |
164 | |
165 | private: |
166 | Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent) |
167 | Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent) |
168 | }; |
169 | |
170 | class QGraphicsSceneHoverEventPrivate; |
171 | class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent |
172 | { |
173 | public: |
174 | explicit QGraphicsSceneHoverEvent(Type type = None); |
175 | ~QGraphicsSceneHoverEvent(); |
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 | QPointF lastPos() const; |
187 | void setLastPos(const QPointF &pos); |
188 | |
189 | QPointF lastScenePos() const; |
190 | void setLastScenePos(const QPointF &pos); |
191 | |
192 | QPoint lastScreenPos() const; |
193 | void setLastScreenPos(const QPoint &pos); |
194 | |
195 | Qt::KeyboardModifiers modifiers() const; |
196 | void setModifiers(Qt::KeyboardModifiers modifiers); |
197 | |
198 | private: |
199 | Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent) |
200 | Q_DISABLE_COPY(QGraphicsSceneHoverEvent) |
201 | }; |
202 | |
203 | class QGraphicsSceneHelpEventPrivate; |
204 | class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent |
205 | { |
206 | public: |
207 | explicit QGraphicsSceneHelpEvent(Type type = None); |
208 | ~QGraphicsSceneHelpEvent(); |
209 | |
210 | QPointF scenePos() const; |
211 | void setScenePos(const QPointF &pos); |
212 | |
213 | QPoint screenPos() const; |
214 | void setScreenPos(const QPoint &pos); |
215 | |
216 | private: |
217 | Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent) |
218 | Q_DISABLE_COPY(QGraphicsSceneHelpEvent) |
219 | }; |
220 | |
221 | class QGraphicsSceneDragDropEventPrivate; |
222 | class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent |
223 | { |
224 | public: |
225 | explicit QGraphicsSceneDragDropEvent(Type type = None); |
226 | ~QGraphicsSceneDragDropEvent(); |
227 | |
228 | QPointF pos() const; |
229 | void setPos(const QPointF &pos); |
230 | |
231 | QPointF scenePos() const; |
232 | void setScenePos(const QPointF &pos); |
233 | |
234 | QPoint screenPos() const; |
235 | void setScreenPos(const QPoint &pos); |
236 | |
237 | Qt::MouseButtons buttons() const; |
238 | void setButtons(Qt::MouseButtons buttons); |
239 | |
240 | Qt::KeyboardModifiers modifiers() const; |
241 | void setModifiers(Qt::KeyboardModifiers modifiers); |
242 | |
243 | Qt::DropActions possibleActions() const; |
244 | void setPossibleActions(Qt::DropActions actions); |
245 | |
246 | Qt::DropAction proposedAction() const; |
247 | void setProposedAction(Qt::DropAction action); |
248 | void acceptProposedAction(); |
249 | |
250 | Qt::DropAction dropAction() const; |
251 | void setDropAction(Qt::DropAction action); |
252 | |
253 | QWidget *source() const; |
254 | void setSource(QWidget *source); |
255 | |
256 | const QMimeData *mimeData() const; |
257 | void setMimeData(const QMimeData *data); |
258 | |
259 | private: |
260 | Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent) |
261 | Q_DISABLE_COPY(QGraphicsSceneDragDropEvent) |
262 | }; |
263 | |
264 | class QGraphicsSceneResizeEventPrivate; |
265 | class Q_WIDGETS_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent |
266 | { |
267 | Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) |
268 | Q_DISABLE_COPY(QGraphicsSceneResizeEvent) |
269 | public: |
270 | QGraphicsSceneResizeEvent(); |
271 | ~QGraphicsSceneResizeEvent(); |
272 | |
273 | QSizeF oldSize() const; |
274 | void setOldSize(const QSizeF &size); |
275 | |
276 | QSizeF newSize() const; |
277 | void setNewSize(const QSizeF &size); |
278 | }; |
279 | |
280 | class QGraphicsSceneMoveEventPrivate; |
281 | class Q_WIDGETS_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent |
282 | { |
283 | Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) |
284 | Q_DISABLE_COPY(QGraphicsSceneMoveEvent) |
285 | public: |
286 | QGraphicsSceneMoveEvent(); |
287 | ~QGraphicsSceneMoveEvent(); |
288 | |
289 | QPointF oldPos() const; |
290 | void setOldPos(const QPointF &pos); |
291 | |
292 | QPointF newPos() const; |
293 | void setNewPos(const QPointF &pos); |
294 | }; |
295 | |
296 | #ifndef QT_NO_DEBUG_STREAM |
297 | Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGraphicsSceneEvent *); |
298 | #endif |
299 | |
300 | QT_END_NAMESPACE |
301 | |
302 | #endif |
303 |