Table Of Contents

Previous topic


Next topic



Inheritance diagram of QGraphicsSceneEvent

Inherited by: QGraphicsSceneMoveEvent, QGraphicsSceneResizeEvent, QGraphicsSceneDragDropEvent, QGraphicsSceneHelpEvent, QGraphicsSceneHoverEvent, QGraphicsSceneContextMenuEvent, QGraphicsSceneWheelEvent, QGraphicsSceneMouseEvent



Detailed Description

The PySide.QtGui.QGraphicsSceneEvent class provides a base class for all graphics view related events.

When a PySide.QtGui.QGraphicsView receives Qt mouse, keyboard, and drag and drop events ( PySide.QtGui.QMouseEvent , PySide.QtGui.QKeyEvent , QDragEvent, etc.), it translates them into instances of PySide.QtGui.QGraphicsSceneEvent subclasses and forwards them to the PySide.QtGui.QGraphicsScene it displays. The scene then forwards the events to the relevant items.

For example, when a PySide.QtGui.QGraphicsView receives a PySide.QtGui.QMouseEvent of type MousePress as a response to a user click, the view sends a PySide.QtGui.QGraphicsSceneMouseEvent of type GraphicsSceneMousePress to the underlying PySide.QtGui.QGraphicsScene through its PySide.QtGui.QGraphicsScene.mousePressEvent() function. The default QGraphicsScene.mousePressEvent() implementation determines which item was clicked and forwards the event to QGraphicsItem.mousePressEvent() .

Subclasses such as PySide.QtGui.QGraphicsSceneMouseEvent and PySide.QtGui.QGraphicsSceneContextMenuEvent provide the coordinates from the original PySide.QtCore.QEvent in screen, scene, and item coordinates (see PySide.QtGui.QGraphicsSceneMouseEvent.screenPos() , PySide.QtGui.QGraphicsSceneMouseEvent.scenePos() , and PySide.QtGui.QGraphicsSceneMouseEvent.pos() ). The item coordinates are set by the PySide.QtGui.QGraphicsScene before it forwards the event to the event to a PySide.QtGui.QGraphicsItem . The mouse events also add the possibility to retrieve the coordinates from the last event received by the view (see PySide.QtGui.QGraphicsSceneMouseEvent.lastScreenPos() , PySide.QtGui.QGraphicsSceneMouseEvent.lastScenePos() , and PySide.QtGui.QGraphicsSceneMouseEvent.lastPos() ).

class PySide.QtGui.QGraphicsSceneEvent(type)

Constructs a generic graphics scene event of the specified type .

Return type:PySide.QtGui.QWidget

Returns the widget where the event originated, or 0 if the event originates from another application.