QGraphicsSceneEvent¶
The
QGraphicsSceneEventclass provides a base class for all graphics view related events. More…

Inherited by: QGraphicsSceneContextMenuEvent, QGraphicsSceneDragDropEvent, QGraphicsSceneHelpEvent, QGraphicsSceneHoverEvent, QGraphicsSceneMouseEvent, QGraphicsSceneMoveEvent, QGraphicsSceneResizeEvent, QGraphicsSceneWheelEvent
Synopsis¶
Functions¶
def
widget()
Detailed Description¶
When a
QGraphicsViewreceives Qt mouse, keyboard, and drag and drop events (QMouseEvent,QKeyEvent, QDragEvent, etc.), it translates them into instances ofQGraphicsSceneEventsubclasses and forwards them to theQGraphicsSceneit displays. The scene then forwards the events to the relevant items.For example, when a
QGraphicsViewreceives aQMouseEventof type MousePress as a response to a user click, the view sends aQGraphicsSceneMouseEventof typeGraphicsSceneMousePressto the underlyingQGraphicsScenethrough itsmousePressEvent()function. The defaultmousePressEvent()implementation determines which item was clicked and forwards the event tomousePressEvent().Subclasses such as
QGraphicsSceneMouseEventandQGraphicsSceneContextMenuEventprovide the coordinates from the originalQEventin screen, scene, and item coordinates (seescreenPos(),scenePos(), andpos()). The item coordinates are set by theQGraphicsScenebefore 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
QEvent
- class PySide2.QtWidgets.QGraphicsSceneEvent(type)¶
- param type:
Constructs a generic graphics scene event of the specified
type.
- PySide2.QtWidgets.QGraphicsSceneEvent.widget()¶
- Return type:
Returns the widget where the event originated, or
Noneif the event originates from another application.
© 2022 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.