source: trunk/src/gui/graphicsview/qgraphicssceneevent.cpp@ 67

Last change on this file since 67 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 40.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42/*!
43 \class QGraphicsSceneEvent
44 \brief The QGraphicsSceneEvent class provides a base class for all
45 graphics view related events.
46 \since 4.2
47 \ingroup multimedia
48 \ingroup graphicsview-api
49
50 When a QGraphicsView receives Qt mouse, keyboard, and drag and
51 drop events (QMouseEvent, QKeyEvent, QDragEvent, etc.), it
52 translates them into instances of QGraphicsSceneEvent subclasses
53 and forwards them to the QGraphicsScene it displays. The scene
54 then forwards the events to the relevant items.
55
56 For example, when a QGraphicsView receives a QMouseEvent of type
57 MousePress as a response to a user click, the view sends a
58 QGraphicsSceneMouseEvent of type GraphicsSceneMousePress to the
59 underlying QGraphicsScene through its
60 \l{QGraphicsScene::}{mousePressEvent()} function. The default
61 QGraphicsScene::mousePressEvent() implementation determines which
62 item was clicked and forwards the event to
63 QGraphicsItem::mousePressEvent().
64
65 \omit ### Beskrive widget() \endomit
66
67 Subclasses such as QGraphicsSceneMouseEvent and
68 QGraphicsSceneContextMenuEvent provide the coordinates from the
69 original QEvent in screen, scene, and item coordinates (see
70 \l{QGraphicsSceneMouseEvent::}{screenPos()},
71 \l{QGraphicsSceneMouseEvent::}{scenePos()}, and
72 \l{QGraphicsSceneMouseEvent::}{pos()}). The item coordinates are
73 set by the QGraphicsScene before it forwards the event to the
74 event to a QGraphicsItem. The mouse events also add the
75 possibility to retrieve the coordinates from the last event
76 received by the view (see
77 \l{QGraphicsSceneMouseEvent::}{lastScreenPos()},
78 \l{QGraphicsSceneMouseEvent::}{lastScenePos()}, and
79 \l{QGraphicsSceneMouseEvent::}{lastPos()}).
80
81 \sa QEvent
82*/
83
84/*!
85 \class QGraphicsSceneMouseEvent
86 \brief The QGraphicsSceneMouseEvent class provides mouse events
87 in the graphics view framework.
88 \since 4.2
89 \ingroup multimedia
90 \ingroup graphicsview-api
91
92 When a QGraphicsView receives a QMouseEvent, it translates it to
93 a QGraphicsSceneMouseEvent. The event is then forwarded to the
94 QGraphicsScene associated with the view.
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 multimedia
115 \ingroup graphicsview-api
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 multimedia
132 \ingroup graphicsview-api
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 Mac OS X, 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 multimedia
164 \ingroup graphicsview-api
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 multimedia
180 \ingroup graphicsview-api
181