• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QIconDragEvent

    下一话题

    QGraphicsSceneWheelEvent

    QGraphicsSceneEvent

    继承者: QGraphicsSceneWheelEvent , QGraphicsSceneMouseEvent , QGraphicsSceneMoveEvent , QGraphicsSceneResizeEvent , QGraphicsSceneDragDropEvent , QGraphicsSceneHelpEvent , QGraphicsSceneHoverEvent , QGraphicsSceneContextMenuEvent

    概要

    函数

    详细描述

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

    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 接收 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() ,和 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() ,和 PySide.QtGui.QGraphicsSceneMouseEvent.lastPos() ).

    class PySide.QtGui. QGraphicsSceneEvent ( type )
    参数: type PySide.QtCore.QEvent.Type

    Constructs a generic graphics scene event of the specified type .

    PySide.QtGui.QGraphicsSceneEvent. widget ( )
    返回类型: PySide.QtGui.QWidget

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