Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 4198

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qgraphicsscene.cpp -->
<head>
  <title>Qt 4.6: QGraphicsScene Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QGraphicsScene"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QGraphicsScene Class Reference<br /><span class="small-subtitle">[<a href="qtgui.html">QtGui</a> module]</span>
</h1>
<p>The QGraphicsScene class provides a surface for managing a large number of 2D graphical items. <a href="#details">More...</a></p>
<pre> #include &lt;QGraphicsScene&gt;</pre><p>Inherits <a href="qobject.html">QObject</a>.</p>
<p>This class was introduced in Qt 4.2.</p>
<ul>
<li><a href="qgraphicsscene-members.html">List of all members, including inherited members</a></li>
<li><a href="qgraphicsscene-obsolete.html">Obsolete members</a></li>
</ul>
<hr />
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#ItemIndexMethod-enum">ItemIndexMethod</a></b> { BspTreeIndex, NoIndex }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#SceneLayer-enum">SceneLayer</a></b> { ItemLayer, BackgroundLayer, ForegroundLayer, AllLayers }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#SceneLayer-enum">SceneLayers</a></b></td></tr>
</table>
<hr />
<a name="properties"></a>
<h2>Properties</h2>
<p><table class="propsummary" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="45%" valign="top"><ul>
<li><div class="fn"><b><a href="qgraphicsscene.html#backgroundBrush-prop">backgroundBrush</a></b> : QBrush</div></li>
<li><div class="fn"><b><a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a></b> : int</div></li>
<li><div class="fn"><b><a href="qgraphicsscene.html#font-prop">font</a></b> : QFont</div></li>
<li><div class="fn"><b><a href="qgraphicsscene.html#foregroundBrush-prop">foregroundBrush</a></b> : QBrush</div></li>
</ul></td><td valign="top"><ul>
<li><div class="fn"><b><a href="qgraphicsscene.html#itemIndexMethod-prop">itemIndexMethod</a></b> : ItemIndexMethod</div></li>
<li><div class="fn"><b><a href="qgraphicsscene.html#palette-prop">palette</a></b> : QPalette</div></li>
<li><div class="fn"><b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a></b> : QRectF</div></li>
<li><div class="fn"><b><a href="qgraphicsscene.html#stickyFocus-prop">stickyFocus</a></b> : bool</div></li>
</ul>
</td></tr>
</table></p>
<ul>
<li><div bar="2" class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#QGraphicsScene">QGraphicsScene</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#QGraphicsScene-2">QGraphicsScene</a></b> ( const QRectF &amp; <i>sceneRect</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#QGraphicsScene-3">QGraphicsScene</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>width</i>, qreal <i>height</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#dtor.QGraphicsScene">~QGraphicsScene</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#activePanel">activePanel</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsWidget * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#activeWindow">activeWindow</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsEllipseItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addEllipse">addEllipse</a></b> ( const QRectF &amp; <i>rect</i>, const QPen &amp; <i>pen</i> = QPen(), const QBrush &amp; <i>brush</i> = QBrush() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsEllipseItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addEllipse-2">addEllipse</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>, const QPen &amp; <i>pen</i> = QPen(), const QBrush &amp; <i>brush</i> = QBrush() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addItem">addItem</a></b> ( QGraphicsItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsLineItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addLine">addLine</a></b> ( const QLineF &amp; <i>line</i>, const QPen &amp; <i>pen</i> = QPen() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsLineItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addLine-2">addLine</a></b> ( qreal <i>x1</i>, qreal <i>y1</i>, qreal <i>x2</i>, qreal <i>y2</i>, const QPen &amp; <i>pen</i> = QPen() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsPathItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addPath">addPath</a></b> ( const QPainterPath &amp; <i>path</i>, const QPen &amp; <i>pen</i> = QPen(), const QBrush &amp; <i>brush</i> = QBrush() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsPixmapItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addPixmap">addPixmap</a></b> ( const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsPolygonItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addPolygon">addPolygon</a></b> ( const QPolygonF &amp; <i>polygon</i>, const QPen &amp; <i>pen</i> = QPen(), const QBrush &amp; <i>brush</i> = QBrush() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsRectItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addRect">addRect</a></b> ( const QRectF &amp; <i>rect</i>, const QPen &amp; <i>pen</i> = QPen(), const QBrush &amp; <i>brush</i> = QBrush() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsRectItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addRect-2">addRect</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>, const QPen &amp; <i>pen</i> = QPen(), const QBrush &amp; <i>brush</i> = QBrush() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsSimpleTextItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addSimpleText">addSimpleText</a></b> ( const QString &amp; <i>text</i>, const QFont &amp; <i>font</i> = QFont() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsTextItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addText">addText</a></b> ( const QString &amp; <i>text</i>, const QFont &amp; <i>font</i> = QFont() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsProxyWidget * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#addWidget">addWidget</a></b> ( QWidget * <i>widget</i>, Qt::WindowFlags <i>wFlags</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QBrush </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#backgroundBrush-prop">backgroundBrush</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#clearFocus">clearFocus</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#collidingItems">collidingItems</a></b> ( const QGraphicsItem * <i>item</i>, Qt::ItemSelectionMode <i>mode</i> = Qt::IntersectsItemShape ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsItemGroup * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#createItemGroup">createItemGroup</a></b> ( const QList&lt;QGraphicsItem *&gt; &amp; <i>items</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#destroyItemGroup">destroyItemGroup</a></b> ( QGraphicsItemGroup * <i>group</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#focusItem">focusItem</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QFont </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#font-prop">font</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QBrush </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#foregroundBrush-prop">foregroundBrush</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#hasFocus">hasFocus</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">qreal </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#height">height</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#inputMethodQuery">inputMethodQuery</a></b> ( Qt::InputMethodQuery <i>query</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#invalidate-2">invalidate</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>, SceneLayers <i>layers</i> = AllLayers )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#isActive">isActive</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#sortCacheEnabled-prop">isSortCacheEnabled</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#itemAt">itemAt</a></b> ( const QPointF &amp; <i>position</i>, const QTransform &amp; <i>deviceTransform</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#itemAt-3">itemAt</a></b> ( qreal <i>x</i>, qreal <i>y</i>, const QTransform &amp; <i>deviceTransform</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">ItemIndexMethod </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#itemIndexMethod-prop">itemIndexMethod</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#items">items</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#items-2">items</a></b> ( Qt::SortOrder <i>order</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#items-3">items</a></b> ( const QPointF &amp; <i>pos</i>, Qt::ItemSelectionMode <i>mode</i>, Qt::SortOrder <i>order</i>, const QTransform &amp; <i>deviceTransform</i> = QTransform() ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#items-7">items</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i>, Qt::ItemSelectionMode <i>mode</i>, Qt::SortOrder <i>order</i>, const QTransform &amp; <i>deviceTransform</i> = QTransform() ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#items-10">items</a></b> ( const QRectF &amp; <i>rect</i>, Qt::ItemSelectionMode <i>mode</i>, Qt::SortOrder <i>order</i>, const QTransform &amp; <i>deviceTransform</i> = QTransform() ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#items-11">items</a></b> ( const QPolygonF &amp; <i>polygon</i>, Qt::ItemSelectionMode <i>mode</i>, Qt::SortOrder <i>order</i>, const QTransform &amp; <i>deviceTransform</i> = QTransform() ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#items-12">items</a></b> ( const QPainterPath &amp; <i>path</i>, Qt::ItemSelectionMode <i>mode</i>, Qt::SortOrder <i>order</i>, const QTransform &amp; <i>deviceTransform</i> = QTransform() ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QRectF </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#itemsBoundingRect">itemsBoundingRect</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QGraphicsItem * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#mouseGrabberItem">mouseGrabberItem</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QPalette </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#palette-prop">palette</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#removeItem">removeItem</a></b> ( QGraphicsItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#render">render</a></b> ( QPainter * <i>painter</i>, const QRectF &amp; <i>target</i> = QRectF(), const QRectF &amp; <i>source</i> = QRectF(), Qt::AspectRatioMode <i>aspectRatioMode</i> = Qt::KeepAspectRatio )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QRectF </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#selectedItems">selectedItems</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QPainterPath </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#selectionArea">selectionArea</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#sendEvent">sendEvent</a></b> ( QGraphicsItem * <i>item</i>, QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#setActivePanel">setActivePanel</a></b> ( QGraphicsItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#setActiveWindow">setActiveWindow</a></b> ( QGraphicsWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#backgroundBrush-prop">setBackgroundBrush</a></b> ( const QBrush &amp; <i>brush</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#bspTreeDepth-prop">setBspTreeDepth</a></b> ( int <i>depth</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#setFocus">setFocus</a></b> ( Qt::FocusReason <i>focusReason</i> = Qt::OtherFocusReason )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#setFocusItem">setFocusItem</a></b> ( QGraphicsItem * <i>item</i>, Qt::FocusReason <i>focusReason</i> = Qt::OtherFocusReason )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#font-prop">setFont</a></b> ( const QFont &amp; <i>font</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#foregroundBrush-prop">setForegroundBrush</a></b> ( const QBrush &amp; <i>brush</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#itemIndexMethod-prop">setItemIndexMethod</a></b> ( ItemIndexMethod <i>method</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#palette-prop">setPalette</a></b> ( const QPalette &amp; <i>palette</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#sceneRect-prop">setSceneRect</a></b> ( const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#sceneRect-prop">setSceneRect</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a></b> ( const QPainterPath &amp; <i>path</i>, const QTransform &amp; <i>deviceTransform</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#setSelectionArea-4">setSelectionArea</a></b> ( const QPainterPath &amp; <i>path</i>, Qt::ItemSelectionMode <i>mode</i>, const QTransform &amp; <i>deviceTransform</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#sortCacheEnabled-prop">setSortCacheEnabled</a></b> ( bool <i>enabled</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#stickyFocus-prop">setStickyFocus</a></b> ( bool <i>enabled</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#setStyle">setStyle</a></b> ( QStyle * <i>style</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#stickyFocus-prop">stickyFocus</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QStyle * </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#style">style</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#update-2">update</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QGraphicsView *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#views">views</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">qreal </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#width">width</a></b> () const</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<hr />
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#advance">advance</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#clearSelection">clearSelection</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#invalidate">invalidate</a></b> ( const QRectF &amp; <i>rect</i> = QRectF(), SceneLayers <i>layers</i> = AllLayers )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#update">update</a></b> ( const QRectF &amp; <i>rect</i> = QRectF() )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<hr />
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#changed">changed</a></b> ( const QList&lt;QRectF&gt; &amp; <i>region</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#sceneRectChanged">sceneRectChanged</a></b> ( const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#selectionChanged">selectionChanged</a></b> ()</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<hr />
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#contextMenuEvent">contextMenuEvent</a></b> ( QGraphicsSceneContextMenuEvent * <i>contextMenuEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#dragEnterEvent">dragEnterEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#dragLeaveEvent">dragLeaveEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#dragMoveEvent">dragMoveEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#drawBackground">drawBackground</a></b> ( QPainter * <i>painter</i>, const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#drawForeground">drawForeground</a></b> ( QPainter * <i>painter</i>, const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#dropEvent">dropEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#focusInEvent">focusInEvent</a></b> ( QFocusEvent * <i>focusEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#focusOutEvent">focusOutEvent</a></b> ( QFocusEvent * <i>focusEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#helpEvent">helpEvent</a></b> ( QGraphicsSceneHelpEvent * <i>helpEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#inputMethodEvent">inputMethodEvent</a></b> ( QInputMethodEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#keyPressEvent">keyPressEvent</a></b> ( QKeyEvent * <i>keyEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#keyReleaseEvent">keyReleaseEvent</a></b> ( QKeyEvent * <i>keyEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#mouseMoveEvent">mouseMoveEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#mousePressEvent">mousePressEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#mouseReleaseEvent">mouseReleaseEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#wheelEvent">wheelEvent</a></b> ( QGraphicsSceneWheelEvent * <i>wheelEvent</i> )</td></tr>
</table>
<hr />
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#event">event</a></b> ( QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#eventFilter">eventFilter</a></b> ( QObject * <i>watched</i>, QEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<hr />
<a name="protected-slots"></a>
<h2>Protected Slots</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qgraphicsscene.html#focusNextPrevChild">focusNextPrevChild</a></b> ( bool <i>next</i> )</td></tr>
</table>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.</p>
<p>The class serves as a container for QGraphicsItems. It is used together with <a href="qgraphicsview.html">QGraphicsView</a> for visualizing graphical items, such as lines, rectangles, text, or even custom items, on a 2D surface. QGraphicsScene is part of <a href="graphicsview.html">The Graphics View Framework</a>.</p>
<p>QGraphicsScene also provides functionality that lets you efficiently determine both the location of items, and for determining what items are visible within an arbitrary area on the scene. With the <a href="qgraphicsview.html">QGraphicsView</a> widget, you can either visualize the whole scene, or zoom in and view only parts of the scene.</p>
<p>Example:</p>
<pre> QGraphicsScene scene;
 scene.addText(&quot;Hello, world!&quot;);

 QGraphicsView view(&amp;scene);
 view.show();</pre>
<p>Note that QGraphicsScene has no visual appearance of its own; it only manages the items. You need to create a <a href="qgraphicsview.html">QGraphicsView</a> widget to visualize the scene.</p>
<p>To add items to a scene, you start off by constructing a QGraphicsScene object. Then, you have two options: either add your existing <a href="qgraphicsitem.html">QGraphicsItem</a> objects by calling <a href="qgraphicsscene.html#addItem">addItem</a>(), or you can call one of the convenience functions <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPath">addPath</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addPolygon">addPolygon</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), or <a href="qgraphicsscene.html#addText">addText</a>(), which all return a pointer to the newly added item. The dimensions of the items added with these functions are relative to the item's coordinate system, and the items position is initialized to (0, 0) in the scene.</p>
<p>You can then visualize the scene using <a href="qgraphicsview.html">QGraphicsView</a>. When the scene changes, (e.g&#x2e;, when an item moves or is transformed) QGraphicsScene emits the <a href="qgraphicsscene.html#changed">changed</a>() signal. To remove an item, call <a href="qgraphicsscene.html#removeItem">removeItem</a>().</p>
<p>QGraphicsScene uses an indexing algorithm to manage the location of items efficiently. By default, a BSP (Binary Space Partitioning) tree is used; an algorithm suitable for large scenes where most items remain static (i.e&#x2e;, do not move around). You can choose to disable this index by calling <a href="qgraphicsscene.html#itemIndexMethod-prop">setItemIndexMethod</a>(). For more information about the available indexing algorithms, see the <a href="qgraphicsscene.html#itemIndexMethod-prop">itemIndexMethod</a> property.</p>
<p>The scene's bounding rect is set by calling <a href="qgraphicsscene.html#sceneRect-prop">setSceneRect</a>(). Items can be placed at any position on the scene, and the size of the scene is by default unlimited. The scene rect is used only for internal bookkeeping, maintaining the scene's item index. If the scene rect is unset, QGraphicsScene will use the bounding area of all items, as returned by <a href="qgraphicsscene.html#itemsBoundingRect">itemsBoundingRect</a>(), as the scene rect. However, <a href="qgraphicsscene.html#itemsBoundingRect">itemsBoundingRect</a>() is a relatively time consuming function, as it operates by collecting positional information for every item on the scene. Because of this, you should always set the scene rect when operating on large scenes.</p>
<p>One of QGraphicsScene's greatest strengths is its ability to efficiently determine the location of items. Even with millions of items on the scene, the <a href="qgraphicsscene.html#items">items</a>() functions can determine the location of an item within few milliseconds. There are several overloads to <a href="qgraphicsscene.html#items">items</a>(): one that finds items at a certain position, one that finds items inside or intersecting with a polygon or a rectangle, and more. The list of returned items is sorted by stacking order, with the topmost item being the first item in the list. For convenience, there is also an <a href="qgraphicsscene.html#itemAt">itemAt</a>() function that returns the topmost item at a given position.</p>
<p>QGraphicsScene maintains selection information for the scene. To select items, call <a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>(), and to clear the current selection, call <a href="qgraphicsscene.html#clearSelection">clearSelection</a>(). Call <a href="qgraphicsscene.html#selectedItems">selectedItems</a>() to get the list of all selected items.</p>
<a name="event-handling-and-propagation"></a>
<h3>Event Handling and Propagation</h3>
<p>Another responsibility that QGraphicsScene has, is to propagate events from <a href="qgraphicsview.html">QGraphicsView</a>. To send an event to a scene, you construct an event that inherits <a href="qevent.html">QEvent</a>, and then send it using, for example, <a href="qcoreapplication.html#sendEvent">QApplication::sendEvent</a>(). <a href="qgraphicsscene.html#event">event</a>() is responsible for dispatching the event to the individual items. Some common events are handled by convenience event handlers. For example, key press events are handled by <a href="qgraphicsscene.html#keyPressEvent">keyPressEvent</a>(), and mouse press events are handled by <a href="qgraphicsscene.html#mousePressEvent">mousePressEvent</a>().</p>
<p>Key events are delivered to the <i>focus item</i>. To set the focus item, you can either call <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>(), passing an item that accepts focus, or the item itself can call <a href="qgraphicsitem.html#setFocus">QGraphicsItem::setFocus</a>(). Call <a href="qgraphicsscene.html#focusItem">focusItem</a>() to get the current focus item. For compatibility with widgets, the scene also maintains its own focus information. By default, the scene does not have focus, and all key events are discarded. If <a href="qgraphicsscene.html#setFocus">setFocus</a>() is called, or if an item on the scene gains focus, the scene automatically gains focus. If the scene has focus, <a href="qgraphicsscene.html#hasFocus">hasFocus</a>() will return true, and key events will be forwarded to the focus item, if any. If the scene loses focus, (i.e&#x2e;, someone calls <a href="qgraphicsscene.html#clearFocus">clearFocus</a>(),) while an item has focus, the scene will maintain its item focus information, and once the scene regains focus, it will make sure the last focus item regains focus.</p>
<p>For mouse-over effects, QGraphicsScene dispatches <i>hover events</i>. If an item accepts hover events (see <a href="qgraphicsitem.html#acceptHoverEvents">QGraphicsItem::acceptHoverEvents</a>()), it will receive a <a href="qevent.html#Type-enum">GraphicsSceneHoverEnter</a> event when the mouse enters its area. As the mouse continues moving inside the item's area, QGraphicsScene will send it <a href="qevent.html#Type-enum">GraphicsSceneHoverMove</a> events. When the mouse leaves the item's area, the item will receive a <a href="qevent.html#Type-enum">GraphicsSceneHoverLeave</a> event.</p>
<p>All mouse events are delivered to the current <i>mouse grabber</i> item. An item becomes the scene's mouse grabber if it accepts mouse events (see <a href="qgraphicsitem.html#acceptedMouseButtons">QGraphicsItem::acceptedMouseButtons</a>()) and it receives a mouse press. It stays the mouse grabber until it receives a mouse release when no other mouse buttons are pressed. You can call <a href="qgraphicsscene.html#mouseGrabberItem">mouseGrabberItem</a>() to determine what item is currently grabbing the mouse.</p>
<p>See also <a href="qgraphicsitem.html">QGraphicsItem</a> and <a href="qgraphicsview.html">QGraphicsView</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<a name="//apple_ref/cpp/tag/QGraphicsScene/ItemIndexMethod"></a>
<a name="//apple_ref/cpp/econst/QGraphicsScene/BspTreeIndex"></a>
<a name="//apple_ref/cpp/econst/QGraphicsScene/NoIndex"></a>
<h3 class="fn"><a name="ItemIndexMethod-enum"></a>enum QGraphicsScene::ItemIndexMethod</h3>
<p>This enum describes the indexing algorithms <a href="qgraphicsscene.html">QGraphicsScene</a> provides for managing positional information about items on the scene.</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QGraphicsScene::BspTreeIndex</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">A Binary Space Partitioning tree is applied. All <a href="qgraphicsscene.html">QGraphicsScene</a>'s item location algorithms are of an order close to logarithmic complexity, by making use of binary search. Adding, moving and removing items is logarithmic. This approach is best for static scenes (i.e&#x2e;, scenes where most items do not move).</td></tr>
<tr><td valign="top"><tt>QGraphicsScene::NoIndex</tt></td><td align="center" valign="top"><tt>-1</tt></td><td valign="top">No index is applied. Item location is of linear complexity, as all items on the scene are searched. Adding, moving and removing items, however, is done in constant time. This approach is ideal for dynamic scenes, where many items are added, moved or removed continuously.</td></tr>
</table></p>
<p>See also <a href="qgraphicsscene.html#itemIndexMethod-prop">setItemIndexMethod</a>() and <a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a>.</p>
<a name="//apple_ref/cpp/tag/QGraphicsScene/SceneLayer"></a>
<a name="//apple_ref/cpp/econst/QGraphicsScene/ItemLayer"></a>
<a name="//apple_ref/cpp/econst/QGraphicsScene/BackgroundLayer"></a>
<a name="//apple_ref/cpp/econst/QGraphicsScene/ForegroundLayer"></a>
<a name="//apple_ref/cpp/econst/QGraphicsScene/AllLayers"></a>
<a name="//apple_ref/cpp/tdef/QGraphicsScene/SceneLayers"></a>
<h3 class="flags"><a name="SceneLayer-enum"></a>enum QGraphicsScene::SceneLayer<br />flags QGraphicsScene::SceneLayers</h3>
<p>This enum describes the rendering layers in a <a href="qgraphicsscene.html">QGraphicsScene</a>. When <a href="qgraphicsscene.html">QGraphicsScene</a> draws the scene contents, it renders each of these layers separately, in order.</p>
<p>Each layer represents a flag that can be OR'ed together when calling functions such as <a href="qgraphicsscene.html#invalidate">invalidate</a>() or <a href="qgraphicsview.html#invalidateScene">QGraphicsView::invalidateScene</a>().</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QGraphicsScene::ItemLayer</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">The item layer. <a href="qgraphicsscene.html">QGraphicsScene</a> renders all items are in this layer by calling the virtual function <a href="qgraphicsscene-obsolete.html#drawItems" class="obsolete">drawItems</a>(). The item layer is drawn after the background layer, but before the foreground layer.</td></tr>
<tr><td valign="top"><tt>QGraphicsScene::BackgroundLayer</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">The background layer. <a href="qgraphicsscene.html">QGraphicsScene</a> renders the scene's background in this layer by calling the virtual function <a href="qgraphicsscene.html#drawBackground">drawBackground</a>(). The background layer is drawn first of all layers.</td></tr>
<tr><td valign="top"><tt>QGraphicsScene::ForegroundLayer</tt></td><td align="center" valign="top"><tt>0x4</tt></td><td valign="top">The foreground layer. <a href="qgraphicsscene.html">QGraphicsScene</a> renders the scene's foreground in this layer by calling the virtual function <a href="qgraphicsscene.html#drawForeground">drawForeground</a>(). The foreground layer is drawn last of all layers.</td></tr>
<tr><td valign="top"><tt>QGraphicsScene::AllLayers</tt></td><td align="center" valign="top"><tt>0xffff</tt></td><td valign="top">All layers; this value represents a combination of all three layers.</td></tr>
</table></p>
<p>This enum was introduced in Qt 4.3.</p>
<p>The SceneLayers type is a typedef for <a href="qflags.html">QFlags</a>&lt;SceneLayer&gt;. It stores an OR combination of SceneLayer values.</p>
<p>See also <a href="qgraphicsscene.html#invalidate">invalidate</a>() and <a href="qgraphicsview.html#invalidateScene">QGraphicsView::invalidateScene</a>().</p>
<hr />
<h2>Property Documentation</h2>
<a name="//apple_ref/cpp/instm/QGraphicsScene/backgroundBrush"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setBackgroundBrush"></a>
<h3 class="fn"><a name="backgroundBrush-prop"></a>backgroundBrush : <a href="qbrush.html">QBrush</a></h3>
<p>This property holds the background brush of the scene.</p>
<p>Set this property to changes the scene's background to a different color, gradient or texture. The default background brush is <a href="qt.html#BrushStyle-enum">Qt::NoBrush</a>. The background is drawn before (behind) the items.</p>
<p>Example:</p>
<pre> QGraphicsScene scene;
 QGraphicsView view(&amp;scene);
 view.show();

<span class="comment"> // a blue background</span>
 scene.setBackgroundBrush(Qt::blue);

<span class="comment"> // a gradient background</span>
 QRadialGradient gradient(0, 0, 10);
 gradient.setSpread(QGradient::RepeatSpread);
 scene.setBackgroundBrush(gradient);</pre>
<p><a href="qgraphicsscene.html#render">QGraphicsScene::render</a>() calls <a href="qgraphicsscene.html#drawBackground">drawBackground</a>() to draw the scene background. For more detailed control over how the background is drawn, you can reimplement <a href="qgraphicsscene.html#drawBackground">drawBackground</a>() in a subclass of <a href="qgraphicsscene.html">QGraphicsScene</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QBrush </td><td class="memItemRight" valign="bottom"><b>backgroundBrush</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setBackgroundBrush</b> ( const QBrush &amp; <i>brush</i> )</td></tr>
</table>
<a name="//apple_ref/cpp/instm/QGraphicsScene/bspTreeDepth"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setBspTreeDepth"></a>
<h3 class="fn"><a name="bspTreeDepth-prop"></a>bspTreeDepth : int</h3>
<p>This property holds the depth of QGraphicsScene's BSP index tree.</p>
<p>This property has no effect when <a href="qgraphicsscene.html#ItemIndexMethod-enum">NoIndex</a> is used.</p>
<p>This value determines the depth of <a href="qgraphicsscene.html">QGraphicsScene</a>'s BSP tree. The depth directly affects <a href="qgraphicsscene.html">QGraphicsScene</a>'s performance and memory usage; the latter growing exponentially with the depth of the tree. With an optimal tree depth, <a href="qgraphicsscene.html">QGraphicsScene</a> can instantly determine the locality of items, even for scenes with thousands or millions of items. This also greatly improves rendering performance.</p>
<p>By default, the value is 0, in which case Qt will guess a reasonable default depth based on the size, location and number of items in the scene. If these parameters change frequently, however, you may experience slowdowns as <a href="qgraphicsscene.html">QGraphicsScene</a> retunes the depth internally. You can avoid potential slowdowns by fixating the tree depth through setting this property.</p>
<p>The depth of the tree and the size of the scene rectangle decide the granularity of the scene's partitioning. The size of each scene segment is determined by the following algorithm:</p>
<pre> QSizeF segmentSize = sceneRect().size() / pow(2, depth - 1);</pre>
<p>The BSP tree has an optimal size when each segment contains between 0 and 10 items.</p>
<p>This property was introduced in Qt 4.3.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b>bspTreeDepth</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setBspTreeDepth</b> ( int <i>depth</i> )</td></tr>
</table>
<p>See also <a href="qgraphicsscene.html#itemIndexMethod-prop">itemIndexMethod</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/font"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setFont"></a>
<h3 class="fn"><a name="font-prop"></a>font : <a href="qfont.html">QFont</a></h3>
<p>This property holds the scene's default font.</p>
<p>This property provides the scene's font. The scene font defaults to, and resolves all its entries from, QApplication::font.</p>
<p>If the scene's font changes, either directly through setFont() or indirectly when the application font changes, <a href="qgraphicsscene.html">QGraphicsScene</a> first sends itself a <a href="qevent.html#Type-enum">FontChange</a> event, and it then sends <a href="qevent.html#Type-enum">FontChange</a> events to all top-level widget items in the scene. These items respond by resolving their own fonts to the scene, and they then notify their children, who again notify their children, and so on, until all widget items have updated their fonts.</p>
<p>Changing the scene font, (directly or indirectly through <a href="qapplication.html#setFont">QApplication::setFont</a>(),) automatically schedules a redraw the entire scene.</p>
<p>This property was introduced in Qt 4.4.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QFont </td><td class="memItemRight" valign="bottom"><b>font</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setFont</b> ( const QFont &amp; <i>font</i> )</td></tr>
</table>
<p>See also <a href="qwidget.html#font-prop">QWidget::font</a>, <a href="qapplication.html#setFont">QApplication::setFont</a>(), <a href="qgraphicsscene.html#palette-prop">palette</a>, and <a href="qgraphicsscene.html#style">style</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/foregroundBrush"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setForegroundBrush"></a>
<h3 class="fn"><a name="foregroundBrush-prop"></a>foregroundBrush : <a href="qbrush.html">QBrush</a></h3>
<p>This property holds the foreground brush of the scene.</p>
<p>Change this property to set the scene's foreground to a different color, gradient or texture.</p>
<p>The foreground is drawn after (on top of) the items. The default foreground brush is <a href="qt.html#BrushStyle-enum">Qt::NoBrush</a> ( i.e&#x2e; the foreground is not drawn).</p>
<p>Example:</p>
<pre> QGraphicsScene scene;
 QGraphicsView view(&amp;scene);
 view.show();

<span class="comment"> // a white semi-transparent foreground</span>
 scene.setForegroundBrush(QColor(255, 255, 255, 127));

<span class="comment"> // a grid foreground</span>
 scene.setForegroundBrush(QBrush(Qt::lightGray, Qt::CrossPattern));</pre>
<p><a href="qgraphicsscene.html#render">QGraphicsScene::render</a>() calls <a href="qgraphicsscene.html#drawForeground">drawForeground</a>() to draw the scene foreground. For more detailed control over how the foreground is drawn, you can reimplement the <a href="qgraphicsscene.html#drawForeground">drawForeground</a>() function in a <a href="qgraphicsscene.html">QGraphicsScene</a> subclass.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QBrush </td><td class="memItemRight" valign="bottom"><b>foregroundBrush</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setForegroundBrush</b> ( const QBrush &amp; <i>brush</i> )</td></tr>
</table>
<a name="//apple_ref/cpp/instm/QGraphicsScene/itemIndexMethod"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setItemIndexMethod"></a>
<h3 class="fn"><a name="itemIndexMethod-prop"></a>itemIndexMethod : <a href="qgraphicsscene.html#ItemIndexMethod-enum">ItemIndexMethod</a></h3>
<p>This property holds the item indexing method.</p>
<p><a href="qgraphicsscene.html">QGraphicsScene</a> applies an indexing algorithm to the scene, to speed up item discovery functions like <a href="qgraphicsscene.html#items">items</a>() and <a href="qgraphicsscene.html#itemAt">itemAt</a>(). Indexing is most efficient for static scenes (i.e&#x2e;, where items don't move around). For dynamic scenes, or scenes with many animated items, the index bookkeeping can outweight the fast lookup speeds.</p>
<p>For the common case, the default index method <a href="qgraphicsscene.html#ItemIndexMethod-enum">BspTreeIndex</a> works fine. If your scene uses many animations and you are experiencing slowness, you can disable indexing by calling <tt>setItemIndexMethod(NoIndex)</tt>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">ItemIndexMethod </td><td class="memItemRight" valign="bottom"><b>itemIndexMethod</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setItemIndexMethod</b> ( ItemIndexMethod <i>method</i> )</td></tr>
</table>
<p>See also <a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/palette"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setPalette"></a>
<h3 class="fn"><a name="palette-prop"></a>palette : <a href="qpalette.html">QPalette</a></h3>
<p>This property holds the scene's default palette.</p>
<p>This property provides the scene's palette. The scene palette defaults to, and resolves all its entries from, QApplication::palette.</p>
<p>If the scene's palette changes, either directly through setPalette() or indirectly when the application palette changes, <a href="qgraphicsscene.html">QGraphicsScene</a> first sends itself a <a href="qevent.html#Type-enum">PaletteChange</a> event, and it then sends <a href="qevent.html#Type-enum">PaletteChange</a> events to all top-level widget items in the scene. These items respond by resolving their own palettes to the scene, and they then notify their children, who again notify their children, and so on, until all widget items have updated their palettes.</p>
<p>Changing the scene palette, (directly or indirectly through <a href="qapplication.html#setPalette">QApplication::setPalette</a>(),) automatically schedules a redraw the entire scene.</p>
<p>This property was introduced in Qt 4.4.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QPalette </td><td class="memItemRight" valign="bottom"><b>palette</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setPalette</b> ( const QPalette &amp; <i>palette</i> )</td></tr>
</table>
<p>See also <a href="qwidget.html#palette-prop">QWidget::palette</a>, <a href="qapplication.html#setPalette">QApplication::setPalette</a>(), <a href="qgraphicsscene.html#font-prop">font</a>, and <a href="qgraphicsscene.html#style">style</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/sceneRect"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setSceneRect"></a>
<h3 class="fn"><a name="sceneRect-prop"></a>sceneRect : <a href="qrectf.html">QRectF</a></h3>
<p>This property holds the scene rectangle; the bounding rectangle of the scene.</p>
<p>The scene rectangle defines the extent of the scene. It is primarily used by <a href="qgraphicsview.html">QGraphicsView</a> to determine the view's default scrollable area, and by <a href="qgraphicsscene.html">QGraphicsScene</a> to manage item indexing.</p>
<p>If unset, or if set to a null <a href="qrectf.html">QRectF</a>, sceneRect() will return the largest bounding rect of all items on the scene since the scene was created (i.e&#x2e;, a rectangle that grows when items are added to or moved in the scene, but never shrinks).</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QRectF </td><td class="memItemRight" valign="bottom"><b>sceneRect</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setSceneRect</b> ( const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setSceneRect</b> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i> )</td></tr>
</table>
<p>See also <a href="qgraphicsscene.html#width">width</a>(), <a href="qgraphicsscene.html#height">height</a>(), and <a href="qgraphicsview.html#sceneRect-prop">QGraphicsView::sceneRect</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/stickyFocus"></a>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setStickyFocus"></a>
<h3 class="fn"><a name="stickyFocus-prop"></a>stickyFocus : bool</h3>
<p>This property holds whether clicking into the scene background will clear focus.</p>
<p>In a <a href="qgraphicsscene.html">QGraphicsScene</a> with stickyFocus set to true, focus will remain unchanged when the user clicks into the scene background or on an item that does not accept focus. Otherwise, focus will be cleared.</p>
<p>By default, this property is false.</p>
<p>Focus changes in response to a mouse press. You can reimplement <a href="qgraphicsscene.html#mousePressEvent">mousePressEvent</a>() in a subclass of <a href="qgraphicsscene.html">QGraphicsScene</a> to toggle this property based on where the user has clicked.</p>
<p>This property was introduced in Qt 4.6.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b>stickyFocus</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setStickyFocus</b> ( bool <i>enabled</i> )</td></tr>
</table>
<p>See also <a href="qgraphicsscene.html#clearFocus">clearFocus</a>() and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QGraphicsScene/QGraphicsScene"></a>
<h3 class="fn"><a name="QGraphicsScene"></a>QGraphicsScene::QGraphicsScene ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qgraphicsscene.html">QGraphicsScene</a> object. The <i>parent</i> parameter is passed to <a href="qobject.html">QObject</a>'s constructor.</p>
<h3 class="fn"><a name="QGraphicsScene-2"></a>QGraphicsScene::QGraphicsScene ( const <a href="qrectf.html">QRectF</a> &amp; <i>sceneRect</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qgraphicsscene.html">QGraphicsScene</a> object, using <i>sceneRect</i> for its scene rectangle. The <i>parent</i> parameter is passed to <a href="qobject.html">QObject</a>'s constructor.</p>
<p>See also <a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>.</p>
<h3 class="fn"><a name="QGraphicsScene-3"></a>QGraphicsScene::QGraphicsScene ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>width</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>height</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qgraphicsscene.html">QGraphicsScene</a> object, using the rectangle specified by (<i>x</i>, <i>y</i>), and the given <i>width</i> and <i>height</i> for its scene rectangle. The <i>parent</i> parameter is passed to <a href="qobject.html">QObject</a>'s constructor.</p>
<p>See also <a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/~QGraphicsScene"></a>
<h3 class="fn"><a name="dtor.QGraphicsScene"></a>QGraphicsScene::~QGraphicsScene ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Removes and deletes all items from the scene object before destroying the scene object. The scene object is removed from the application's global scene list, and it is removed from all associated views.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/activePanel"></a>
<h3 class="fn"><a name="activePanel"></a><a href="qgraphicsitem.html">QGraphicsItem</a> * QGraphicsScene::activePanel () const</h3>
<p>Returns the current active panel, or 0 if no panel is currently active.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#setActivePanel">QGraphicsScene::setActivePanel</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/activeWindow"></a>
<h3 class="fn"><a name="activeWindow"></a><a href="qgraphicswidget.html">QGraphicsWidget</a> * QGraphicsScene::activeWindow () const</h3>
<p>Returns the current active window, or 0 if no window is currently active.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qgraphicsscene.html#setActiveWindow">QGraphicsScene::setActiveWindow</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addEllipse"></a>
<h3 class="fn"><a name="addEllipse"></a><a href="qgraphicsellipseitem.html">QGraphicsEllipseItem</a> * QGraphicsScene::addEllipse ( const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen(), const <a href="qbrush.html">QBrush</a> &amp; <i>brush</i> = QBrush() )</h3>
<p>Creates and adds an ellipse item to the scene, and returns the item pointer. The geometry of the ellipse is defined by <i>rect</i>, and its pen and brush are initialized to <i>pen</i> and <i>brush</i>.</p>
<p>Note that the item's geometry is provided in item coordinates, and its position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPath">addPath</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<h3 class="fn"><a name="addEllipse-2"></a><a href="qgraphicsellipseitem.html">QGraphicsEllipseItem</a> * QGraphicsScene::addEllipse ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>w</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>h</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen(), const <a href="qbrush.html">QBrush</a> &amp; <i>brush</i> = QBrush() )</h3>
<p>This convenience function is equivalent to calling addEllipse(<a href="qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>), <i>pen</i>, <i>brush</i>).</p>
<p>This function was introduced in Qt 4.3.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addItem"></a>
<h3 class="fn"><a name="addItem"></a>void QGraphicsScene::addItem ( <a href="qgraphicsitem.html">QGraphicsItem</a> * <i>item</i> )</h3>
<p>Adds or moves the <i>item</i> and all its childen to this scene. This scene takes ownership of the <i>item</i>.</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>If the item is already in a different scene, it will first be removed from its old scene, and then added to this scene as a top-level.</p>
<p><a href="qgraphicsscene.html">QGraphicsScene</a> will send ItemSceneChange notifications to <i>item</i> while it is added to the scene. If item does not currently belong to a scene, only one notification is sent. If it does belong to scene already (i.e&#x2e;, it is moved to this scene), <a href="qgraphicsscene.html">QGraphicsScene</a> will send an addition notification as the item is removed from its previous scene.</p>
<p>If the item is a panel, the scene is active, and there is no active panel in the scene, then the item will be activated.</p>
<p>See also <a href="qgraphicsscene.html#removeItem">removeItem</a>(), <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPath">addPath</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addWidget">addWidget</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addLine"></a>
<h3 class="fn"><a name="addLine"></a><a href="qgraphicslineitem.html">QGraphicsLineItem</a> * QGraphicsScene::addLine ( const <a href="qlinef.html">QLineF</a> &amp; <i>line</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen() )</h3>
<p>Creates and adds a line item to the scene, and returns the item pointer. The geometry of the line is defined by <i>line</i>, and its pen is initialized to <i>pen</i>.</p>
<p>Note that the item's geometry is provided in item coordinates, and its position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addPath">addPath</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<h3 class="fn"><a name="addLine-2"></a><a href="qgraphicslineitem.html">QGraphicsLineItem</a> * QGraphicsScene::addLine ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x1</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y1</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x2</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y2</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen() )</h3>
<p>This convenience function is equivalent to calling addLine(<a href="qlinef.html">QLineF</a>(<i>x1</i>, <i>y1</i>, <i>x2</i>, <i>y2</i>), <i>pen</i>).</p>
<p>This function was introduced in Qt 4.3.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addPath"></a>
<h3 class="fn"><a name="addPath"></a><a href="qgraphicspathitem.html">QGraphicsPathItem</a> * QGraphicsScene::addPath ( const <a href="qpainterpath.html">QPainterPath</a> &amp; <i>path</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen(), const <a href="qbrush.html">QBrush</a> &amp; <i>brush</i> = QBrush() )</h3>
<p>Creates and adds a path item to the scene, and returns the item pointer. The geometry of the path is defined by <i>path</i>, and its pen and brush are initialized to <i>pen</i> and <i>brush</i>.</p>
<p>Note that the item's geometry is provided in item coordinates, and its position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addPixmap"></a>
<h3 class="fn"><a name="addPixmap"></a><a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a> * QGraphicsScene::addPixmap ( const <a href="qpixmap.html">QPixmap</a> &amp; <i>pixmap</i> )</h3>
<p>Creates and adds a pixmap item to the scene, and returns the item pointer. The pixmap is defined by <i>pixmap</i>.</p>
<p>Note that the item's geometry is provided in item coordinates, and its position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPath">addPath</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addPolygon"></a>
<h3 class="fn"><a name="addPolygon"></a><a href="qgraphicspolygonitem.html">QGraphicsPolygonItem</a> * QGraphicsScene::addPolygon ( const <a href="qpolygonf.html">QPolygonF</a> &amp; <i>polygon</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen(), const <a href="qbrush.html">QBrush</a> &amp; <i>brush</i> = QBrush() )</h3>
<p>Creates and adds a polygon item to the scene, and returns the item pointer. The polygon is defined by <i>polygon</i>, and its pen and brush are initialized to <i>pen</i> and <i>brush</i>.</p>
<p>Note that the item's geometry is provided in item coordinates, and its position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPath">addPath</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addRect"></a>
<h3 class="fn"><a name="addRect"></a><a href="qgraphicsrectitem.html">QGraphicsRectItem</a> * QGraphicsScene::addRect ( const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen(), const <a href="qbrush.html">QBrush</a> &amp; <i>brush</i> = QBrush() )</h3>
<p>Creates and adds a rectangle item to the scene, and returns the item pointer. The geometry of the rectangle is defined by <i>rect</i>, and its pen and brush are initialized to <i>pen</i> and <i>brush</i>.</p>
<p>Note that the item's geometry is provided in item coordinates, and its position is initialized to (0, 0). For example, if a <a href="qrect.html">QRect</a>(50, 50, 100, 100) is added, its top-left corner will be at (50, 50) relative to the origin in the items coordinate system.</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<h3 class="fn"><a name="addRect-2"></a><a href="qgraphicsrectitem.html">QGraphicsRectItem</a> * QGraphicsScene::addRect ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>w</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>h</i>, const <a href="qpen.html">QPen</a> &amp; <i>pen</i> = QPen(), const <a href="qbrush.html">QBrush</a> &amp; <i>brush</i> = QBrush() )</h3>
<p>This convenience function is equivalent to calling addRect(<a href="qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>), <i>pen</i>, <i>brush</i>).</p>
<p>This function was introduced in Qt 4.3.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addSimpleText"></a>
<h3 class="fn"><a name="addSimpleText"></a><a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a> * QGraphicsScene::addSimpleText ( const <a href="qstring.html">QString</a> &amp; <i>text</i>, const <a href="qfont.html">QFont</a> &amp; <i>font</i> = QFont() )</h3>
<p>Creates and adds a <a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a> to the scene, and returns the item pointer. The text string is initialized to <i>text</i>, and its font is initialized to <i>font</i>.</p>
<p>The item's position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addText"></a>
<h3 class="fn"><a name="addText"></a><a href="qgraphicstextitem.html">QGraphicsTextItem</a> * QGraphicsScene::addText ( const <a href="qstring.html">QString</a> &amp; <i>text</i>, const <a href="qfont.html">QFont</a> &amp; <i>font</i> = QFont() )</h3>
<p>Creates and adds a text item to the scene, and returns the item pointer. The text string is initialized to <i>text</i>, and its font is initialized to <i>font</i>.</p>
<p>The item's position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addItem">addItem</a>(), and <a href="qgraphicsscene.html#addWidget">addWidget</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/addWidget"></a>
<h3 class="fn"><a name="addWidget"></a><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a> * QGraphicsScene::addWidget ( <a href="qwidget.html">QWidget</a> * <i>widget</i>, <a href="qt.html#WindowType-enum">Qt::WindowFlags</a> <i>wFlags</i> = 0 )</h3>
<p>Creates a new <a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a> for <i>widget</i>, adds it to the scene, and returns a pointer to the proxy. <i>wFlags</i> set the default window flags for the embedding proxy widget.</p>
<p>The item's position is initialized to (0, 0).</p>
<p>If the item is visible (i.e&#x2e;, <a href="qgraphicsitem.html#isVisible">QGraphicsItem::isVisible</a>() returns true), <a href="qgraphicsscene.html">QGraphicsScene</a> will emit <a href="qgraphicsscene.html#changed">changed</a>() once control goes back to the event loop.</p>
<p>Note that widgets with the <a href="qt.html#WidgetAttribute-enum">Qt::WA_PaintOnScreen</a> widget attribute set and widgets that wrap an external application or controller are not supported. Examples are <a href="qglwidget.html">QGLWidget</a> and <a href="qaxwidget.html">QAxWidget</a>.</p>
<p>See also <a href="qgraphicsscene.html#addEllipse">addEllipse</a>(), <a href="qgraphicsscene.html#addLine">addLine</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addPixmap">addPixmap</a>(), <a href="qgraphicsscene.html#addRect">addRect</a>(), <a href="qgraphicsscene.html#addText">addText</a>(), <a href="qgraphicsscene.html#addSimpleText">addSimpleText</a>(), and <a href="qgraphicsscene.html#addItem">addItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/advance"></a>
<h3 class="fn"><a name="advance"></a>void QGraphicsScene::advance ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>This slot <i>advances</i> the scene by one step, by calling <a href="qgraphicsitem.html#advance">QGraphicsItem::advance</a>() for all items on the scene. This is done in two phases: in the first phase, all items are notified that the scene is about to change, and in the second phase all items are notified that they can move. In the first phase, <a href="qgraphicsitem.html#advance">QGraphicsItem::advance</a>() is called passing a value of 0 as an argument, and 1 is passed in the second phase.</p>
<p>See also <a href="qgraphicsitem.html#advance">QGraphicsItem::advance</a>(), <a href="qgraphicsitemanimation.html">QGraphicsItemAnimation</a>, and <a href="qtimeline.html">QTimeLine</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/changed"></a>
<h3 class="fn"><a name="changed"></a>void QGraphicsScene::changed ( const <a href="qlist.html">QList</a>&lt;<a href="qrectf.html">QRectF</a>&gt; &amp; <i>region</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted by <a href="qgraphicsscene.html">QGraphicsScene</a> when control reaches the event loop, if the scene content changes. The <i>region</i> parameter contains a list of scene rectangles that indicate the area that has been changed.</p>
<p>See also <a href="qgraphicsview.html#updateScene">QGraphicsView::updateScene</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/clear"></a>
<h3 class="fn"><a name="clear"></a>void QGraphicsScene::clear ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Removes and deletes all items from the scene, but otherwise leaves the state of the scene unchanged.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qgraphicsscene.html#addItem">addItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/clearFocus"></a>
<h3 class="fn"><a name="clearFocus"></a>void QGraphicsScene::clearFocus ()</h3>
<p>Clears focus from the scene. If any item has focus when this function is called, it will lose focus, and regain focus again once the scene regains focus.</p>
<p>A scene that does not have focus ignores key events.</p>
<p>See also <a href="qgraphicsscene.html#hasFocus">hasFocus</a>(), <a href="qgraphicsscene.html#setFocus">setFocus</a>(), and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/clearSelection"></a>
<h3 class="fn"><a name="clearSelection"></a>void QGraphicsScene::clearSelection ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Clears the current selection.</p>
<p>See also <a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>() and <a href="qgraphicsscene.html#selectedItems">selectedItems</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/collidingItems"></a>
<h3 class="fn"><a name="collidingItems"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::collidingItems ( const <a href="qgraphicsitem.html">QGraphicsItem</a> * <i>item</i>, <a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a> <i>mode</i> = Qt::IntersectsItemShape ) const</h3>
<p>Returns a list of all items that collide with <i>item</i>. Collisions are determined by calling <a href="qgraphicsitem.html#collidesWithItem">QGraphicsItem::collidesWithItem</a>(); the collision detection is determined by <i>mode</i>. By default, all items whose shape intersects <i>item</i> or is contained inside <i>item</i>'s shape are returned.</p>
<p>The items are returned in descending stacking order (i.e&#x2e;, the first item in the list is the uppermost item, and the last item is the lowermost item).</p>
<p>See also <a href="qgraphicsscene.html#items">items</a>(), <a href="qgraphicsscene.html#itemAt">itemAt</a>(), <a href="qgraphicsitem.html#collidesWithItem">QGraphicsItem::collidesWithItem</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/contextMenuEvent"></a>
<h3 class="fn"><a name="contextMenuEvent"></a>void QGraphicsScene::contextMenuEvent ( <a href="qgraphicsscenecontextmenuevent.html">QGraphicsSceneContextMenuEvent</a> * <i>contextMenuEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>contextMenuEvent</i>, can be reimplemented in a subclass to receive context menu events. The default implementation forwards the event to the topmost item that accepts context menu events at the position of the event. If no items accept context menu events at this position, the event is ignored.</p>
<p>See also <a href="qgraphicsitem.html#contextMenuEvent">QGraphicsItem::contextMenuEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/createItemGroup"></a>
<h3 class="fn"><a name="createItemGroup"></a><a href="qgraphicsitemgroup.html">QGraphicsItemGroup</a> * QGraphicsScene::createItemGroup ( const <a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; &amp; <i>items</i> )</h3>
<p>Groups all items in <i>items</i> into a new <a href="qgraphicsitemgroup.html">QGraphicsItemGroup</a>, and returns a pointer to the group. The group is created with the common ancestor of <i>items</i> as its parent, and with position (0, 0). The items are all reparented to the group, and their positions and transformations are mapped to the group. If <i>items</i> is empty, this function will return an empty top-level <a href="qgraphicsitemgroup.html">QGraphicsItemGroup</a>.</p>
<p><a href="qgraphicsscene.html">QGraphicsScene</a> has ownership of the group item; you do not need to delete it. To dismantle (ungroup) a group, call <a href="qgraphicsscene.html#destroyItemGroup">destroyItemGroup</a>().</p>
<p>See also <a href="qgraphicsscene.html#destroyItemGroup">destroyItemGroup</a>() and <a href="qgraphicsitemgroup.html#addToGroup">QGraphicsItemGroup::addToGroup</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/destroyItemGroup"></a>
<h3 class="fn"><a name="destroyItemGroup"></a>void QGraphicsScene::destroyItemGroup ( <a href="qgraphicsitemgroup.html">QGraphicsItemGroup</a> * <i>group</i> )</h3>
<p>Reparents all items in <i>group</i> to <i>group</i>'s parent item, then removes <i>group</i> from the scene, and finally deletes it. The items' positions and transformations are mapped from the group to the group's parent.</p>
<p>See also <a href="qgraphicsscene.html#createItemGroup">createItemGroup</a>() and <a href="qgraphicsitemgroup.html#removeFromGroup">QGraphicsItemGroup::removeFromGroup</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/dragEnterEvent"></a>
<h3 class="fn"><a name="dragEnterEvent"></a>void QGraphicsScene::dragEnterEvent ( <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>event</i>, can be reimplemented in a subclass to receive drag enter events for the scene.</p>
<p>The default implementation accepts the event and prepares the scene to accept drag move events.</p>
<p>See also <a href="qgraphicsitem.html#dragEnterEvent">QGraphicsItem::dragEnterEvent</a>(), <a href="qgraphicsscene.html#dragMoveEvent">dragMoveEvent</a>(), <a href="qgraphicsscene.html#dragLeaveEvent">dragLeaveEvent</a>(), and <a href="qgraphicsscene.html#dropEvent">dropEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/dragLeaveEvent"></a>
<h3 class="fn"><a name="dragLeaveEvent"></a>void QGraphicsScene::dragLeaveEvent ( <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>event</i>, can be reimplemented in a subclass to receive drag leave events for the scene.</p>
<p>See also <a href="qgraphicsitem.html#dragLeaveEvent">QGraphicsItem::dragLeaveEvent</a>(), <a href="qgraphicsscene.html#dragEnterEvent">dragEnterEvent</a>(), <a href="qgraphicsscene.html#dragMoveEvent">dragMoveEvent</a>(), and <a href="qgraphicsscene.html#dropEvent">dropEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/dragMoveEvent"></a>
<h3 class="fn"><a name="dragMoveEvent"></a>void QGraphicsScene::dragMoveEvent ( <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>event</i>, can be reimplemented in a subclass to receive drag move events for the scene.</p>
<p>See also <a href="qgraphicsitem.html#dragMoveEvent">QGraphicsItem::dragMoveEvent</a>(), <a href="qgraphicsscene.html#dragEnterEvent">dragEnterEvent</a>(), <a href="qgraphicsscene.html#dragLeaveEvent">dragLeaveEvent</a>(), and <a href="qgraphicsscene.html#dropEvent">dropEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/drawBackground"></a>
<h3 class="fn"><a name="drawBackground"></a>void QGraphicsScene::drawBackground ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Draws the background of the scene using <i>painter</i>, before any items and the foreground are drawn. Reimplement this function to provide a custom background for the scene.</p>
<p>All painting is done in <i>scene</i> coordinates. The <i>rect</i> parameter is the exposed rectangle.</p>
<p>If all you want is to define a color, texture, or gradient for the background, you can call <a href="qgraphicsscene.html#backgroundBrush-prop">setBackgroundBrush</a>() instead.</p>
<p>See also <a href="qgraphicsscene.html#drawForeground">drawForeground</a>() and <a href="qgraphicsscene-obsolete.html#drawItems" class="obsolete">drawItems</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/drawForeground"></a>
<h3 class="fn"><a name="drawForeground"></a>void QGraphicsScene::drawForeground ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Draws the foreground of the scene using <i>painter</i>, after the background and all items have been drawn. Reimplement this function to provide a custom foreground for the scene.</p>
<p>All painting is done in <i>scene</i> coordinates. The <i>rect</i> parameter is the exposed rectangle.</p>
<p>If all you want is to define a color, texture or gradient for the foreground, you can call <a href="qgraphicsscene.html#foregroundBrush-prop">setForegroundBrush</a>() instead.</p>
<p>See also <a href="qgraphicsscene.html#drawBackground">drawBackground</a>() and <a href="qgraphicsscene-obsolete.html#drawItems" class="obsolete">drawItems</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/dropEvent"></a>
<h3 class="fn"><a name="dropEvent"></a>void QGraphicsScene::dropEvent ( <a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>event</i>, can be reimplemented in a subclass to receive drop events for the scene.</p>
<p>See also <a href="qgraphicsitem.html#dropEvent">QGraphicsItem::dropEvent</a>(), <a href="qgraphicsscene.html#dragEnterEvent">dragEnterEvent</a>(), <a href="qgraphicsscene.html#dragMoveEvent">dragMoveEvent</a>(), and <a href="qgraphicsscene.html#dragLeaveEvent">dragLeaveEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/event"></a>
<h3 class="fn"><a name="event"></a>bool QGraphicsScene::event ( <a href="qevent.html">QEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<p>Processes the event <i>event</i>, and dispatches it to the respective event handlers.</p>
<p>In addition to calling the convenience event handlers, this function is responsible for converting mouse move events to hover events for when there is no mouse grabber item. Hover events are delivered directly to items; there is no convenience function for them.</p>
<p>Unlike <a href="qwidget.html">QWidget</a>, <a href="qgraphicsscene.html">QGraphicsScene</a> does not have the convenience functions <a href="qwidget.html#enterEvent">enterEvent()</a> and <a href="qwidget.html#leaveEvent">leaveEvent()</a>. Use this function to obtain those events instead.</p>
<p>See also <a href="qgraphicsscene.html#contextMenuEvent">contextMenuEvent</a>(), <a href="qgraphicsscene.html#keyPressEvent">keyPressEvent</a>(), <a href="qgraphicsscene.html#keyReleaseEvent">keyReleaseEvent</a>(), <a href="qgraphicsscene.html#mousePressEvent">mousePressEvent</a>(), <a href="qgraphicsscene.html#mouseMoveEvent">mouseMoveEvent</a>(), <a href="qgraphicsscene.html#mouseReleaseEvent">mouseReleaseEvent</a>(), <a href="qgraphicsscene.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a>(), <a href="qgraphicsscene.html#focusInEvent">focusInEvent</a>(), and <a href="qgraphicsscene.html#focusOutEvent">focusOutEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/eventFilter"></a>
<h3 class="fn"><a name="eventFilter"></a>bool QGraphicsScene::eventFilter ( <a href="qobject.html">QObject</a> * <i>watched</i>, <a href="qevent.html">QEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#eventFilter">QObject::eventFilter</a>().</p>
<p><a href="qgraphicsscene.html">QGraphicsScene</a> filters <a href="qapplication.html">QApplication</a>'s events to detect palette and font changes.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/focusInEvent"></a>
<h3 class="fn"><a name="focusInEvent"></a>void QGraphicsScene::focusInEvent ( <a href="qfocusevent.html">QFocusEvent</a> * <i>focusEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>focusEvent</i>, can be reimplemented in a subclass to receive focus in events.</p>
<p>The default implementation sets focus on the scene, and then on the last focus item.</p>
<p>See also <a href="qgraphicsitem.html#focusOutEvent">QGraphicsItem::focusOutEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/focusItem"></a>
<h3 class="fn"><a name="focusItem"></a><a href="qgraphicsitem.html">QGraphicsItem</a> * QGraphicsScene::focusItem () const</h3>
<p>When the scene is active, this functions returns the scene's current focus item, or 0 if no item currently has focus. When the scene is inactive, this functions returns the item that will gain input focus when the scene becomes active.</p>
<p>The focus item receives keyboard input when the scene receives a key event.</p>
<p>See also <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>(), <a href="qgraphicsitem.html#hasFocus">QGraphicsItem::hasFocus</a>(), and <a href="qgraphicsscene.html#isActive">isActive</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/focusNextPrevChild"></a>
<h3 class="fn"><a name="focusNextPrevChild"></a>bool QGraphicsScene::focusNextPrevChild ( bool <i>next</i> )&nbsp;&nbsp;<tt> [protected slot]</tt></h3>
<p>Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it cannot. If <i>next</i> is true, this function searches forward; if <i>next</i> is false, it searches backward.</p>
<p>You can reimplement this function in a subclass of <a href="qgraphicsscene.html">QGraphicsScene</a> to provide fine-grained control over how tab focus passes inside your scene. The default implementation is based on the tab focus chain defined by <a href="qgraphicswidget.html#setTabOrder">QGraphicsWidget::setTabOrder</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/focusOutEvent"></a>
<h3 class="fn"><a name="focusOutEvent"></a>void QGraphicsScene::focusOutEvent ( <a href="qfocusevent.html">QFocusEvent</a> * <i>focusEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>focusEvent</i>, can be reimplemented in a subclass to receive focus out events.</p>
<p>The default implementation removes focus from any focus item, then removes focus from the scene.</p>
<p>See also <a href="qgraphicsitem.html#focusInEvent">QGraphicsItem::focusInEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/hasFocus"></a>
<h3 class="fn"><a name="hasFocus"></a>bool QGraphicsScene::hasFocus () const</h3>
<p>Returns true if the scene has focus; otherwise returns false. If the scene has focus, it will will forward key events from <a href="qkeyevent.html">QKeyEvent</a> to any item that has focus.</p>
<p>See also <a href="qgraphicsscene.html#setFocus">setFocus</a>() and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/height"></a>
<h3 class="fn"><a name="height"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QGraphicsScene::height () const</h3>
<p>This convenience function is equivalent to calling <tt>sceneRect().height()</tt>.</p>
<p>See also <a href="qgraphicsscene.html#width">width</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/helpEvent"></a>
<h3 class="fn"><a name="helpEvent"></a>void QGraphicsScene::helpEvent ( <a href="qgraphicsscenehelpevent.html">QGraphicsSceneHelpEvent</a> * <i>helpEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>helpEvent</i>, can be reimplemented in a subclass to receive help events. The events are of type <a href="qevent.html#Type-enum">QEvent::ToolTip</a>, which are created when a tooltip is requested.</p>
<p>The default implementation shows the tooltip of the topmost item, i.e&#x2e;, the item with the highest z-value, at the mouse cursor position. If no item has a tooltip set, this function does nothing.</p>
<p>See also <a href="qgraphicsitem.html#toolTip">QGraphicsItem::toolTip</a>() and <a href="qgraphicsscenehelpevent.html">QGraphicsSceneHelpEvent</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/inputMethodEvent"></a>
<h3 class="fn"><a name="inputMethodEvent"></a>void QGraphicsScene::inputMethodEvent ( <a href="qinputmethodevent.html">QInputMethodEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>event</i>, can be reimplemented in a subclass to receive input method events for the scene.</p>
<p>The default implementation forwards the event to the <a href="qgraphicsscene.html#focusItem">focusItem</a>(). If no item currently has focus or the current focus item does not accept input methods, this function does nothing.</p>
<p>See also <a href="qgraphicsitem.html#inputMethodEvent">QGraphicsItem::inputMethodEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/inputMethodQuery"></a>
<h3 class="fn"><a name="inputMethodQuery"></a><a href="qvariant.html">QVariant</a> QGraphicsScene::inputMethodQuery ( <a href="qt.html#InputMethodQuery-enum">Qt::InputMethodQuery</a> <i>query</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>This method is used by input methods to query a set of properties of the scene to be able to support complex input method operations as support for surrounding text and reconversions.</p>
<p>The <i>query</i> parameter specifies which property is queried.</p>
<p>See also <a href="qwidget.html#inputMethodQuery">QWidget::inputMethodQuery</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/invalidate"></a>
<h3 class="fn"><a name="invalidate"></a>void QGraphicsScene::invalidate ( const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i> = QRectF(), <a href="qgraphicsscene.html#SceneLayer-enum">SceneLayers</a> <i>layers</i> = AllLayers )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Invalidates and schedules a redraw of the <i>layers</i> in <i>rect</i> on the scene. Any cached content in <i>layers</i> is unconditionally invalidated and redrawn.</p>
<p>You can use this function overload to notify <a href="qgraphicsscene.html">QGraphicsScene</a> of changes to the background or the foreground of the scene. This function is commonly used for scenes with tile-based backgrounds to notify changes when <a href="qgraphicsview.html">QGraphicsView</a> has enabled <a href="qgraphicsview.html#CacheModeFlag-enum">CacheBackground</a>.</p>
<p>Example:</p>
<pre> QRectF TileScene::rectForTile(int x, int y) const
 {
     <span class="comment">// Return the rectangle for the tile at position (x, y).</span>
     return QRectF(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
 }

 void TileScene::setTile(int x, int y, const QPixmap &amp;pixmap)
 {
     <span class="comment">// Sets or replaces the tile at position (x, y) with pixmap.</span>
     if (x &gt;= 0 &amp;&amp; x &lt; numTilesH &amp;&amp; y &gt;= 0 &amp;&amp; y &lt; numTilesV) {
         tiles[y][x] = pixmap;
         invalidate(rectForTile(x, y), BackgroundLayer);
     }
 }

 void TileScene::drawBackground(QPainter *painter, const QRectF &amp;exposed)
 {
     <span class="comment">// Draws all tiles that intersect the exposed area.</span>
     for (int y = 0; y &lt; numTilesV; ++y) {
         for (int x = 0; x &lt; numTilesH; ++x) {
             QRectF rect = rectForTile(x, y);
             if (exposed.intersects(rect))
                 painter-&gt;drawPixmap(rect.topLeft(), tiles[y][x]);
         }
     }
 }</pre>
<p>Note that <a href="qgraphicsview.html">QGraphicsView</a> currently supports background caching only (see <a href="qgraphicsview.html#CacheModeFlag-enum">QGraphicsView::CacheBackground</a>). This function is equivalent to calling <a href="qgraphicsscene.html#update">update</a>() if any layer but <a href="qgraphicsscene.html#SceneLayer-enum">BackgroundLayer</a> is passed.</p>
<p>See also <a href="qgraphicsview.html#resetCachedContent">QGraphicsView::resetCachedContent</a>().</p>
<h3 class="fn"><a name="invalidate-2"></a>void QGraphicsScene::invalidate ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>w</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>h</i>, <a href="qgraphicsscene.html#SceneLayer-enum">SceneLayers</a> <i>layers</i> = AllLayers )</h3>
<p>This is an overloaded function.</p>
<p>This convenience function is equivalent to calling invalidate(<a href="qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>), <i>layers</i>);</p>
<p>This function was introduced in Qt 4.3.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/isActive"></a>
<h3 class="fn"><a name="isActive"></a>bool QGraphicsScene::isActive () const</h3>
<p>Returns true if the scene is active (e.g&#x2e;, it's viewed by at least one <a href="qgraphicsview.html">QGraphicsView</a> that is active); otherwise returns false.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsitem.html#isActive">QGraphicsItem::isActive</a>() and <a href="qwidget.html#isActiveWindow-prop">QWidget::isActiveWindow</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/itemAt"></a>
<h3 class="fn"><a name="itemAt"></a><a href="qgraphicsitem.html">QGraphicsItem</a> * QGraphicsScene::itemAt ( const <a href="qpointf.html">QPointF</a> &amp; <i>position</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> ) const</h3>
<p>Returns the topmost visible item at the specified <i>position</i>, or 0 if there are no items at this position.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#items">items</a>(), <a href="qgraphicsscene.html#collidingItems">collidingItems</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<h3 class="fn"><a name="itemAt-3"></a><a href="qgraphicsitem.html">QGraphicsItem</a> * QGraphicsScene::itemAt ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns the topmost item at the position specified by (<i>x</i>, <i>y</i>), or 0 if there are no items at this position.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This convenience function is equivalent to calling <tt>itemAt(QPointF(x, y), deviceTransform)</tt>.</p>
<p>This function was introduced in Qt 4.6.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/items"></a>
<h3 class="fn"><a name="items"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::items () const</h3>
<p>Returns a list of all items in the scene in descending stacking order.</p>
<p>See also <a href="qgraphicsscene.html#addItem">addItem</a>(), <a href="qgraphicsscene.html#removeItem">removeItem</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<h3 class="fn"><a name="items-2"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::items ( <a href="qt.html#SortOrder-enum">Qt::SortOrder</a> <i>order</i> ) const</h3>
<p>Returns an ordered list of all items on the scene. <i>order</i> decides the stacking order.</p>
<p>See also <a href="qgraphicsscene.html#addItem">addItem</a>(), <a href="qgraphicsscene.html#removeItem">removeItem</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<h3 class="fn"><a name="items-3"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::items ( const <a href="qpointf.html">QPointF</a> &amp; <i>pos</i>, <a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a> <i>mode</i>, <a href="qt.html#SortOrder-enum">Qt::SortOrder</a> <i>order</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> = QTransform() ) const</h3>
<p>Returns all visible items that, depending on <i>mode</i>, are at the specified <i>pos</i> in a list sorted using <i>order</i>.</p>
<p>The default value for <i>mode</i> is <a href="qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose exact shape intersects with <i>pos</i> are returned.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<h3 class="fn"><a name="items-7"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::items ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>w</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>h</i>, <a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a> <i>mode</i>, <a href="qt.html#SortOrder-enum">Qt::SortOrder</a> <i>order</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> = QTransform() ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns all visible items that, depending on <i>mode</i>, are either inside or intersect with the rectangle defined by <i>x</i>, <i>y</i>, <i>w</i> and <i>h</i>, in a list sorted using <i>order</i>.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This function was introduced in Qt 4.6.</p>
<h3 class="fn"><a name="items-10"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::items ( const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i>, <a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a> <i>mode</i>, <a href="qt.html#SortOrder-enum">Qt::SortOrder</a> <i>order</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> = QTransform() ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns all visible items that, depending on <i>mode</i>, are either inside or intersect with the specified <i>rect</i> and return a list sorted using <i>order</i>.</p>
<p>The default value for <i>mode</i> is <a href="qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose exact shape intersects with or is contained by <i>rect</i> are returned.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<h3 class="fn"><a name="items-11"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::items ( const <a href="qpolygonf.html">QPolygonF</a> &amp; <i>polygon</i>, <a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a> <i>mode</i>, <a href="qt.html#SortOrder-enum">Qt::SortOrder</a> <i>order</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> = QTransform() ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns all visible items that, depending on <i>mode</i>, are either inside or intersect with the specified <i>polygon</i> and return a list sorted using <i>order</i>.</p>
<p>The default value for <i>mode</i> is <a href="qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose exact shape intersects with or is contained by <i>polygon</i> are returned.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<h3 class="fn"><a name="items-12"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::items ( const <a href="qpainterpath.html">QPainterPath</a> &amp; <i>path</i>, <a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a> <i>mode</i>, <a href="qt.html#SortOrder-enum">Qt::SortOrder</a> <i>order</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> = QTransform() ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns all visible items that, depending on <i>mode</i>, are either inside or intersect with the specified <i>path</i> and return a list sorted using <i>order</i>.</p>
<p>The default value for <i>mode</i> is <a href="qt.html#ItemSelectionMode-enum">Qt::IntersectsItemShape</a>; all items whose exact shape intersects with or is contained by <i>path</i> are returned.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/itemsBoundingRect"></a>
<h3 class="fn"><a name="itemsBoundingRect"></a><a href="qrectf.html">QRectF</a> QGraphicsScene::itemsBoundingRect () const</h3>
<p>Calculates and returns the bounding rect of all items on the scene. This function works by iterating over all items, and because if this, it can be slow for large scenes.</p>
<p>See also <a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/keyPressEvent"></a>
<h3 class="fn"><a name="keyPressEvent"></a>void QGraphicsScene::keyPressEvent ( <a href="qkeyevent.html">QKeyEvent</a> * <i>keyEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>keyEvent</i>, can be reimplemented in a subclass to receive keypress events. The default implementation forwards the event to current focus item.</p>
<p>See also <a href="qgraphicsitem.html#keyPressEvent">QGraphicsItem::keyPressEvent</a>() and <a href="qgraphicsscene.html#focusItem">focusItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/keyReleaseEvent"></a>
<h3 class="fn"><a name="keyReleaseEvent"></a>void QGraphicsScene::keyReleaseEvent ( <a href="qkeyevent.html">QKeyEvent</a> * <i>keyEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>keyEvent</i>, can be reimplemented in a subclass to receive key release events. The default implementation forwards the event to current focus item.</p>
<p>See also <a href="qgraphicsitem.html#keyReleaseEvent">QGraphicsItem::keyReleaseEvent</a>() and <a href="qgraphicsscene.html#focusItem">focusItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/mouseDoubleClickEvent"></a>
<h3 class="fn"><a name="mouseDoubleClickEvent"></a>void QGraphicsScene::mouseDoubleClickEvent ( <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> * <i>mouseEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>mouseEvent</i>, can be reimplemented in a subclass to receive mouse doubleclick events for the scene.</p>
<p>If someone doubleclicks on the scene, the scene will first receive a mouse press event, followed by a release event (i.e&#x2e;, a click), then a doubleclick event, and finally a release event. If the doubleclick event is delivered to a different item than the one that received the first press and release, it will be delivered as a press event. However, tripleclick events are not delivered as doubleclick events in this case.</p>
<p>The default implementation is similar to <a href="qgraphicsscene.html#mousePressEvent">mousePressEvent</a>().</p>
<p>See also <a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem::mousePressEvent</a>(), <a href="qgraphicsitem.html#mouseMoveEvent">QGraphicsItem::mouseMoveEvent</a>(), <a href="qgraphicsitem.html#mouseReleaseEvent">QGraphicsItem::mouseReleaseEvent</a>(), and <a href="qgraphicsitem.html#setAcceptedMouseButtons">QGraphicsItem::setAcceptedMouseButtons</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/mouseGrabberItem"></a>
<h3 class="fn"><a name="mouseGrabberItem"></a><a href="qgraphicsitem.html">QGraphicsItem</a> * QGraphicsScene::mouseGrabberItem () const</h3>
<p>Returns the current mouse grabber item, or 0 if no item is currently grabbing the mouse. The mouse grabber item is the item that receives all mouse events sent to the scene.</p>
<p>An item becomes a mouse grabber when it receives and accepts a mouse press event, and it stays the mouse grabber until either of the following events occur:</p>
<ul>
<li>If the item receives a mouse release event when there are no other buttons pressed, it loses the mouse grab.</li>
<li>If the item becomes invisible (i.e&#x2e;, someone calls <tt>item-&gt;setVisible(false))</tt>, or if it becomes disabled (i.e&#x2e;, someone calls <tt>item-&gt;setEnabled(false))</tt>, it loses the mouse grab.</li>
<li>If the item is removed from the scene, it loses the mouse grab.</li>
</ul>
<p>If the item loses its mouse grab, the scene will ignore all mouse events until a new item grabs the mouse (i.e&#x2e;, until a new item receives a mouse press event).</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/mouseMoveEvent"></a>
<h3 class="fn"><a name="mouseMoveEvent"></a>void QGraphicsScene::mouseMoveEvent ( <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> * <i>mouseEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>mouseEvent</i>, can be reimplemented in a subclass to receive mouse move events for the scene.</p>
<p>The default implementation depends on the mouse grabber state. If there is a mouse grabber item, the event is sent to the mouse grabber. If there are any items that accept hover events at the current position, the event is translated into a hover event and accepted; otherwise it's ignored.</p>
<p>See also <a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem::mousePressEvent</a>(), <a href="qgraphicsitem.html#mouseReleaseEvent">QGraphicsItem::mouseReleaseEvent</a>(), <a href="qgraphicsitem.html#mouseDoubleClickEvent">QGraphicsItem::mouseDoubleClickEvent</a>(), and <a href="qgraphicsitem.html#setAcceptedMouseButtons">QGraphicsItem::setAcceptedMouseButtons</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/mousePressEvent"></a>
<h3 class="fn"><a name="mousePressEvent"></a>void QGraphicsScene::mousePressEvent ( <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> * <i>mouseEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>mouseEvent</i>, can be reimplemented in a subclass to receive mouse press events for the scene.</p>
<p>The default implementation depends on the state of the scene. If there is a mouse grabber item, then the event is sent to the mouse grabber. Otherwise, it is forwarded to the topmost item that accepts mouse events at the scene position from the event, and that item promptly becomes the mouse grabber item.</p>
<p>If there is no item at the given position on the scene, the selection area is reset, any focus item loses its input focus, and the event is then ignored.</p>
<p>See also <a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem::mousePressEvent</a>() and <a href="qgraphicsitem.html#setAcceptedMouseButtons">QGraphicsItem::setAcceptedMouseButtons</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/mouseReleaseEvent"></a>
<h3 class="fn"><a name="mouseReleaseEvent"></a>void QGraphicsScene::mouseReleaseEvent ( <a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a> * <i>mouseEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>mouseEvent</i>, can be reimplemented in a subclass to receive mouse release events for the scene.</p>
<p>The default implementation depends on the mouse grabber state. If there is no mouse grabber, the event is ignored. Otherwise, if there is a mouse grabber item, the event is sent to the mouse grabber. If this mouse release represents the last pressed button on the mouse, the mouse grabber item then loses the mouse grab.</p>
<p>See also <a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem::mousePressEvent</a>(), <a href="qgraphicsitem.html#mouseMoveEvent">QGraphicsItem::mouseMoveEvent</a>(), <a href="qgraphicsitem.html#mouseDoubleClickEvent">QGraphicsItem::mouseDoubleClickEvent</a>(), and <a href="qgraphicsitem.html#setAcceptedMouseButtons">QGraphicsItem::setAcceptedMouseButtons</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/removeItem"></a>
<h3 class="fn"><a name="removeItem"></a>void QGraphicsScene::removeItem ( <a href="qgraphicsitem.html">QGraphicsItem</a> * <i>item</i> )</h3>
<p>Removes the item <i>item</i> and all its children from the scene. The ownership of <i>item</i> is passed on to the caller (i.e&#x2e;, <a href="qgraphicsscene.html">QGraphicsScene</a> will no longer delete <i>item</i> when destroyed).</p>
<p>See also <a href="qgraphicsscene.html#addItem">addItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/render"></a>
<h3 class="fn"><a name="render"></a>void QGraphicsScene::render ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qrectf.html">QRectF</a> &amp; <i>target</i> = QRectF(), const <a href="qrectf.html">QRectF</a> &amp; <i>source</i> = QRectF(), <a href="qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a> <i>aspectRatioMode</i> = Qt::KeepAspectRatio )</h3>
<p>Renders the <i>source</i> rect from scene into <i>target</i>, using <i>painter</i>. This function is useful for capturing the contents of the scene onto a paint device, such as a <a href="qimage.html">QImage</a> (e.g&#x2e;, to take a screenshot), or for printing with <a href="qprinter.html">QPrinter</a>. For example:</p>
<pre> QGraphicsScene scene;
 scene.addItem(...
 ...
 QPrinter printer(QPrinter::HighResolution);
 printer.setPaperSize(QPrinter::A4);

 QPainter painter(&amp;printer);
 scene.render(&amp;painter);</pre>
<p>If <i>source</i> is a null rect, this function will use <a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>() to determine what to render. If <i>target</i> is a null rect, the dimensions of <i>painter</i>'s paint device will be used.</p>
<p>The source rect contents will be transformed according to <i>aspectRatioMode</i> to fit into the target rect. By default, the aspect ratio is kept, and <i>source</i> is scaled to fit in <i>target</i>.</p>
<p>See also <a href="qgraphicsview.html#render">QGraphicsView::render</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/sceneRectChanged"></a>
<h3 class="fn"><a name="sceneRectChanged"></a>void QGraphicsScene::sceneRectChanged ( const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted by <a href="qgraphicsscene.html">QGraphicsScene</a> whenever the scene rect changes. The <i>rect</i> parameter is the new scene rectangle.</p>
<p>See also <a href="qgraphicsview.html#updateSceneRect">QGraphicsView::updateSceneRect</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/selectedItems"></a>
<h3 class="fn"><a name="selectedItems"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsitem.html">QGraphicsItem</a> *&gt; QGraphicsScene::selectedItems () const</h3>
<p>Returns a list of all currently selected items. The items are returned in no particular order.</p>
<p>See also <a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/selectionArea"></a>
<h3 class="fn"><a name="selectionArea"></a><a href="qpainterpath.html">QPainterPath</a> QGraphicsScene::selectionArea () const</h3>
<p>Returns the selection area that was previously set with <a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>(), or an empty <a href="qpainterpath.html">QPainterPath</a> if no selection area has been set.</p>
<p>See also <a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/selectionChanged"></a>
<h3 class="fn"><a name="selectionChanged"></a>void QGraphicsScene::selectionChanged ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted by <a href="qgraphicsscene.html">QGraphicsScene</a> whenever the selection changes. You can call <a href="qgraphicsscene.html#selectedItems">selectedItems</a>() to get the new list of selected items.</p>
<p>The selection changes whenever an item is selected or unselected, a selection area is set, cleared or otherwise changed, if a preselected item is added to the scene, or if a selected item is removed from the scene.</p>
<p><a href="qgraphicsscene.html">QGraphicsScene</a> emits this signal only once for group selection operations. For example, if you set a selection area, select or unselect a <a href="qgraphicsitemgroup.html">QGraphicsItemGroup</a>, or if you add or remove from the scene a parent item that contains several selected items, selectionChanged() is emitted only once after the operation has completed (instead of once for each item).</p>
<p>This function was introduced in Qt 4.3.</p>
<p>See also <a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>(), <a href="qgraphicsscene.html#selectedItems">selectedItems</a>(), and <a href="qgraphicsitem.html#setSelected">QGraphicsItem::setSelected</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/sendEvent"></a>
<h3 class="fn"><a name="sendEvent"></a>bool QGraphicsScene::sendEvent ( <a href="qgraphicsitem.html">QGraphicsItem</a> * <i>item</i>, <a href="qevent.html">QEvent</a> * <i>event</i> )</h3>
<p>Sends event <i>event</i> to item <i>item</i> through possible event filters.</p>
<p>The event is sent only if the item is enabled.</p>
<p>Returns <tt>false</tt> if the event was filtered or if the item is disabled. Otherwise returns the value that was returned from the event handler.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsitem.html#sceneEvent">QGraphicsItem::sceneEvent</a>() and <a href="qgraphicsitem.html#sceneEventFilter">QGraphicsItem::sceneEventFilter</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setActivePanel"></a>
<h3 class="fn"><a name="setActivePanel"></a>void QGraphicsScene::setActivePanel ( <a href="qgraphicsitem.html">QGraphicsItem</a> * <i>item</i> )</h3>
<p>Activates <i>item</i>, which must be an item in this scene. You can also pass 0 for <i>item</i>, in which case <a href="qgraphicsscene.html">QGraphicsScene</a> will deactivate any currently active panel.</p>
<p>If the scene is currently inactive, <i>item</i> remains inactive until the scene becomes active (or, ir <i>item</i> is 0, no item will be activated).</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#activePanel">activePanel</a>(), <a href="qgraphicsscene.html#isActive">isActive</a>(), and <a href="qgraphicsitem.html#isActive">QGraphicsItem::isActive</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setActiveWindow"></a>
<h3 class="fn"><a name="setActiveWindow"></a>void QGraphicsScene::setActiveWindow ( <a href="qgraphicswidget.html">QGraphicsWidget</a> * <i>widget</i> )</h3>
<p>Activates <i>widget</i>, which must be a widget in this scene. You can also pass 0 for <i>widget</i>, in which case <a href="qgraphicsscene.html">QGraphicsScene</a> will deactivate any currently active window.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qgraphicsscene.html#activeWindow">activeWindow</a>() and <a href="qgraphicswidget.html#isActiveWindow">QGraphicsWidget::isActiveWindow</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setFocus"></a>
<h3 class="fn"><a name="setFocus"></a>void QGraphicsScene::setFocus ( <a href="qt.html#FocusReason-enum">Qt::FocusReason</a> <i>focusReason</i> = Qt::OtherFocusReason )</h3>
<p>Sets focus on the scene by sending a <a href="qfocusevent.html">QFocusEvent</a> to the scene, passing <i>focusReason</i> as the reason. If the scene regains focus after having previously lost it while an item had focus, the last focus item will receive focus with <i>focusReason</i> as the reason.</p>
<p>If the scene already has focus, this function does nothing.</p>
<p>See also <a href="qgraphicsscene.html#hasFocus">hasFocus</a>(), <a href="qgraphicsscene.html#clearFocus">clearFocus</a>(), and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setFocusItem"></a>
<h3 class="fn"><a name="setFocusItem"></a>void QGraphicsScene::setFocusItem ( <a href="qgraphicsitem.html">QGraphicsItem</a> * <i>item</i>, <a href="qt.html#FocusReason-enum">Qt::FocusReason</a> <i>focusReason</i> = Qt::OtherFocusReason )</h3>
<p>Sets the scene's focus item to <i>item</i>, with the focus reason <i>focusReason</i>, after removing focus from any previous item that may have had focus.</p>
<p>If <i>item</i> is 0, or if it either does not accept focus (i.e&#x2e;, it does not have the <a href="qgraphicsitem.html#GraphicsItemFlag-enum">QGraphicsItem::ItemIsFocusable</a> flag enabled), or is not visible or not enabled, this function only removes focus from any previous focusitem.</p>
<p>If item is not 0, and the scene does not currently have focus (i.e&#x2e;, <a href="qgraphicsscene.html#hasFocus">hasFocus</a>() returns false), this function will call <a href="qgraphicsscene.html#setFocus">setFocus</a>() automatically.</p>
<p>See also <a href="qgraphicsscene.html#focusItem">focusItem</a>(), <a href="qgraphicsscene.html#hasFocus">hasFocus</a>(), and <a href="qgraphicsscene.html#setFocus">setFocus</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setSelectionArea"></a>
<h3 class="fn"><a name="setSelectionArea"></a>void QGraphicsScene::setSelectionArea ( const <a href="qpainterpath.html">QPainterPath</a> &amp; <i>path</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> )</h3>
<p>Sets the selection area to <i>path</i>. All items within this area are immediately selected, and all items outside are unselected. You can get the list of all selected items by calling <a href="qgraphicsscene.html#selectedItems">selectedItems</a>().</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>For an item to be selected, it must be marked as <i>selectable</i> (<a href="qgraphicsitem.html#GraphicsItemFlag-enum">QGraphicsItem::ItemIsSelectable</a>).</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#clearSelection">clearSelection</a>() and <a href="qgraphicsscene.html#selectionArea">selectionArea</a>().</p>
<h3 class="fn"><a name="setSelectionArea-4"></a>void QGraphicsScene::setSelectionArea ( const <a href="qpainterpath.html">QPainterPath</a> &amp; <i>path</i>, <a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a> <i>mode</i>, const <a href="qtransform.html">QTransform</a> &amp; <i>deviceTransform</i> )</h3>
<p>This is an overloaded function.</p>
<p>Sets the selection area to <i>path</i> using <i>mode</i> to determine if items are included in the selection area.</p>
<p><i>deviceTransform</i> is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations.</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qgraphicsscene.html#clearSelection">clearSelection</a>() and <a href="qgraphicsscene.html#selectionArea">selectionArea</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/setStyle"></a>
<h3 class="fn"><a name="setStyle"></a>void QGraphicsScene::setStyle ( <a href="qstyle.html">QStyle</a> * <i>style</i> )</h3>
<p>Sets or replaces the style of the scene to <i>style</i>, and reparents the style to this scene. Any previously assigned style is deleted. The scene's style defaults to <a href="qapplication.html#style">QApplication::style</a>(), and serves as the default for all <a href="qgraphicswidget.html">QGraphicsWidget</a> items in the scene.</p>
<p>Changing the style, either directly by calling this function, or indirectly by calling <a href="qapplication.html#setStyle">QApplication::setStyle</a>(), will automatically update the style for all widgets in the scene that do not have a style explicitly assigned to them.</p>
<p>If <i>style</i> is 0, <a href="qgraphicsscene.html">QGraphicsScene</a> will revert to <a href="qapplication.html#style">QApplication::style</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qgraphicsscene.html#style">style</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/style"></a>
<h3 class="fn"><a name="style"></a><a href="qstyle.html">QStyle</a> * QGraphicsScene::style () const</h3>
<p>Returns the scene's style, or the same as <a href="qapplication.html#style">QApplication::style</a>() if the scene has not been explicitly assigned a style.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qgraphicsscene.html#setStyle">setStyle</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/update"></a>
<h3 class="fn"><a name="update"></a>void QGraphicsScene::update ( const <a href="qrectf.html">QRectF</a> &amp; <i>rect</i> = QRectF() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Schedules a redraw of the area <i>rect</i> on the scene.</p>
<p>See also <a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>() and <a href="qgraphicsscene.html#changed">changed</a>().</p>
<h3 class="fn"><a name="update-2"></a>void QGraphicsScene::update ( <a href="qtglobal.html#qreal-typedef">qreal</a> <i>x</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>y</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>w</i>, <a href="qtglobal.html#qreal-typedef">qreal</a> <i>h</i> )</h3>
<p>This is an overloaded function.</p>
<p>This function is equivalent to calling update(<a href="qrectf.html">QRectF</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>));</p>
<p>This function was introduced in Qt 4.3.</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/views"></a>
<h3 class="fn"><a name="views"></a><a href="qlist.html">QList</a>&lt;<a href="qgraphicsview.html">QGraphicsView</a> *&gt; QGraphicsScene::views () const</h3>
<p>Returns a list of all the views that display this scene.</p>
<p>See also <a href="qgraphicsview.html#scene">QGraphicsView::scene</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/wheelEvent"></a>
<h3 class="fn"><a name="wheelEvent"></a>void QGraphicsScene::wheelEvent ( <a href="qgraphicsscenewheelevent.html">QGraphicsSceneWheelEvent</a> * <i>wheelEvent</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>This event handler, for event <i>wheelEvent</i>, can be reimplemented in a subclass to receive mouse wheel events for the scene.</p>
<p>By default, the event is delivered to the topmost visible item under the cursor. If ignored, the event propagates to the item beneath, and again until the event is accepted, or it reaches the scene. If no items accept the event, it is ignored.</p>
<p>See also <a href="qgraphicsitem.html#wheelEvent">QGraphicsItem::wheelEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QGraphicsScene/width"></a>
<h3 class="fn"><a name="width"></a><a href="qtglobal.html#qreal-typedef">qreal</a> QGraphicsScene::width () const</h3>
<p>This convenience function is equivalent to calling <a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>().width().</p>
<p>See also <a href="qgraphicsscene.html#height">height</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>