OpenCoverage

qgraphicssceneevent.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicssceneevent.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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/*!-
41 \class QGraphicsSceneEvent-
42 \brief The QGraphicsSceneEvent class provides a base class for all-
43 graphics view related events.-
44 \since 4.2-
45 \ingroup graphicsview-api-
46 \inmodule QtWidgets-
47-
48 When a QGraphicsView receives Qt mouse, keyboard, and drag and-
49 drop events (QMouseEvent, QKeyEvent, QDragEvent, etc.), it-
50 translates them into instances of QGraphicsSceneEvent subclasses-
51 and forwards them to the QGraphicsScene it displays. The scene-
52 then forwards the events to the relevant items.-
53-
54 For example, when a QGraphicsView receives a QMouseEvent of type-
55 MousePress as a response to a user click, the view sends a-
56 QGraphicsSceneMouseEvent of type GraphicsSceneMousePress to the-
57 underlying QGraphicsScene through its-
58 \l{QGraphicsScene::}{mousePressEvent()} function. The default-
59 QGraphicsScene::mousePressEvent() implementation determines which-
60 item was clicked and forwards the event to-
61 QGraphicsItem::mousePressEvent().-
62-
63 \omit ### Beskrive widget() \endomit-
64-
65 Subclasses such as QGraphicsSceneMouseEvent and-
66 QGraphicsSceneContextMenuEvent provide the coordinates from the-
67 original QEvent in screen, scene, and item coordinates (see-
68 \l{QGraphicsSceneMouseEvent::}{screenPos()},-
69 \l{QGraphicsSceneMouseEvent::}{scenePos()}, and-
70 \l{QGraphicsSceneMouseEvent::}{pos()}). The item coordinates are-
71 set by the QGraphicsScene before it forwards the event to the-
72 event to a QGraphicsItem. The mouse events also add the-
73 possibility to retrieve the coordinates from the last event-
74 received by the view (see-
75 \l{QGraphicsSceneMouseEvent::}{lastScreenPos()},-
76 \l{QGraphicsSceneMouseEvent::}{lastScenePos()}, and-
77 \l{QGraphicsSceneMouseEvent::}{lastPos()}).-
78-
79 \sa QEvent-
80*/-
81-
82/*!-
83 \class QGraphicsSceneMouseEvent-
84 \brief The QGraphicsSceneMouseEvent class provides mouse events-
85 in the graphics view framework.-
86 \since 4.2-
87 \ingroup graphicsview-api-
88 \inmodule QtWidgets-
89-
90 When a QGraphicsView receives a QMouseEvent, it translates it to a-
91 QGraphicsSceneMouseEvent. The event is then forwarded to the-
92 QGraphicsScene associated with the view. If the event is not-
93 handled by the scene, the view may use it, e.g., for the-
94 \l{QGraphicsView::}{DragMode}.-
95-
96 In addition to containing the item, scene, and screen coordinates-
97 of the event (as pos(), scenePos(), and screenPos()), mouse-
98 events also contain the coordinates of the previous mouse-
99 event received by the view. These can be retrieved with-
100 lastPos(), lastScreenPos(), and lastScenePos().-
101-
102 \sa QGraphicsSceneContextMenuEvent,-
103 QGraphicsSceneHoverEvent, QGraphicsSceneWheelEvent,-
104 QMouseEvent-
105*/-
106-
107/*!-
108 \class QGraphicsSceneWheelEvent-
109 \brief The QGraphicsSceneWheelEvent class provides wheel events-
110 in the graphics view framework.-
111 \brief The QGraphicsSceneWheelEvent class provides wheel events in the-
112 graphics view framework.-
113 \since 4.2-
114 \ingroup graphicsview-api-
115 \inmodule QtWidgets-
116-
117 \l{QWheelEvent}{QWheelEvent}s received by a QGraphicsView are translated-
118 into QGraphicsSceneWheelEvents; it translates the QWheelEvent::globalPos()-
119 into item, scene, and screen coordinates (pos(), scenePos(), and-
120 screenPos()).-
121-
122 \sa QGraphicsSceneMouseEvent, QGraphicsSceneContextMenuEvent,-
123 QGraphicsSceneHoverEvent, QWheelEvent-
124*/-
125-
126/*!-
127 \class QGraphicsSceneContextMenuEvent-
128 \brief The QGraphicsSceneContextMenuEvent class provides context-
129 menu events in the graphics view framework.-
130 \since 4.2-
131 \ingroup graphicsview-api-
132 \inmodule QtWidgets-
133-
134 A QContextMenuEvent received by a QGraphicsView is translated-
135 into a QGraphicsSceneContextMenuEvent. The-
136 QContextMenuEvent::globalPos() is translated into item, scene, and-
137 screen coordinates (pos(), scenePos(), and screenPos()).-
138-
139 \sa QGraphicsSceneMouseEvent, QGraphicsSceneWheelEvent,-
140 QContextMenuEvent-
141*/-
142-
143/*!-
144 \enum QGraphicsSceneContextMenuEvent::Reason-
145-
146 This enum describes the reason why the context event was sent.-
147-
148 \value Mouse The mouse caused the event to be sent. On most-
149 platforms, this means the right mouse button was clicked.-
150-
151 \value Keyboard The keyboard caused this event to be sent. On-
152 Windows and \macos, this means the menu button was pressed.-
153-
154 \value Other The event was sent by some other means (i.e. not-
155 by the mouse or keyboard).-
156*/-
157-
158/*!-
159 \class QGraphicsSceneHoverEvent-
160 \brief The QGraphicsSceneHoverEvent class provides hover events-
161 in the graphics view framework.-
162 \since 4.2-
163 \ingroup graphicsview-api-
164 \inmodule QtWidgets-
165-
166 When a QGraphicsView receives a QHoverEvent event, it translates-
167 it into QGraphicsSceneHoverEvent. The event is then forwarded to-
168 the QGraphicsScene associated with the view.-
169-
170 \sa QGraphicsSceneMouseEvent, QGraphicsSceneContextMenuEvent,-
171 QGraphicsSceneWheelEvent, QHoverEvent-
172*/-
173-
174/*!-
175 \class QGraphicsSceneHelpEvent-
176 \brief The QGraphicsSceneHelpEvent class provides events when a-
177 tooltip is requested.-
178 \since 4.2-
179 \ingroup graphicsview-api-
180 \inmodule QtWidgets-
181-
182 When a QGraphicsView receives a QEvent of type-
183 QEvent::ToolTip, it creates a QGraphicsSceneHelpEvent, which is-
184 forwarded to the scene. You can set a tooltip on a QGraphicsItem-
185 with \l{QGraphicsItem::}{setToolTip()}; by default QGraphicsScene-
186 displays the tooltip of the QGraphicsItem with the highest-
187 z-value (i.e, the top-most item) under the mouse position.-
188-
189 QGraphicsView does not forward events when-
190 \l{QWhatsThis}{"What's This"} and \l{QStatusTipEvent}{status tip}-
191 help is requested. If you need this, you can reimplement-
192 QGraphicsView::viewportEvent() and forward QStatusTipEvent-
193 events and \l{QEvent}{QEvents} of type QEvent::WhatsThis to the-
194 scene.-
195-
196 \sa QEvent-
197*/-
198-
199/*!-
200 \class QGraphicsSceneDragDropEvent-
201 \brief The QGraphicsSceneDragDropEvent class provides events for-
202 drag and drop in the graphics view framework.-
203 \since 4.2-
204 \ingroup graphicsview-api-
205 \inmodule QtWidgets-
206-
207 QGraphicsView inherits the drag and drop functionality provided-
208 by QWidget. When it receives a drag and drop event, it translates-
209 it to a QGraphicsSceneDragDropEvent.-
210-
211 QGraphicsSceneDragDropEvent stores events of type-
212 GraphicsSceneDragEnter, GraphicsSceneDragLeave,-
213 GraphicsSceneDragMove, or GraphicsSceneDrop.-
214-
215 QGraphicsSceneDragDropEvent contains the position of the mouse-
216 cursor in both item, scene, and screen coordinates; this can be-
217 retrieved with pos(), scenePos(), and screenPos().-
218-
219 The scene sends the event to the first QGraphicsItem under the-
220 mouse cursor that accepts drops; a graphics item is set to accept-
221 drops with \l{QGraphicsItem::}{setAcceptDrops()}.-
222*/-
223-
224/*!-
225 \class QGraphicsSceneResizeEvent-
226 \brief The QGraphicsSceneResizeEvent class provides events for widget-
227 resizing in the graphics view framework.-
228 \since 4.4-
229 \ingroup graphicsview-api-
230 \inmodule QtWidgets-
231-
232 A QGraphicsWidget sends itself a QGraphicsSceneResizeEvent immediately-
233 when its geometry changes.-
234-
235 It's similar to QResizeEvent, but its sizes, oldSize() and newSize(), use-
236 QSizeF instead of QSize.-
237-
238 \sa QGraphicsWidget::setGeometry(), QGraphicsWidget::resize()-
239*/-
240-
241/*!-
242 \class QGraphicsSceneMoveEvent-
243 \brief The QGraphicsSceneMoveEvent class provides events for widget-
244 moving in the graphics view framework.-
245 \since 4.4-
246 \ingroup graphicsview-api-
247 \inmodule QtWidgets-
248-
249 A QGraphicsWidget sends itself a QGraphicsSceneMoveEvent immediately when-
250 its local position changes. The delivery is implemented as part of-
251 QGraphicsItem::itemChange().-
252-
253 It's similar to QMoveEvent, but its positions, oldPos() and newPos(), use-
254 QPointF instead of QPoint.-
255-
256 \sa QGraphicsItem::setPos(), QGraphicsItem::ItemPositionChange,-
257 QGraphicsItem::ItemPositionHasChanged-
258*/-
259-
260#include "qgraphicssceneevent.h"-
261-
262#ifndef QT_NO_GRAPHICSVIEW-
263-
264#ifndef QT_NO_DEBUG-
265#include <QtCore/qdebug.h>-
266#endif-
267#include <QtCore/qmap.h>-
268#include <QtCore/qpoint.h>-
269#include <QtCore/qsize.h>-
270#include <QtCore/qstring.h>-
271#include "qgraphicsview.h"-
272#include "qgraphicsitem.h"-
273#include <QtWidgets/qgesture.h>-
274#include <private/qevent_p.h>-
275-
276QT_BEGIN_NAMESPACE-
277-
278class QGraphicsSceneEventPrivate-
279{-
280public:-
281 inline QGraphicsSceneEventPrivate()-
282 : widget(0),-
283 q_ptr(0)-
284 { }
never executed: end of block
0
285-
286 inline virtual ~QGraphicsSceneEventPrivate()-
287 { }-
288-
289 QWidget *widget;-
290 QGraphicsSceneEvent *q_ptr;-
291};-
292-
293/*!-
294 \internal-
295-
296 Constructs a generic graphics scene event of the specified \a type.-
297*/-
298QGraphicsSceneEvent::QGraphicsSceneEvent(Type type)-
299 : QEvent(type), d_ptr(new QGraphicsSceneEventPrivate)-
300{-
301 d_ptr->q_ptr = this;-
302}
never executed: end of block
0
303-
304/*!-
305 \internal-
306-
307 Constructs a generic graphics scene event.-
308*/-
309QGraphicsSceneEvent::QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type)-
310 : QEvent(type), d_ptr(&dd)-
311{-
312 d_ptr->q_ptr = this;-
313}
never executed: end of block
0
314-
315/*!-
316 Destroys the event.-
317*/-
318QGraphicsSceneEvent::~QGraphicsSceneEvent()-
319{-
320}-
321-
322/*!-
323 Returns the widget where the event originated, or 0 if the event-
324 originates from another application.-
325*/-
326QWidget *QGraphicsSceneEvent::widget() const-
327{-
328 return d_ptr->widget;
never executed: return d_ptr->widget;
0
329}-
330-
331/*!-
332 \internal-
333-
334 Sets the \a widget related to this event.-
335-
336 \sa widget()-
337*/-
338void QGraphicsSceneEvent::setWidget(QWidget *widget)-
339{-
340 d_ptr->widget = widget;-
341}
never executed: end of block
0
342-
343class QGraphicsSceneMouseEventPrivate : public QGraphicsSceneEventPrivate-
344{-
345 Q_DECLARE_PUBLIC(QGraphicsSceneMouseEvent)-
346public:-
347 inline QGraphicsSceneMouseEventPrivate()-
348 : button(Qt::NoButton),-
349 buttons(0), modifiers(0), source(Qt::MouseEventNotSynthesized), flags(0)-
350 { }
never executed: end of block
0
351-
352 QPointF pos;-
353 QPointF scenePos;-
354 QPoint screenPos;-
355 QPointF lastPos;-
356 QPointF lastScenePos;-
357 QPoint lastScreenPos;-
358 QMap<Qt::MouseButton, QPointF> buttonDownPos;-
359 QMap<Qt::MouseButton, QPointF> buttonDownScenePos;-
360 QMap<Qt::MouseButton, QPoint> buttonDownScreenPos;-
361 Qt::MouseButton button;-
362 Qt::MouseButtons buttons;-
363 Qt::KeyboardModifiers modifiers;-
364 Qt::MouseEventSource source;-
365 Qt::MouseEventFlags flags;-
366};-
367-
368/*!-
369 \internal-
370-
371 Constructs a generic graphics scene mouse event of the specified \a type.-
372*/-
373QGraphicsSceneMouseEvent::QGraphicsSceneMouseEvent(Type type)-
374 : QGraphicsSceneEvent(*new QGraphicsSceneMouseEventPrivate, type)-
375{-
376}
never executed: end of block
0
377-
378/*!-
379 Destroys the event.-
380*/-
381QGraphicsSceneMouseEvent::~QGraphicsSceneMouseEvent()-
382{-
383}-
384-
385/*!-
386 Returns the mouse cursor position in item coordinates.-
387-
388 \sa scenePos(), screenPos(), lastPos()-
389*/-
390QPointF QGraphicsSceneMouseEvent::pos() const-
391{-
392 Q_D(const QGraphicsSceneMouseEvent);-
393 return d->pos;
never executed: return d->pos;
0
394}-
395-
396/*!-
397 \internal-
398*/-
399void QGraphicsSceneMouseEvent::setPos(const QPointF &pos)-
400{-
401 Q_D(QGraphicsSceneMouseEvent);-
402 d->pos = pos;-
403}
never executed: end of block
0
404-
405/*!-
406 Returns the mouse cursor position in scene coordinates.-
407-
408 \sa pos(), screenPos(), lastScenePos()-
409*/-
410QPointF QGraphicsSceneMouseEvent::scenePos() const-
411{-
412 Q_D(const QGraphicsSceneMouseEvent);-
413 return d->scenePos;
never executed: return d->scenePos;
0
414}-
415-
416/*!-
417 \internal-
418*/-
419void QGraphicsSceneMouseEvent::setScenePos(const QPointF &pos)-
420{-
421 Q_D(QGraphicsSceneMouseEvent);-
422 d->scenePos = pos;-
423}
never executed: end of block
0
424-
425/*!-
426 Returns the mouse cursor position in screen coordinates.-
427-
428 \sa pos(), scenePos(), lastScreenPos()-
429*/-
430QPoint QGraphicsSceneMouseEvent::screenPos() const-
431{-
432 Q_D(const QGraphicsSceneMouseEvent);-
433 return d->screenPos;
never executed: return d->screenPos;
0
434}-
435-
436/*!-
437 \internal-
438*/-
439void QGraphicsSceneMouseEvent::setScreenPos(const QPoint &pos)-
440{-
441 Q_D(QGraphicsSceneMouseEvent);-
442 d->screenPos = pos;-
443}
never executed: end of block
0
444-
445/*!-
446 Returns the mouse cursor position in item coordinates where the specified-
447 \a button was clicked.-
448-
449 \sa buttonDownScenePos(), buttonDownScreenPos(), pos()-
450*/-
451QPointF QGraphicsSceneMouseEvent::buttonDownPos(Qt::MouseButton button) const-
452{-
453 Q_D(const QGraphicsSceneMouseEvent);-
454 return d->buttonDownPos.value(button);
never executed: return d->buttonDownPos.value(button);
0
455}-
456-
457/*!-
458 \internal-
459*/-
460void QGraphicsSceneMouseEvent::setButtonDownPos(Qt::MouseButton button, const QPointF &pos)-
461{-
462 Q_D(QGraphicsSceneMouseEvent);-
463 d->buttonDownPos.insert(button, pos);-
464}
never executed: end of block
0
465-
466/*!-
467 Returns the mouse cursor position in scene coordinates where the-
468 specified \a button was clicked.-
469-
470 \sa buttonDownPos(), buttonDownScreenPos(), scenePos()-
471*/-
472QPointF QGraphicsSceneMouseEvent::buttonDownScenePos(Qt::MouseButton button) const-
473{-
474 Q_D(const QGraphicsSceneMouseEvent);-
475 return d->buttonDownScenePos.value(button);
never executed: return d->buttonDownScenePos.value(button);
0
476}-
477-
478/*!-
479 \internal-
480*/-
481void QGraphicsSceneMouseEvent::setButtonDownScenePos(Qt::MouseButton button, const QPointF &pos)-
482{-
483 Q_D(QGraphicsSceneMouseEvent);-
484 d->buttonDownScenePos.insert(button, pos);-
485}
never executed: end of block
0
486-
487/*!-
488 Returns the mouse cursor position in screen coordinates where the-
489 specified \a button was clicked.-
490-
491 \sa screenPos(), buttonDownPos(), buttonDownScenePos()-
492*/-
493QPoint QGraphicsSceneMouseEvent::buttonDownScreenPos(Qt::MouseButton button) const-
494{-
495 Q_D(const QGraphicsSceneMouseEvent);-
496 return d->buttonDownScreenPos.value(button);
never executed: return d->buttonDownScreenPos.value(button);
0
497}-
498-
499/*!-
500 \internal-
501*/-
502void QGraphicsSceneMouseEvent::setButtonDownScreenPos(Qt::MouseButton button, const QPoint &pos)-
503{-
504 Q_D(QGraphicsSceneMouseEvent);-
505 d->buttonDownScreenPos.insert(button, pos);-
506}
never executed: end of block
0
507-
508/*!-
509 Returns the last recorded mouse cursor position in item-
510 coordinates.-
511-
512 \sa lastScenePos(), lastScreenPos(), pos()-
513*/-
514QPointF QGraphicsSceneMouseEvent::lastPos() const-
515{-
516 Q_D(const QGraphicsSceneMouseEvent);-
517 return d->lastPos;
never executed: return d->lastPos;
0
518}-
519-
520/*!-
521 \internal-
522*/-
523void QGraphicsSceneMouseEvent::setLastPos(const QPointF &pos)-
524{-
525 Q_D(QGraphicsSceneMouseEvent);-
526 d->lastPos = pos;-
527}
never executed: end of block
0
528-
529/*!-
530 Returns the last recorded mouse cursor position in scene-
531 coordinates. The last recorded position is the position of-
532 the previous mouse event received by the view that created-
533 the event.-
534-
535 \sa lastPos(), lastScreenPos(), scenePos()-
536*/-
537QPointF QGraphicsSceneMouseEvent::lastScenePos() const-
538{-
539 Q_D(const QGraphicsSceneMouseEvent);-
540 return d->lastScenePos;
never executed: return d->lastScenePos;
0
541}-
542-
543/*!-
544 \internal-
545*/-
546void QGraphicsSceneMouseEvent::setLastScenePos(const QPointF &pos)-
547{-
548 Q_D(QGraphicsSceneMouseEvent);-
549 d->lastScenePos = pos;-
550}
never executed: end of block
0
551-
552/*!-
553 Returns the last recorded mouse cursor position in screen-
554 coordinates. The last recorded position is the position of-
555 the previous mouse event received by the view that created-
556 the event.-
557-
558 \sa lastPos(), lastScenePos(), screenPos()-
559*/-
560QPoint QGraphicsSceneMouseEvent::lastScreenPos() const-
561{-
562 Q_D(const QGraphicsSceneMouseEvent);-
563 return d->lastScreenPos;
never executed: return d->lastScreenPos;
0
564}-
565-
566/*!-
567 \internal-
568*/-
569void QGraphicsSceneMouseEvent::setLastScreenPos(const QPoint &pos)-
570{-
571 Q_D(QGraphicsSceneMouseEvent);-
572 d->lastScreenPos = pos;-
573}
never executed: end of block
0
574-
575/*!-
576 Returns the combination of mouse buttons that were pressed at the-
577 time the event was sent.-
578-
579 \sa button(), modifiers()-
580*/-
581Qt::MouseButtons QGraphicsSceneMouseEvent::buttons() const-
582{-
583 Q_D(const QGraphicsSceneMouseEvent);-
584 return d->buttons;
never executed: return d->buttons;
0
585}-
586-
587/*!-
588 \internal-
589*/-
590void QGraphicsSceneMouseEvent::setButtons(Qt::MouseButtons buttons)-
591{-
592 Q_D(QGraphicsSceneMouseEvent);-
593 d->buttons = buttons;-
594}
never executed: end of block
0
595-
596/*!-
597 Returns the mouse button (if any) that caused the event.-
598-
599 \sa buttons(), modifiers()-
600*/-
601Qt::MouseButton QGraphicsSceneMouseEvent::button() const-
602{-
603 Q_D(const QGraphicsSceneMouseEvent);-
604 return d->button;
never executed: return d->button;
0
605}-
606-
607/*!-
608 \internal-
609*/-
610void QGraphicsSceneMouseEvent::setButton(Qt::MouseButton button)-
611{-
612 Q_D(QGraphicsSceneMouseEvent);-
613 d->button = button;-
614}
never executed: end of block
0
615-
616/*!-
617 Returns the keyboard modifiers in use at the time the event was-
618 sent.-
619-
620 \sa buttons(), button()-
621*/-
622Qt::KeyboardModifiers QGraphicsSceneMouseEvent::modifiers() const-
623{-
624 Q_D(const QGraphicsSceneMouseEvent);-
625 return d->modifiers;
never executed: return d->modifiers;
0
626}-
627-
628/*!-
629 \since 5.4-
630-
631 Returns information about the mouse event source.-
632-
633 The mouse event source can be used to distinguish between genuine-
634 and artificial mouse events. The latter are events that are-
635 synthesized from touch events by the operating system or Qt itself.-
636-
637 \sa Qt::MouseEventSource-
638 \sa QMouseEvent::source()-
639 */-
640Qt::MouseEventSource QGraphicsSceneMouseEvent::source() const-
641{-
642 Q_D(const QGraphicsSceneMouseEvent);-
643 return d->source;
never executed: return d->source;
0
644}-
645-
646/*!-
647 \since 5.4-
648 \internal-
649 */-
650void QGraphicsSceneMouseEvent::setSource(Qt::MouseEventSource source)-
651{-
652 Q_D(QGraphicsSceneMouseEvent);-
653 d->source = source;-
654}
never executed: end of block
0
655-
656/*!-
657 \since 5.4-
658-
659 Returns the mouse event flags.-
660-
661 The mouse event flags provide additional information about a mouse event.-
662-
663 \sa Qt::MouseEventFlag-
664 \sa QMouseEvent::flags()-
665 */-
666Qt::MouseEventFlags QGraphicsSceneMouseEvent::flags() const-
667{-
668 Q_D(const QGraphicsSceneMouseEvent);-
669 return d->flags;
never executed: return d->flags;
0
670}-
671-
672/*!-
673 \since 5.4-
674 \internal-
675 */-
676void QGraphicsSceneMouseEvent::setFlags(Qt::MouseEventFlags flags)-
677{-
678 Q_D(QGraphicsSceneMouseEvent);-
679 d->flags = flags;-
680}
never executed: end of block
0
681-
682/*!-
683 \internal-
684*/-
685void QGraphicsSceneMouseEvent::setModifiers(Qt::KeyboardModifiers modifiers)-
686{-
687 Q_D(QGraphicsSceneMouseEvent);-
688 d->modifiers = modifiers;-
689}
never executed: end of block
0
690-
691class QGraphicsSceneWheelEventPrivate : public QGraphicsSceneEventPrivate-
692{-
693 Q_DECLARE_PUBLIC(QGraphicsSceneWheelEvent)-
694public:-
695 inline QGraphicsSceneWheelEventPrivate()-
696 : buttons(0), modifiers(0), delta(0), orientation(Qt::Horizontal)-
697 { }
never executed: end of block
0
698-
699 QPointF pos;-
700 QPointF scenePos;-
701 QPoint screenPos;-
702 Qt::MouseButtons buttons;-
703 Qt::KeyboardModifiers modifiers;-
704 int delta;-
705 Qt::Orientation orientation;-
706};-
707-
708/*!-
709 \internal-
710-
711 Constructs a QGraphicsSceneWheelEvent of type \a type, which-
712 is always QEvent::GraphicsSceneWheel.-
713*/-
714QGraphicsSceneWheelEvent::QGraphicsSceneWheelEvent(Type type)-
715 : QGraphicsSceneEvent(*new QGraphicsSceneWheelEventPrivate, type)-
716{-
717}
never executed: end of block
0
718-
719/*!-
720 Destroys the QGraphicsSceneWheelEvent.-
721*/-
722QGraphicsSceneWheelEvent::~QGraphicsSceneWheelEvent()-
723{-
724}-
725-
726/*!-
727 Returns the position of the cursor in item coordinates when the-
728 wheel event occurred.-
729-
730 \sa scenePos(), screenPos()-
731*/-
732QPointF QGraphicsSceneWheelEvent::pos() const-
733{-
734 Q_D(const QGraphicsSceneWheelEvent);-
735 return d->pos;
never executed: return d->pos;
0
736}-
737-
738/*!-
739 \internal-
740*/-
741void QGraphicsSceneWheelEvent::setPos(const QPointF &pos)-
742{-
743 Q_D(QGraphicsSceneWheelEvent);-
744 d->pos = pos;-
745}
never executed: end of block
0
746-
747/*!-
748 Returns the position of the cursor in scene coordinates when the wheel-
749 event occurred.-
750-
751 \sa pos(), screenPos()-
752*/-
753QPointF QGraphicsSceneWheelEvent::scenePos() const-
754{-
755 Q_D(const QGraphicsSceneWheelEvent);-
756 return d->scenePos;
never executed: return d->scenePos;
0
757}-
758-
759/*!-
760 \internal-
761*/-
762void QGraphicsSceneWheelEvent::setScenePos(const QPointF &pos)-
763{-
764 Q_D(QGraphicsSceneWheelEvent);-
765 d->scenePos = pos;-
766}
never executed: end of block
0
767-
768/*!-
769 Returns the position of the cursor in screen coordinates when the wheel-
770 event occurred.-
771-
772 \sa pos(), scenePos()-
773*/-
774QPoint QGraphicsSceneWheelEvent::screenPos() const-
775{-
776 Q_D(const QGraphicsSceneWheelEvent);-
777 return d->screenPos;
never executed: return d->screenPos;
0
778}-
779-
780/*!-
781 \internal-
782*/-
783void QGraphicsSceneWheelEvent::setScreenPos(const QPoint &pos)-
784{-
785 Q_D(QGraphicsSceneWheelEvent);-
786 d->screenPos = pos;-
787}
never executed: end of block
0
788-
789/*!-
790 Returns the mouse buttons that were pressed when the wheel event occurred.-
791-
792 \sa modifiers()-
793*/-
794Qt::MouseButtons QGraphicsSceneWheelEvent::buttons() const-
795{-
796 Q_D(const QGraphicsSceneWheelEvent);-
797 return d->buttons;
never executed: return d->buttons;
0
798}-
799-
800/*!-
801 \internal-
802*/-
803void QGraphicsSceneWheelEvent::setButtons(Qt::MouseButtons buttons)-
804{-
805 Q_D(QGraphicsSceneWheelEvent);-
806 d->buttons = buttons;-
807}
never executed: end of block
0
808-
809/*!-
810 Returns the keyboard modifiers that were active when the wheel event-
811 occurred.-
812-
813 \sa buttons()-
814*/-
815Qt::KeyboardModifiers QGraphicsSceneWheelEvent::modifiers() const-
816{-
817 Q_D(const QGraphicsSceneWheelEvent);-
818 return d->modifiers;
never executed: return d->modifiers;
0
819}-
820-
821/*!-
822 \internal-
823*/-
824void QGraphicsSceneWheelEvent::setModifiers(Qt::KeyboardModifiers modifiers)-
825{-
826 Q_D(QGraphicsSceneWheelEvent);-
827 d->modifiers = modifiers;-
828}
never executed: end of block
0
829-
830/*!-
831 Returns the distance that the wheel is rotated, in eighths (1/8s)-
832 of a degree. A positive value indicates that the wheel was-
833 rotated forwards away from the user; a negative value indicates-
834 that the wheel was rotated backwards toward the user.-
835-
836 Most mouse types work in steps of 15 degrees, in which case the delta-
837 value is a multiple of 120 (== 15 * 8).-
838*/-
839int QGraphicsSceneWheelEvent::delta() const-
840{-
841 Q_D(const QGraphicsSceneWheelEvent);-
842 return d->delta;
never executed: return d->delta;
0
843}-
844-
845/*!-
846 \internal-
847*/-
848void QGraphicsSceneWheelEvent::setDelta(int delta)-
849{-
850 Q_D(QGraphicsSceneWheelEvent);-
851 d->delta = delta;-
852}
never executed: end of block
0
853-
854/*!-
855 Returns the wheel orientation.-
856*/-
857Qt::Orientation QGraphicsSceneWheelEvent::orientation() const-
858{-
859 Q_D(const QGraphicsSceneWheelEvent);-
860 return d->orientation;
never executed: return d->orientation;
0
861}-
862-
863/*!-
864 \internal-
865*/-
866void QGraphicsSceneWheelEvent::setOrientation(Qt::Orientation orientation)-
867{-
868 Q_D(QGraphicsSceneWheelEvent);-
869 d->orientation = orientation;-
870}
never executed: end of block
0
871-
872class QGraphicsSceneContextMenuEventPrivate : public QGraphicsSceneEventPrivate-
873{-
874 Q_DECLARE_PUBLIC(QGraphicsSceneContextMenuEvent)-
875 public:-
876 inline QGraphicsSceneContextMenuEventPrivate()-
877 : modifiers(0), reason(QGraphicsSceneContextMenuEvent::Other)-
878 { }
never executed: end of block
0
879-
880 QPointF pos;-
881 QPointF scenePos;-
882 QPoint screenPos;-
883 Qt::KeyboardModifiers modifiers;-
884 QGraphicsSceneContextMenuEvent::Reason reason;-
885};-
886-
887/*!-
888 \internal-
889-
890 Constructs a graphics scene context menu event of the specified \a type.-
891*/-
892QGraphicsSceneContextMenuEvent::QGraphicsSceneContextMenuEvent(Type type)-
893 : QGraphicsSceneEvent(*new QGraphicsSceneContextMenuEventPrivate, type)-
894{-
895}
never executed: end of block
0
896-
897/*!-
898 Destroys the event.-
899*/-
900QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent()-
901{-
902}-
903-
904/*!-
905 Returns the position of the mouse cursor in item coordinates at the moment-
906 the context menu was requested.-
907-
908 \sa scenePos(), screenPos()-
909*/-
910QPointF QGraphicsSceneContextMenuEvent::pos() const-
911{-
912 Q_D(const QGraphicsSceneContextMenuEvent);-
913 return d->pos;
never executed: return d->pos;
0
914}-
915-
916/*!-
917 \fn void QGraphicsSceneContextMenuEvent::setPos(const QPointF &point)-
918 \internal-
919-
920 Sets the position associated with the context menu to the given \a point-
921 in item coordinates.-
922*/-
923void QGraphicsSceneContextMenuEvent::setPos(const QPointF &pos)-
924{-
925 Q_D(QGraphicsSceneContextMenuEvent);-
926 d->pos = pos;-
927}
never executed: end of block
0
928-
929/*!-
930 Returns the position of the mouse cursor in scene coordinates at the moment the-
931 context menu was requested.-
932-
933 \sa pos(), screenPos()-
934*/-
935QPointF QGraphicsSceneContextMenuEvent::scenePos() const-
936{-
937 Q_D(const QGraphicsSceneContextMenuEvent);-
938 return d->scenePos;
never executed: return d->scenePos;
0
939}-
940-
941/*!-
942 \fn void QGraphicsSceneContextMenuEvent::setScenePos(const QPointF &point)-
943 \internal-
944-
945 Sets the position associated with the context menu to the given \a point-
946 in scene coordinates.-
947*/-
948void QGraphicsSceneContextMenuEvent::setScenePos(const QPointF &pos)-
949{-
950 Q_D(QGraphicsSceneContextMenuEvent);-
951 d->scenePos = pos;-
952}
never executed: end of block
0
953-
954/*!-
955 Returns the position of the mouse cursor in screen coordinates at the moment the-
956 context menu was requested.-
957-
958 \sa pos(), scenePos()-
959*/-
960QPoint QGraphicsSceneContextMenuEvent::screenPos() const-
961{-
962 Q_D(const QGraphicsSceneContextMenuEvent);-
963 return d->screenPos;
never executed: return d->screenPos;
0
964}-
965-
966/*!-
967 \fn void QGraphicsSceneContextMenuEvent::setScreenPos(const QPoint &point)-
968 \internal-
969-
970 Sets the position associated with the context menu to the given \a point-
971 in screen coordinates.-
972*/-
973void QGraphicsSceneContextMenuEvent::setScreenPos(const QPoint &pos)-
974{-
975 Q_D(QGraphicsSceneContextMenuEvent);-
976 d->screenPos = pos;-
977}
never executed: end of block
0
978-
979/*!-
980 Returns the keyboard modifiers in use when the context menu was requested.-
981*/-
982Qt::KeyboardModifiers QGraphicsSceneContextMenuEvent::modifiers() const-
983{-
984 Q_D(const QGraphicsSceneContextMenuEvent);-
985 return d->modifiers;
never executed: return d->modifiers;
0
986}-
987-
988/*!-
989 \internal-
990-
991 Sets the keyboard modifiers associated with the context menu to the \a-
992 modifiers specified.-
993*/-
994void QGraphicsSceneContextMenuEvent::setModifiers(Qt::KeyboardModifiers modifiers)-
995{-
996 Q_D(QGraphicsSceneContextMenuEvent);-
997 d->modifiers = modifiers;-
998}
never executed: end of block
0
999-
1000/*!-
1001 Returns the reason for the context menu event.-
1002-
1003 \sa QGraphicsSceneContextMenuEvent::Reason-
1004*/-
1005QGraphicsSceneContextMenuEvent::Reason QGraphicsSceneContextMenuEvent::reason() const-
1006{-
1007 Q_D(const QGraphicsSceneContextMenuEvent);-
1008 return d->reason;
never executed: return d->reason;
0
1009}-
1010-
1011/*!-
1012 \internal-
1013 Sets the reason for the context menu event to \a reason.-
1014-
1015 \sa reason()-
1016*/-
1017void QGraphicsSceneContextMenuEvent::setReason(Reason reason)-
1018{-
1019 Q_D(QGraphicsSceneContextMenuEvent);-
1020 d->reason = reason;-
1021}
never executed: end of block
0
1022-
1023class QGraphicsSceneHoverEventPrivate : public QGraphicsSceneEventPrivate-
1024{-
1025public:-
1026 QPointF pos;-
1027 QPointF scenePos;-
1028 QPoint screenPos;-
1029 QPointF lastPos;-
1030 QPointF lastScenePos;-
1031 QPoint lastScreenPos;-
1032 Qt::KeyboardModifiers modifiers;-
1033};-
1034-
1035/*!-
1036 \internal-
1037-
1038 Constructs a graphics scene hover event of the specified \a type.-
1039*/-
1040QGraphicsSceneHoverEvent::QGraphicsSceneHoverEvent(Type type)-
1041 : QGraphicsSceneEvent(*new QGraphicsSceneHoverEventPrivate, type)-
1042{-
1043}
never executed: end of block
0
1044-
1045/*!-
1046 Destroys the event.-
1047*/-
1048QGraphicsSceneHoverEvent::~QGraphicsSceneHoverEvent()-
1049{-
1050}-
1051-
1052/*!-
1053 Returns the position of the mouse cursor in item coordinates at the moment-
1054 the hover event was sent.-
1055-
1056 \sa scenePos(), screenPos()-
1057*/-
1058QPointF QGraphicsSceneHoverEvent::pos() const-
1059{-
1060 Q_D(const QGraphicsSceneHoverEvent);-
1061 return d->pos;
never executed: return d->pos;
0
1062}-
1063-
1064/*!-
1065 \fn void QGraphicsSceneHoverEvent::setPos(const QPointF &point)-
1066 \internal-
1067-
1068 Sets the position associated with the hover event to the given \a point in-
1069 item coordinates.-
1070*/-
1071void QGraphicsSceneHoverEvent::setPos(const QPointF &pos)-
1072{-
1073 Q_D(QGraphicsSceneHoverEvent);-
1074 d->pos = pos;-
1075}
never executed: end of block
0
1076-
1077/*!-
1078 Returns the position of the mouse cursor in scene coordinates at the-
1079 moment the hover event was sent.-
1080-
1081 \sa pos(), screenPos()-
1082*/-
1083QPointF QGraphicsSceneHoverEvent::scenePos() const-
1084{-
1085 Q_D(const QGraphicsSceneHoverEvent);-
1086 return d->scenePos;
never executed: return d->scenePos;
0
1087}-
1088-
1089/*!-
1090 \fn void QGraphicsSceneHoverEvent::setScenePos(const QPointF &point)-
1091 \internal-
1092-
1093 Sets the position associated with the hover event to the given \a point in-
1094 scene coordinates.-
1095*/-
1096void QGraphicsSceneHoverEvent::setScenePos(const QPointF &pos)-
1097{-
1098 Q_D(QGraphicsSceneHoverEvent);-
1099 d->scenePos = pos;-
1100}
never executed: end of block
0
1101-
1102/*!-
1103 Returns the position of the mouse cursor in screen coordinates at the-
1104 moment the hover event was sent.-
1105-
1106 \sa pos(), scenePos()-
1107*/-
1108QPoint QGraphicsSceneHoverEvent::screenPos() const-
1109{-
1110 Q_D(const QGraphicsSceneHoverEvent);-
1111 return d->screenPos;
never executed: return d->screenPos;
0
1112}-
1113-
1114/*!-
1115 \fn void QGraphicsSceneHoverEvent::setScreenPos(const QPoint &point)-
1116 \internal-
1117-
1118 Sets the position associated with the hover event to the given \a point in-
1119 screen coordinates.-
1120*/-
1121void QGraphicsSceneHoverEvent::setScreenPos(const QPoint &pos)-
1122{-
1123 Q_D(QGraphicsSceneHoverEvent);-
1124 d->screenPos = pos;-
1125}
never executed: end of block
0
1126-
1127/*!-
1128 \since 4.4-
1129-
1130 Returns the last recorded mouse cursor position in item coordinates.-
1131-
1132 \sa lastScenePos(), lastScreenPos(), pos()-
1133*/-
1134QPointF QGraphicsSceneHoverEvent::lastPos() const-
1135{-
1136 Q_D(const QGraphicsSceneHoverEvent);-
1137 return d->lastPos;
never executed: return d->lastPos;
0
1138}-
1139-
1140/*!-
1141 \internal-
1142*/-
1143void QGraphicsSceneHoverEvent::setLastPos(const QPointF &pos)-
1144{-
1145 Q_D(QGraphicsSceneHoverEvent);-
1146 d->lastPos = pos;-
1147}
never executed: end of block
0
1148-
1149/*!-
1150 \since 4.4-
1151-
1152 Returns the last recorded, the scene coordinates of the previous mouse or-
1153 hover event received by the view, that created the event mouse cursor-
1154 position in scene coordinates.-
1155-
1156 \sa lastPos(), lastScreenPos(), scenePos()-
1157*/-
1158QPointF QGraphicsSceneHoverEvent::lastScenePos() const-
1159{-
1160 Q_D(const QGraphicsSceneHoverEvent);-
1161 return d->lastScenePos;
never executed: return d->lastScenePos;
0
1162}-
1163-
1164/*!-
1165 \internal-
1166*/-
1167void QGraphicsSceneHoverEvent::setLastScenePos(const QPointF &pos)-
1168{-
1169 Q_D(QGraphicsSceneHoverEvent);-
1170 d->lastScenePos = pos;-
1171}
never executed: end of block
0
1172-
1173/*!-
1174 \since 4.4-
1175-
1176 Returns the last recorded mouse cursor position in screen coordinates. The-
1177 last recorded position is the position of the previous mouse or hover-
1178 event received by the view that created the event.-
1179-
1180 \sa lastPos(), lastScenePos(), screenPos()-
1181*/-
1182QPoint QGraphicsSceneHoverEvent::lastScreenPos() const-
1183{-
1184 Q_D(const QGraphicsSceneHoverEvent);-
1185 return d->lastScreenPos;
never executed: return d->lastScreenPos;
0
1186}-
1187-
1188/*!-
1189 \internal-
1190*/-
1191void QGraphicsSceneHoverEvent::setLastScreenPos(const QPoint &pos)-
1192{-
1193 Q_D(QGraphicsSceneHoverEvent);-
1194 d->lastScreenPos = pos;-
1195}
never executed: end of block
0
1196-
1197/*!-
1198 \since 4.4-
1199-
1200 Returns the keyboard modifiers at the moment the hover event was sent.-
1201*/-
1202Qt::KeyboardModifiers QGraphicsSceneHoverEvent::modifiers() const-
1203{-
1204 Q_D(const QGraphicsSceneHoverEvent);-
1205 return d->modifiers;
never executed: return d->modifiers;
0
1206}-
1207-
1208/*!-
1209 \fn void QGraphicsSceneHoverEvent::setModifiers(Qt::KeyboardModifiers modifiers)-
1210 \internal-
1211-
1212 Sets the modifiers for the current hover event to \a modifiers.-
1213*/-
1214void QGraphicsSceneHoverEvent::setModifiers(Qt::KeyboardModifiers modifiers)-
1215{-
1216 Q_D(QGraphicsSceneHoverEvent);-
1217 d->modifiers = modifiers;-
1218}
never executed: end of block
0
1219-
1220class QGraphicsSceneHelpEventPrivate : public QGraphicsSceneEventPrivate-
1221{-
1222public:-
1223 QPointF scenePos;-
1224 QPoint screenPos;-
1225};-
1226-
1227/*!-
1228 \internal-
1229-
1230 Constructs a graphics scene help event of the specified \a type.-
1231*/-
1232QGraphicsSceneHelpEvent::QGraphicsSceneHelpEvent(Type type)-
1233 : QGraphicsSceneEvent(*new QGraphicsSceneHelpEventPrivate, type)-
1234{-
1235}
never executed: end of block
0
1236-
1237/*!-
1238 Destroys the event.-
1239*/-
1240QGraphicsSceneHelpEvent::~QGraphicsSceneHelpEvent()-
1241{-
1242}-
1243-
1244/*!-
1245 Returns the position of the mouse cursor in scene coordinates at the-
1246 moment the help event was sent.-
1247-
1248 \sa screenPos()-
1249*/-
1250QPointF QGraphicsSceneHelpEvent::scenePos() const-
1251{-
1252 Q_D(const QGraphicsSceneHelpEvent);-
1253 return d->scenePos;
never executed: return d->scenePos;
0
1254}-
1255-
1256/*!-
1257 \fn void QGraphicsSceneHelpEvent::setScenePos(const QPointF &point)-
1258 \internal-
1259-
1260 Sets the position associated with the context menu to the given \a point-
1261 in scene coordinates.-
1262*/-
1263void QGraphicsSceneHelpEvent::setScenePos(const QPointF &pos)-
1264{-
1265 Q_D(QGraphicsSceneHelpEvent);-
1266 d->scenePos = pos;-
1267}
never executed: end of block
0
1268-
1269/*!-
1270 Returns the position of the mouse cursor in screen coordinates at the-
1271 moment the help event was sent.-
1272-
1273 \sa scenePos()-
1274*/-
1275QPoint QGraphicsSceneHelpEvent::screenPos() const-
1276{-
1277 Q_D(const QGraphicsSceneHelpEvent);-
1278 return d->screenPos;
never executed: return d->screenPos;
0
1279}-
1280-
1281/*!-
1282 \fn void QGraphicsSceneHelpEvent::setScreenPos(const QPoint &point)-
1283 \internal-
1284-
1285 Sets the position associated with the context menu to the given \a point-
1286 in screen coordinates.-
1287*/-
1288void QGraphicsSceneHelpEvent::setScreenPos(const QPoint &pos)-
1289{-
1290 Q_D(QGraphicsSceneHelpEvent);-
1291 d->screenPos = pos;-
1292}
never executed: end of block
0
1293-
1294class QGraphicsSceneDragDropEventPrivate : public QGraphicsSceneEventPrivate-
1295{-
1296 Q_DECLARE_PUBLIC(QGraphicsSceneDragDropEvent)-
1297public:-
1298 inline QGraphicsSceneDragDropEventPrivate()-
1299 : source(0), mimeData(0)-
1300 { }
never executed: end of block
0
1301-
1302 QPointF pos;-
1303 QPointF scenePos;-
1304 QPoint screenPos;-
1305 Qt::MouseButtons buttons;-
1306 Qt::KeyboardModifiers modifiers;-
1307 Qt::DropActions possibleActions;-
1308 Qt::DropAction proposedAction;-
1309 Qt::DropAction dropAction;-
1310 QWidget *source;-
1311 const QMimeData *mimeData;-
1312};-
1313-
1314/*!-
1315 \internal-
1316-
1317 Constructs a new QGraphicsSceneDragDropEvent of the-
1318 specified \a type. The type can be either-
1319 QEvent::GraphicsSceneDragEnter, QEvent::GraphicsSceneDragLeave,-
1320 QEvent::GraphicsSceneDragMove, or QEvent::GraphicsSceneDrop.-
1321*/-
1322QGraphicsSceneDragDropEvent::QGraphicsSceneDragDropEvent(Type type)-
1323 : QGraphicsSceneEvent(*new QGraphicsSceneDragDropEventPrivate, type)-
1324{-
1325}
never executed: end of block
0
1326-
1327/*!-
1328 Destroys the object.-
1329*/-
1330QGraphicsSceneDragDropEvent::~QGraphicsSceneDragDropEvent()-
1331{-
1332}-
1333-
1334/*!-
1335 Returns the mouse position of the event relative to the-
1336 view that sent the event.-
1337-
1338 \sa QGraphicsView, screenPos(), scenePos()-
1339*/-
1340QPointF QGraphicsSceneDragDropEvent::pos() const-
1341{-
1342 Q_D(const QGraphicsSceneDragDropEvent);-
1343 return d->pos;
never executed: return d->pos;
0
1344}-
1345-
1346/*!-
1347 \internal-
1348 Sets the position of the mouse to \a pos; this should be-
1349 relative to the widget that generated the event, which normally-
1350 is a QGraphicsView.-
1351-
1352 \sa pos(), setScenePos(), setScreenPos()-
1353*/-
1354-
1355void QGraphicsSceneDragDropEvent::setPos(const QPointF &pos)-
1356{-
1357 Q_D(QGraphicsSceneDragDropEvent);-
1358 d->pos = pos;-
1359}
never executed: end of block
0
1360-
1361/*!-
1362 Returns the position of the mouse in scene coordinates.-
1363-
1364 \sa pos(), screenPos()-
1365*/-
1366QPointF QGraphicsSceneDragDropEvent::scenePos() const-
1367{-
1368 Q_D(const QGraphicsSceneDragDropEvent);-
1369 return d->scenePos;
never executed: return d->scenePos;
0
1370}-
1371-
1372/*!-
1373 \internal-
1374 Sets the scene position of the mouse to \a pos.-
1375-
1376 \sa scenePos(), setScreenPos(), setPos()-
1377*/-
1378void QGraphicsSceneDragDropEvent::setScenePos(const QPointF &pos)-
1379{-
1380 Q_D(QGraphicsSceneDragDropEvent);-
1381 d->scenePos = pos;-
1382}
never executed: end of block
0
1383-
1384/*!-
1385 Returns the position of the mouse relative to the screen.-
1386-
1387 \sa pos(), scenePos()-
1388*/-
1389QPoint QGraphicsSceneDragDropEvent::screenPos() const-
1390{-
1391 Q_D(const QGraphicsSceneDragDropEvent);-
1392 return d->screenPos;
never executed: return d->screenPos;
0
1393}-
1394-
1395/*!-
1396 \internal-
1397 Sets the mouse position relative to the screen to \a pos.-
1398-
1399 \sa screenPos(), setScenePos(), setPos()-
1400*/-
1401void QGraphicsSceneDragDropEvent::setScreenPos(const QPoint &pos)-
1402{-
1403 Q_D(QGraphicsSceneDragDropEvent);-
1404 d->screenPos = pos;-
1405}
never executed: end of block
0
1406-
1407/*!-
1408 Returns a Qt::MouseButtons value indicating which buttons-
1409 were pressed on the mouse when this mouse event was-
1410 generated.-
1411-
1412 \sa Qt::MouseButtons-
1413*/-
1414Qt::MouseButtons QGraphicsSceneDragDropEvent::buttons() const-
1415{-
1416 Q_D(const QGraphicsSceneDragDropEvent);-
1417 return d->buttons;
never executed: return d->buttons;
0
1418}-
1419-
1420/*!-
1421 \internal-
1422 Sets the mouse buttons that were pressed when the event was-
1423 created to \a buttons.-
1424-
1425 \sa Qt::MouseButtons, buttons()-
1426*/-
1427void QGraphicsSceneDragDropEvent::setButtons(Qt::MouseButtons buttons)-
1428{-
1429 Q_D(QGraphicsSceneDragDropEvent);-
1430 d->buttons = buttons;-
1431}
never executed: end of block
0
1432-
1433/*!-
1434 Returns the keyboard modifiers that were pressed when the drag-
1435 and drop event was created.-
1436-
1437 \sa Qt::KeyboardModifiers-
1438*/-
1439Qt::KeyboardModifiers QGraphicsSceneDragDropEvent::modifiers() const-
1440{-
1441 Q_D(const QGraphicsSceneDragDropEvent);-
1442 return d->modifiers;
never executed: return d->modifiers;
0
1443}-
1444-
1445/*!-
1446 \internal-
1447 Sets the keyboard modifiers that were pressed when the event-
1448 was created to \a modifiers.-
1449-
1450 \sa Qt::KeyboardModifiers, modifiers()-
1451*/-
1452-
1453void QGraphicsSceneDragDropEvent::setModifiers(Qt::KeyboardModifiers modifiers)-
1454{-
1455 Q_D(QGraphicsSceneDragDropEvent);-
1456 d->modifiers = modifiers;-
1457}
never executed: end of block
0
1458-
1459/*!-
1460 Returns the possible drop actions that the drag and-
1461 drop can result in.-
1462-
1463 \sa Qt::DropActions-
1464*/-
1465-
1466Qt::DropActions QGraphicsSceneDragDropEvent::possibleActions() const-
1467{-
1468 Q_D(const QGraphicsSceneDragDropEvent);-
1469 return d->possibleActions;
never executed: return d->possibleActions;
0
1470}-
1471-
1472/*!-
1473 \internal-
1474 Sets the possible drop actions that the drag can-
1475 result in to \a actions.-
1476-
1477 \sa Qt::DropActions, possibleActions()-
1478*/-
1479void QGraphicsSceneDragDropEvent::setPossibleActions(Qt::DropActions actions)-
1480{-
1481 Q_D(QGraphicsSceneDragDropEvent);-
1482 d->possibleActions = actions;-
1483}
never executed: end of block
0
1484-
1485/*!-
1486 Returns the drop action that is proposed, i.e., preferred.-
1487 The action must be one of the possible actions as defined by-
1488 \c possibleActions().-
1489-
1490 \sa Qt::DropAction, possibleActions()-
1491*/-
1492-
1493Qt::DropAction QGraphicsSceneDragDropEvent::proposedAction() const-
1494{-
1495 Q_D(const QGraphicsSceneDragDropEvent);-
1496 return d->proposedAction;
never executed: return d->proposedAction;
0
1497}-
1498-
1499/*!-
1500 \internal-
1501 Sets the proposed action to \a action. The proposed action-
1502 is a Qt::DropAction that is one of the possible actions as-
1503 given by \c possibleActions().-
1504-
1505 \sa proposedAction(), Qt::DropAction, possibleActions()-
1506*/-
1507-
1508void QGraphicsSceneDragDropEvent::setProposedAction(Qt::DropAction action)-
1509{-
1510 Q_D(QGraphicsSceneDragDropEvent);-
1511 d->proposedAction = action;-
1512}
never executed: end of block
0
1513-
1514/*!-
1515 Sets the proposed action as accepted, i.e, the drop action-
1516 is set to the proposed action. This is equal to:-
1517-
1518 \snippet code/src_gui_graphicsview_qgraphicssceneevent.cpp 0-
1519-
1520 When using this function, one should not call \c accept().-
1521-
1522 \sa dropAction(), setDropAction(), proposedAction()-
1523*/-
1524-
1525void QGraphicsSceneDragDropEvent::acceptProposedAction()-
1526{-
1527 Q_D(QGraphicsSceneDragDropEvent);-
1528 d->dropAction = d->proposedAction;-
1529}
never executed: end of block
0
1530-
1531/*!-
1532 Returns the action that was performed in this drag and drop.-
1533 This should be set by the receiver of the drop and is-
1534 returned by QDrag::exec().-
1535-
1536 \sa setDropAction(), acceptProposedAction()-
1537*/-
1538-
1539Qt::DropAction QGraphicsSceneDragDropEvent::dropAction() const-
1540{-
1541 Q_D(const QGraphicsSceneDragDropEvent);-
1542 return d->dropAction;
never executed: return d->dropAction;
0
1543}-
1544-
1545/*!-
1546 This function lets the receiver of the drop set the drop-
1547 action that was performed to \a action, which should be one-
1548 of the-
1549 \l{QGraphicsSceneDragDropEvent::possibleActions()}{possible-
1550 actions}. Call \c accept() in stead of \c-
1551 acceptProposedAction() if you use this function.-
1552-
1553 \sa dropAction(), accept(), possibleActions()-
1554*/-
1555void QGraphicsSceneDragDropEvent::setDropAction(Qt::DropAction action)-
1556{-
1557 Q_D(QGraphicsSceneDragDropEvent);-
1558 d->dropAction = action;-
1559}
never executed: end of block
0
1560-
1561/*!-
1562 This function returns the QGraphicsView that created the-
1563 QGraphicsSceneDragDropEvent.-
1564*/-
1565QWidget *QGraphicsSceneDragDropEvent::source() const-
1566{-
1567 Q_D(const QGraphicsSceneDragDropEvent);-
1568 return d->source;
never executed: return d->source;
0
1569}-
1570-
1571/*!-
1572 \internal-
1573 This function set the source widget, i.e., the widget that-
1574 created the drop event, to \a source.-
1575*/-
1576void QGraphicsSceneDragDropEvent::setSource(QWidget *source)-
1577{-
1578 Q_D(QGraphicsSceneDragDropEvent);-
1579 d->source = source;-
1580}
never executed: end of block
0
1581-
1582/*!-
1583 This function returns the MIME data of the event.-
1584*/-
1585const QMimeData *QGraphicsSceneDragDropEvent::mimeData() const-
1586{-
1587 Q_D(const QGraphicsSceneDragDropEvent);-
1588 return d->mimeData;
never executed: return d->mimeData;
0
1589}-
1590-
1591/*!-
1592 \internal-
1593 This function sets the MIME data for the event.-
1594*/-
1595void QGraphicsSceneDragDropEvent::setMimeData(const QMimeData *data)-
1596{-
1597 Q_D(QGraphicsSceneDragDropEvent);-
1598 d->mimeData = data;-
1599}
never executed: end of block
0
1600-
1601class QGraphicsSceneResizeEventPrivate : public QGraphicsSceneEventPrivate-
1602{-
1603 Q_DECLARE_PUBLIC(QGraphicsSceneResizeEvent)-
1604public:-
1605 inline QGraphicsSceneResizeEventPrivate()-
1606 { }-
1607-
1608 QSizeF oldSize;-
1609 QSizeF newSize;-
1610};-
1611-
1612/*!-
1613 Constructs a QGraphicsSceneResizeEvent.-
1614*/-
1615QGraphicsSceneResizeEvent::QGraphicsSceneResizeEvent()-
1616 : QGraphicsSceneEvent(*new QGraphicsSceneResizeEventPrivate, QEvent::GraphicsSceneResize)-
1617{-
1618}
never executed: end of block
0
1619-
1620/*!-
1621 Destroys the QGraphicsSceneResizeEvent.-
1622*/-
1623QGraphicsSceneResizeEvent::~QGraphicsSceneResizeEvent()-
1624{-
1625}-
1626-
1627/*!-
1628 Returns the old size (i.e., the size immediately before the widget was-
1629 resized).-
1630-
1631 \sa newSize(), QGraphicsWidget::resize()-
1632*/-
1633QSizeF QGraphicsSceneResizeEvent::oldSize() const-
1634{-
1635 Q_D(const QGraphicsSceneResizeEvent);-
1636 return d->oldSize;
never executed: return d->oldSize;
0
1637}-
1638-
1639/*!-
1640 \internal-
1641*/-
1642void QGraphicsSceneResizeEvent::setOldSize(const QSizeF &size)-
1643{-
1644 Q_D(QGraphicsSceneResizeEvent);-
1645 d->oldSize = size;-
1646}
never executed: end of block
0
1647-
1648/*!-
1649 Returns the new size (i.e., the current size).-
1650-
1651 \sa oldSize(), QGraphicsWidget::resize()-
1652*/-
1653QSizeF QGraphicsSceneResizeEvent::newSize() const-
1654{-
1655 Q_D(const QGraphicsSceneResizeEvent);-
1656 return d->newSize;
never executed: return d->newSize;
0
1657}-
1658-
1659/*!-
1660 \internal-
1661*/-
1662void QGraphicsSceneResizeEvent::setNewSize(const QSizeF &size)-
1663{-
1664 Q_D(QGraphicsSceneResizeEvent);-
1665 d->newSize = size;-
1666}
never executed: end of block
0
1667-
1668class QGraphicsSceneMoveEventPrivate : public QGraphicsSceneEventPrivate-
1669{-
1670 Q_DECLARE_PUBLIC(QGraphicsSceneMoveEvent)-
1671public:-
1672 inline QGraphicsSceneMoveEventPrivate()-
1673 { }-
1674-
1675 QPointF oldPos;-
1676 QPointF newPos;-
1677};-
1678-
1679/*!-
1680 Constructs a QGraphicsSceneMoveEvent.-
1681*/-
1682QGraphicsSceneMoveEvent::QGraphicsSceneMoveEvent()-
1683 : QGraphicsSceneEvent(*new QGraphicsSceneMoveEventPrivate, QEvent::GraphicsSceneMove)-
1684{-
1685}
never executed: end of block
0
1686-
1687/*!-
1688 Destroys the QGraphicsSceneMoveEvent.-
1689*/-
1690QGraphicsSceneMoveEvent::~QGraphicsSceneMoveEvent()-
1691{-
1692}-
1693-
1694/*!-
1695 Returns the old position (i.e., the position immediately before the widget-
1696 was moved).-
1697-
1698 \sa newPos(), QGraphicsItem::setPos()-
1699*/-
1700QPointF QGraphicsSceneMoveEvent::oldPos() const-
1701{-
1702 Q_D(const QGraphicsSceneMoveEvent);-
1703 return d->oldPos;
never executed: return d->oldPos;
0
1704}-
1705-
1706/*!-
1707 \internal-
1708*/-
1709void QGraphicsSceneMoveEvent::setOldPos(const QPointF &pos)-
1710{-
1711 Q_D(QGraphicsSceneMoveEvent);-
1712 d->oldPos = pos;-
1713}
never executed: end of block
0
1714-
1715/*!-
1716 Returns the new position (i.e., the current position).-
1717-
1718 \sa oldPos(), QGraphicsItem::setPos()-
1719*/-
1720QPointF QGraphicsSceneMoveEvent::newPos() const-
1721{-
1722 Q_D(const QGraphicsSceneMoveEvent);-
1723 return d->newPos;
never executed: return d->newPos;
0
1724}-
1725-
1726/*!-
1727 \internal-
1728*/-
1729void QGraphicsSceneMoveEvent::setNewPos(const QPointF &pos)-
1730{-
1731 Q_D(QGraphicsSceneMoveEvent);-
1732 d->newPos = pos;-
1733}
never executed: end of block
0
1734-
1735QT_END_NAMESPACE-
1736-
1737#endif // QT_NO_GRAPHICSVIEW-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9