<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QGraphicsSceneEvent Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGraphicsSceneEvent Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsSceneEvent class provides a base class for all graphics view related events. <a href="#details">More...</a></p> <p>Inherits <a href="qevent.html">QEvent</a>.</p><p>Inherited by <a href="qgraphicsscenecontextmenuevent.html">QGraphicsSceneContextMenuEvent</a>, <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a>, <a href="qgraphicsscenehelpevent.html">QGraphicsSceneHelpEvent</a>, <a href="qgraphicsscenehoverevent.html">QGraphicsSceneHoverEvent</a>, <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a>, <a href="qgraphicsscenemoveevent.html">QGraphicsSceneMoveEvent</a>, <a href="qgraphicssceneresizeevent.html">QGraphicsSceneResizeEvent</a> and <a href="qgraphicsscenewheelevent.html">QGraphicsSceneWheelEvent</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicssceneevent.html#setWidget">setWidget</a></b> (<i>self</i>, QWidget <i>widget</i>)</li><li><div class="fn" />QWidget <b><a href="qgraphicssceneevent.html#widget">widget</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsSceneEvent class provides a base class for all graphics view related events.</p> <p>When a <a href="qgraphicsview.html">QGraphicsView</a> receives Qt mouse, keyboard, and drag and drop events (<a href="qmouseevent.html">QMouseEvent</a>, <a href="qkeyevent.html">QKeyEvent</a>, QDragEvent, etc.), it translates them into instances of QGraphicsSceneEvent subclasses and forwards them to the <a href="qgraphicsscene.html">QGraphicsScene</a> it displays. The scene then forwards the events to the relevant items.</p> <p>For example, when a <a href="qgraphicsview.html">QGraphicsView</a> receives a <a href="qmouseevent.html">QMouseEvent</a> of type MousePress as a response to a user click, the view sends a <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> of type <a href="qevent.html#Type-enum">GraphicsSceneMousePress</a> to the underlying <a href="qgraphicsscene.html">QGraphicsScene</a> through its <a href="qgraphicsscene.html#mousePressEvent">mousePressEvent()</a> function. The default <a href="qgraphicsscene.html#mousePressEvent">QGraphicsScene.mousePressEvent</a>() implementation determines which item was clicked and forwards the event to <a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem.mousePressEvent</a>().</p> <p>Subclasses such as <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> and <a href="qgraphicsscenecontextmenuevent.html">QGraphicsSceneContextMenuEvent</a> provide the coordinates from the original <a href="qevent.html">QEvent</a> in screen, scene, and item coordinates (see <a href="qgraphicsscenemouseevent.html#screenPos">screenPos()</a>, <a href="qgraphicsscenemouseevent.html#scenePos">scenePos()</a>, and <a href="qgraphicsscenemouseevent.html#pos">pos()</a>). The item coordinates are set by the <a href="qgraphicsscene.html">QGraphicsScene</a> before it forwards the event to the event to a <a href="qgraphicsitem.html">QGraphicsItem</a>. The mouse events also add the possibility to retrieve the coordinates from the last event received by the view (see <a href="qgraphicsscenemouseevent.html#lastScreenPos">lastScreenPos()</a>, <a href="qgraphicsscenemouseevent.html#lastScenePos">lastScenePos()</a>, and <a href="qgraphicsscenemouseevent.html#lastPos">lastPos()</a>).</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="setWidget" />QGraphicsSceneEvent.setWidget (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><h3 class="fn"><a name="widget" /><a href="qwidget.html">QWidget</a> QGraphicsSceneEvent.widget (<i>self</i>)</h3><p>Returns the widget where the event originated, or 0 if the event originates from another application.</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>