QGraphicsSceneEvent Class Reference

[QtGui module]

该QGraphicsSceneEvent类提供了一个基类,所有图形查看相关事件。More…

继承QEvent

通过继承QGraphicsSceneContextMenuEventQGraphicsSceneDragDropEventQGraphicsSceneHelpEventQGraphicsSceneHoverEventQGraphicsSceneMouseEventQGraphicsSceneMoveEventQGraphicsSceneResizeEventQGraphicsSceneWheelEvent

Methods

  • setWidget (self, QWidget widget)
  • QWidget widget (self)

Detailed Description

该QGraphicsSceneEvent类提供了一个基类,所有图形查看相关事件。

QGraphicsView接收Qt的鼠标,键盘和拖放事件(QMouseEventQKeyEvent, QDragEvent等),它转换成QGraphicsSceneEvent子类的实例,并将其转发到QGraphicsScene它显示。那么现场的事件转发到相关项目。

例如,当一个QGraphicsView收到QMouseEvent类型MousePress作为一个用户点击一个响应,该视图发送一个QGraphicsSceneMouseEvent类型GraphicsSceneMousePress到底层QGraphicsScene通过其mousePressEvent()功能。默认QGraphicsScene.mousePressEvent()实现确定哪些项目被点击和事件转发到QGraphicsItem.mousePressEvent( ) 。

子类如QGraphicsSceneMouseEventQGraphicsSceneContextMenuEvent从原来提供的坐标QEvent在屏幕上,场景和物品坐标(见screenPos()scenePos()pos()) 。该项目的坐标通过设置QGraphicsScene面前的事件转发到事件到QGraphicsItem。鼠标事件也增加了可能性,从视图收到的最后一个事件获取的坐标(见lastScreenPos()lastScenePos()lastPos()) 。


Method Documentation

  1. QGraphicsSceneEvent.setWidget (self, QWidget widget)
  1. QWidget QGraphicsSceneEvent.widget (self)

[

返回小部件产生事件,或者0,如果事件从另一个应用程序的起源。

](qwidget.html)