PySide6.QtWidgets.QGraphicsSceneEvent¶
- class QGraphicsSceneEvent¶
The
QGraphicsSceneEventclass provides a base class for all graphics view related events.Details
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 a QMouseEvent of type MousePress as a response to a user click, the view sends aQGraphicsSceneMouseEventof type GraphicsSceneMousePress to 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 original QEvent in 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
Inherited by:
QGraphicsSceneWheelEvent,QGraphicsSceneResizeEvent,QGraphicsSceneMoveEvent,QGraphicsSceneMouseEvent,QGraphicsSceneHoverEvent,QGraphicsSceneHelpEvent,QGraphicsSceneDragDropEvent,QGraphicsSceneContextMenuEventSynopsis¶
Methods¶
def
__init__()def
setTimestamp()def
timestamp()def
widget()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- setTimestamp(ts)¶
- Parameters:
ts – int
- timestamp()¶
- Return type:
int
Returns the timestamp of the original event, or 0 if the original event does not report a time stamp.
Returns the widget where the event originated, or
Noneif the event originates from another application.