QGraphicsSceneEvent 類

The QGraphicsSceneEvent class provides a base class for all graphics view related events. 更多...

頭: #include <QGraphicsSceneEvent>
qmake: QT += widgets
Since: Qt 4.2
繼承: QEvent
繼承者: QGraphicsSceneContextMenuEvent , QGraphicsSceneDragDropEvent , QGraphicsSceneHelpEvent , QGraphicsSceneHoverEvent , QGraphicsSceneMouseEvent , QGraphicsSceneMoveEvent , QGraphicsSceneResizeEvent ,和 QGraphicsSceneWheelEvent

公共函數

~QGraphicsSceneEvent ()
QWidget * widget () const

額外繼承成員

詳細描述

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

QGraphicsView 接收 Qt 鼠標、鍵盤及拖放事件 ( QMouseEvent , QKeyEvent , QDragEvent, etc.), it translates them into instances of QGraphicsSceneEvent subclasses and forwards them to the QGraphicsScene 由它顯示。然後,場景將事件轉發給相關項。

例如,當 QGraphicsView 接收 QMouseEvent of type MousePress as a response to a user click, the view sends a QGraphicsSceneMouseEvent 類型 GraphicsSceneMousePress to the underlying QGraphicsScene through its mousePressEvent() function. The default QGraphicsScene::mousePressEvent () implementation determines which item was clicked and forwards the event to QGraphicsItem::mousePressEvent ().

Subclasses such as QGraphicsSceneMouseEvent and QGraphicsSceneContextMenuEvent provide the coordinates from the original QEvent in screen, scene, and item coordinates (see screenPos() , scenePos() ,和 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() ,和 lastPos() ).

另請參閱 QEvent .

成員函數文檔編製

QGraphicsSceneEvent:: ~QGraphicsSceneEvent ()

銷毀事件。

QWidget *QGraphicsSceneEvent:: widget () const

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