QGraphicsSceneEvent¶
The
QGraphicsSceneEvent
class provides a base class for all graphics view related events. More…
Inherited by: QGraphicsSceneContextMenuEvent, QGraphicsSceneDragDropEvent, QGraphicsSceneHelpEvent, QGraphicsSceneHoverEvent, QGraphicsSceneMouseEvent, QGraphicsSceneMoveEvent, QGraphicsSceneResizeEvent, QGraphicsSceneWheelEvent
Detailed Description¶
When a
QGraphicsView
receives Qt mouse, keyboard, and drag and drop events (QMouseEvent
,QKeyEvent
, QDragEvent, etc.), it translates them into instances ofQGraphicsSceneEvent
subclasses and forwards them to theQGraphicsScene
it displays. The scene then forwards the events to the relevant items.For example, when a
QGraphicsView
receives aQMouseEvent
of type MousePress as a response to a user click, the view sends aQGraphicsSceneMouseEvent
of typeGraphicsSceneMousePress
to the underlyingQGraphicsScene
through itsmousePressEvent()
function. The defaultmousePressEvent()
implementation determines which item was clicked and forwards the event tomousePressEvent()
.Subclasses such as
QGraphicsSceneMouseEvent
andQGraphicsSceneContextMenuEvent
provide the coordinates from the originalQEvent
in screen, scene, and item coordinates (seescreenPos()
,scenePos()
, andpos()
). The item coordinates are set by theQGraphicsScene
before it forwards the event to the event to aQGraphicsItem
. The mouse events also add the possibility to retrieve the coordinates from the last event received by the view (seelastScreenPos()
,lastScenePos()
, andlastPos()
).See also
-
class
QGraphicsSceneEvent
(type)¶ - param type
Type
Constructs a generic graphics scene event of the specified
type
.
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.