Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgraphicssceneevent.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QGRAPHICSSCENEEVENT_H
6#define QGRAPHICSSCENEEVENT_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtCore/qcoreevent.h>
10#include <QtCore/qpoint.h>
11#include <QtCore/qscopedpointer.h>
12#include <QtCore/qrect.h>
13#include <QtGui/qpolygon.h>
14#include <QtCore/qset.h>
15
16QT_REQUIRE_CONFIG(graphicsview);
17
18QT_BEGIN_NAMESPACE
19
20class QMimeData;
21class QPointF;
22class QSizeF;
23class QWidget;
24
25class QGraphicsSceneEventPrivate;
26class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent
27{
28public:
29 explicit QGraphicsSceneEvent(Type type);
30 ~QGraphicsSceneEvent();
31
32 QWidget *widget() const;
33 void setWidget(QWidget *widget);
34
35 quint64 timestamp() const;
36 void setTimestamp(quint64 ts);
37
38protected:
39 QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None);
40 QScopedPointer<QGraphicsSceneEventPrivate> d_ptr;
41 Q_DECLARE_PRIVATE(QGraphicsSceneEvent)
42private:
43 Q_DISABLE_COPY(QGraphicsSceneEvent)
44};
45
47class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent
48{
49public:
50 explicit QGraphicsSceneMouseEvent(Type type = None);
51 ~QGraphicsSceneMouseEvent();
52
53 QPointF pos() const;
54 void setPos(const QPointF &pos);
55
56 QPointF scenePos() const;
57 void setScenePos(const QPointF &pos);
58
59 QPoint screenPos() const;
60 void setScreenPos(const QPoint &pos);
61
62 QPointF buttonDownPos(Qt::MouseButton button) const;
63 void setButtonDownPos(Qt::MouseButton button, const QPointF &pos);
64
65 QPointF buttonDownScenePos(Qt::MouseButton button) const;
66 void setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos);
67
68 QPoint buttonDownScreenPos(Qt::MouseButton button) const;
69 void setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos);
70
71 QPointF lastPos() const;
72 void setLastPos(const QPointF &pos);
73
74 QPointF lastScenePos() const;
75 void setLastScenePos(const QPointF &pos);
76
77 QPoint lastScreenPos() const;
78 void setLastScreenPos(const QPoint &pos);
79
80 Qt::MouseButtons buttons() const;
81 void setButtons(Qt::MouseButtons buttons);
82
83 Qt::MouseButton button() const;
84 void setButton(Qt::MouseButton button);
85
86 Qt::KeyboardModifiers modifiers() const;
87 void setModifiers(Qt::KeyboardModifiers modifiers);
88
89 Qt::MouseEventSource source() const;
90 void setSource(Qt::MouseEventSource source);
91
92 Qt::MouseEventFlags flags() const;
93 void setFlags(Qt::MouseEventFlags);
94
95private:
96 Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent)
97 Q_DISABLE_COPY(QGraphicsSceneMouseEvent)
98};
99
101class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent
102{
103public:
104 explicit QGraphicsSceneWheelEvent(Type type = None);
105 ~QGraphicsSceneWheelEvent();
106
107 QPointF pos() const;
108 void setPos(const QPointF &pos);
109
110 QPointF scenePos() const;
111 void setScenePos(const QPointF &pos);
112
113 QPoint screenPos() const;
114 void setScreenPos(const QPoint &pos);
115
116 Qt::MouseButtons buttons() const;
117 void setButtons(Qt::MouseButtons buttons);
118
119 Qt::KeyboardModifiers modifiers() const;
120 void setModifiers(Qt::KeyboardModifiers modifiers);
121
122 int delta() const;
123 void setDelta(int delta);
124
125 Qt::Orientation orientation() const;
126 void setOrientation(Qt::Orientation orientation);
127
128 Qt::ScrollPhase phase() const;
129 void setPhase(Qt::ScrollPhase scrollPhase);
130
131 QPoint pixelDelta() const;
132 void setPixelDelta(QPoint delta);
133
134 bool isInverted() const;
135 void setInverted(bool inverted);
136
137private:
138 Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent)
139 Q_DISABLE_COPY(QGraphicsSceneWheelEvent)
140};
141
143class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent
144{
145public:
146 enum Reason { Mouse, Keyboard, Other };
147
148 explicit QGraphicsSceneContextMenuEvent(Type type = None);
149 ~QGraphicsSceneContextMenuEvent();
150
151 QPointF pos() const;
152 void setPos(const QPointF &pos);
153
154 QPointF scenePos() const;
155 void setScenePos(const QPointF &pos);
156
157 QPoint screenPos() const;
158 void setScreenPos(const QPoint &pos);
159
160 Qt::KeyboardModifiers modifiers() const;
161 void setModifiers(Qt::KeyboardModifiers modifiers);
162
163 Reason reason() const;
164 void setReason(Reason reason);
165
166private:
167 Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent)
168 Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent)
169};
170
172class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent
173{
174public:
175 explicit QGraphicsSceneHoverEvent(Type type = None);
176 ~QGraphicsSceneHoverEvent();
177
178 QPointF pos() const;
179 void setPos(const QPointF &pos);
180
181 QPointF scenePos() const;
182 void setScenePos(const QPointF &pos);
183
184 QPoint screenPos() const;
185 void setScreenPos(const QPoint &pos);
186
187 QPointF lastPos() const;
188 void setLastPos(const QPointF &pos);
189
190 QPointF lastScenePos() const;
191 void setLastScenePos(const QPointF &pos);
192
193 QPoint lastScreenPos() const;
194 void setLastScreenPos(const QPoint &pos);
195
196 Qt::KeyboardModifiers modifiers() const;
197 void setModifiers(Qt::KeyboardModifiers modifiers);
198
199private:
200 Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent)
201 Q_DISABLE_COPY(QGraphicsSceneHoverEvent)
202};
203
205class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent
206{
207public:
208 explicit QGraphicsSceneHelpEvent(Type type = None);
209 ~QGraphicsSceneHelpEvent();
210
211 QPointF scenePos() const;
212 void setScenePos(const QPointF &pos);
213
214 QPoint screenPos() const;
215 void setScreenPos(const QPoint &pos);
216
217private:
218 Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent)
219 Q_DISABLE_COPY(QGraphicsSceneHelpEvent)
220};
221
223class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent
224{
225public:
226 explicit QGraphicsSceneDragDropEvent(Type type = None);
227 ~QGraphicsSceneDragDropEvent();
228
229 QPointF pos() const;
230 void setPos(const QPointF &pos);
231
232 QPointF scenePos() const;
233 void setScenePos(const QPointF &pos);
234
235 QPoint screenPos() const;
236 void setScreenPos(const QPoint &pos);
237
238 Qt::MouseButtons buttons() const;
239 void setButtons(Qt::MouseButtons buttons);
240
241 Qt::KeyboardModifiers modifiers() const;
242 void setModifiers(Qt::KeyboardModifiers modifiers);
243
244 Qt::DropActions possibleActions() const;
245 void setPossibleActions(Qt::DropActions actions);
246
247 Qt::DropAction proposedAction() const;
248 void setProposedAction(Qt::DropAction action);
249 void acceptProposedAction();
250
251 Qt::DropAction dropAction() const;
252 void setDropAction(Qt::DropAction action);
253
254 QWidget *source() const;
255 void setSource(QWidget *source);
256
257 const QMimeData *mimeData() const;
258 void setMimeData(const QMimeData *data);
259
260private:
261 Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent)
262 Q_DISABLE_COPY(QGraphicsSceneDragDropEvent)
263};
264
266class Q_WIDGETS_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent
267{
268 Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent)
269 Q_DISABLE_COPY(QGraphicsSceneResizeEvent)
270public:
271 QGraphicsSceneResizeEvent();
272 ~QGraphicsSceneResizeEvent();
273
274 QSizeF oldSize() const;
275 void setOldSize(const QSizeF &size);
276
277 QSizeF newSize() const;
278 void setNewSize(const QSizeF &size);
279};
280
282class Q_WIDGETS_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent
283{
284 Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent)
285 Q_DISABLE_COPY(QGraphicsSceneMoveEvent)
286public:
287 QGraphicsSceneMoveEvent();
288 ~QGraphicsSceneMoveEvent();
289
290 QPointF oldPos() const;
291 void setOldPos(const QPointF &pos);
292
293 QPointF newPos() const;
294 void setNewPos(const QPointF &pos);
295};
296
297#ifndef QT_NO_DEBUG_STREAM
298Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QGraphicsSceneEvent *);
299#endif
300
301QT_END_NAMESPACE
302
303#endif
The QAbstractGraphicsShapeItem class provides a common base for all path items.
The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene.
QHash< const QGraphicsItem *, QMap< int, QVariant > > data
The QGraphicsItemGroup class provides a container that treats a group of items as a single item.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
The QGraphicsObject class provides a base class for all graphics items that require signals,...
QGraphicsPixmapItem::ShapeMode shapeMode
Qt::TransformationMode transformationMode
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene.
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework.
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
The QGraphicsSceneEvent class provides a base class for all graphics view related events.
The QGraphicsSceneHelpEvent class provides events when a tooltip is requested.
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
The QGraphicsSceneMoveEvent class provides events for widget moving in the graphics view framework.
The QGraphicsSceneResizeEvent class provides events for widget resizing in the graphics view framewor...
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
The QGraphicsSimpleTextItem class provides a simple text item that you can add to a QGraphicsScene.
void _q_updateBoundingRect(const QSizeF &)
bool _q_mouseOnEdge(QGraphicsSceneMouseEvent *)
QWidgetTextControl * control
QWidgetTextControl * textControl() const
void sendControlEvent(QEvent *e)
The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display form...
friend class QPainter
\inmodule QtGui
friend class QWidget
Definition qpainter.h:431
\inmodule QtCore\reentrant
Definition qpoint.h:231
The QPolygonF class provides a list of points using floating point precision.
Definition qpolygon.h:96
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item)
bool _qt_movableAncestorIsSelected(const QGraphicsItem *item)
static QRectF setupTextLayout(QTextLayout *layout)
QDebug operator<<(QDebug debug, const QGraphicsObject *item)
static QPainterPath qt_graphicsItem_shapeFromPath(const QPainterPath &path, const QPen &pen)
QDebug operator<<(QDebug debug, const QGraphicsItem *item)
static bool qt_QGraphicsItem_isObscured(const QGraphicsItem *item, const QGraphicsItem *other, const QRectF &rect)
QT_REQUIRE_CONFIG(graphicsview)
static QRectF adjustedItemBoundingRect(const QGraphicsItem *item)
static QRectF adjustedItemEffectiveBoundingRect(const QGraphicsItem *item)
static void _q_adjustRect(QRectF *rect)
QDebug operator<<(QDebug debug, QIODevice::OpenMode modes)