QGraphicsSceneEvent¶
The QGraphicsSceneEvent
class provides a base class for all graphics view related events. More…
Inherited by: QGraphicsSceneWheelEvent, QGraphicsSceneResizeEvent, QGraphicsSceneMoveEvent, QGraphicsSceneMouseEvent, QGraphicsSceneHoverEvent, QGraphicsSceneHelpEvent, QGraphicsSceneDragDropEvent, QGraphicsSceneContextMenuEvent
Synopsis¶
Functions¶
def
setTimestamp
(ts)def
timestamp
()def
widget
()
Detailed Description¶
When a QGraphicsView
receives Qt mouse, keyboard, and drag and drop events ( QMouseEvent
, QKeyEvent
, QDragEvent, etc.), it translates them into instances of QGraphicsSceneEvent
subclasses and forwards them to the QGraphicsScene
it displays. The scene then forwards the events to the relevant items.
For example, when a QGraphicsView
receives a QMouseEvent
of type MousePress as a response to a user click, the view sends a QGraphicsSceneMouseEvent
of type GraphicsSceneMousePress to the underlying QGraphicsScene
through its mousePressEvent()
function. The default mousePressEvent()
implementation determines which item was clicked and forwards the event to mousePressEvent()
.
Subclasses such as QGraphicsSceneMouseEvent
and QGraphicsSceneContextMenuEvent
provide the coordinates from the original QEvent
in screen, scene, and item coordinates (see screenPos()
, scenePos()
, and pos()
). The item coordinates are set by the QGraphicsScene
before it forwards the event to the event to a QGraphicsItem
. The mouse events also add the possibility to retrieve the coordinates from the last event received by the view (see lastScreenPos()
, lastScenePos()
, and lastPos()
).
See also
QEvent
- PySide6.QtWidgets.QGraphicsSceneEvent.setTimestamp(ts)¶
- Parameters
ts – int
- PySide6.QtWidgets.QGraphicsSceneEvent.timestamp()¶
- Return type
int
Returns the timestamp of the original event, or 0 if the original event does not report a time stamp.
- PySide6.QtWidgets.QGraphicsSceneEvent.widget()¶
- Return type
Returns the widget where the event originated, or None
if 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.