QGraphicsSceneEvent 类提供基类为所有图形视图相关事件。 更多...
头: | #include <QGraphicsSceneEvent> |
qmake: | QT += widgets |
Since: | Qt 4.2 |
继承: | QEvent |
继承者: |
QGraphicsSceneContextMenuEvent , QGraphicsSceneDragDropEvent , QGraphicsSceneHelpEvent , QGraphicsSceneHoverEvent , QGraphicsSceneMouseEvent , QGraphicsSceneMoveEvent , QGraphicsSceneResizeEvent ,和 QGraphicsSceneWheelEvent |
该类在 Qt 4.2 引入。
virtual | ~QGraphicsSceneEvent () |
QWidget * | widget () const |
当 QGraphicsView 接收 Qt 鼠标、键盘及拖放事件 ( QMouseEvent , QKeyEvent ,QDragEvent,等),它将它们翻译成 QGraphicsSceneEvent 子类实例并将它们转发给 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
()
销毁事件。
Returns the widget where the event originated, or
nullptr
if the event originates from another application.