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

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