Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 5434

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qgraphicsscene.cpp -->
  <title>Qt 4.8: QGraphicsScene Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QGraphicsScene</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#protected-slots">Protected Slots</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#event-handling-and-propagation">Event Handling and Propagation</a></li>
</ul>
</div>
<h1 class="title">QGraphicsScene Class Reference</h1>
<!-- $$$QGraphicsScene-brief -->
<p>The QGraphicsScene class provides a surface for managing a large number of 2D graphical items. <a href="#details">More...</a></p>
<!-- @@@QGraphicsScene -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QGraphicsScene&gt;</span></pre><p><b>Inherits: </b><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>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#ItemIndexMethod-enum">ItemIndexMethod</a></b> { BspTreeIndex, NoIndex }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#SceneLayer-enum">SceneLayer</a></b> { ItemLayer, BackgroundLayer, ForegroundLayer, AllLayers }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#SceneLayer-enum">SceneLayers</a></b></td></tr>
</table>
<a name="properties"></a>
<h2>Properties</h2>
<table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><b><a href="qgraphicsscene.html#backgroundBrush-prop">backgroundBrush</a></b> : QBrush</li>
<li class="fn"><b><a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a></b> : int</li>
<li class="fn"><b><a href="qgraphicsscene.html#font-prop">font</a></b> : QFont</li>
<li class="fn"><b><a href="qgraphicsscene.html#foregroundBrush-prop">foregroundBrush</a></b> : QBrush</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><b><a href="qgraphicsscene.html#itemIndexMethod-prop">itemIndexMethod</a></b> : ItemIndexMethod</li>
<li class="fn"><b><a href="qgraphicsscene.html#palette-prop">palette</a></b> : QPalette</li>
<li class="fn"><b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a></b> : QRectF</li>
<li class="fn"><b><a href="qgraphicsscene.html#stickyFocus-prop">stickyFocus</a></b> : bool</li>
</ul>
</td></tr>
</table>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#QGraphicsScene">QGraphicsScene</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#dtor.QGraphicsScene">~QGraphicsScene</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsItem * </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#activePanel">activePanel</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsWidget * </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#activeWindow">activeWindow</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsEllipseItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsEllipseItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#addItem">addItem</a></b> ( QGraphicsItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsLineItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsLineItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsPathItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsPixmapItem * </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#addPixmap">addPixmap</a></b> ( const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsPolygonItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsRectItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsRectItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsSimpleTextItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsTextItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsProxyWidget * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#backgroundBrush-prop">backgroundBrush</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#clearFocus">clearFocus</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsItemGroup * </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#createItemGroup">createItemGroup</a></b> ( const QList&lt;QGraphicsItem *&gt; &amp; <i>items</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#destroyItemGroup">destroyItemGroup</a></b> ( QGraphicsItemGroup * <i>group</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsItem * </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#focusItem">focusItem</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#font-prop">font</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#foregroundBrush-prop">foregroundBrush</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#hasFocus">hasFocus</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#height">height</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#inputMethodQuery">inputMethodQuery</a></b> ( Qt::InputMethodQuery <i>query</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#isActive">isActive</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#sortCacheEnabled-prop">isSortCacheEnabled</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QGraphicsItem * </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> ItemIndexMethod </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#itemIndexMethod-prop">itemIndexMethod</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#items">items</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#items-2">items</a></b> ( Qt::SortOrder <i>order</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#itemsBoundingRect">itemsBoundingRect</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGraphicsItem * </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#mouseGrabberItem">mouseGrabberItem</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPalette </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#palette-prop">palette</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#removeItem">removeItem</a></b> ( QGraphicsItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGraphicsItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#selectedItems">selectedItems</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#selectionArea">selectionArea</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#sendEvent">sendEvent</a></b> ( QGraphicsItem * <i>item</i>, QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#setActivePanel">setActivePanel</a></b> ( QGraphicsItem * <i>item</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#setActiveWindow">setActiveWindow</a></b> ( QGraphicsWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#backgroundBrush-prop">setBackgroundBrush</a></b> ( const QBrush &amp; <i>brush</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#bspTreeDepth-prop">setBspTreeDepth</a></b> ( int <i>depth</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#setFocus">setFocus</a></b> ( Qt::FocusReason <i>focusReason</i> = Qt::OtherFocusReason )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#font-prop">setFont</a></b> ( const QFont &amp; <i>font</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#foregroundBrush-prop">setForegroundBrush</a></b> ( const QBrush &amp; <i>brush</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#itemIndexMethod-prop">setItemIndexMethod</a></b> ( ItemIndexMethod <i>method</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#palette-prop">setPalette</a></b> ( const QPalette &amp; <i>palette</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#sceneRect-prop">setSceneRect</a></b> ( const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#sortCacheEnabled-prop">setSortCacheEnabled</a></b> ( bool <i>enabled</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#stickyFocus-prop">setStickyFocus</a></b> ( bool <i>enabled</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#setStyle">setStyle</a></b> ( QStyle * <i>style</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#stickyFocus-prop">stickyFocus</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStyle * </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#style">style</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> QList&lt;QGraphicsView *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#views">views</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#width">width</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#advance">advance</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#clearSelection">clearSelection</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#update">update</a></b> ( const QRectF &amp; <i>rect</i> = QRectF() )</td></tr>
</table>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#changed">changed</a></b> ( const QList&lt;QRectF&gt; &amp; <i>region</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#sceneRectChanged">sceneRectChanged</a></b> ( const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#selectionChanged">selectionChanged</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#contextMenuEvent">contextMenuEvent</a></b> ( QGraphicsSceneContextMenuEvent * <i>contextMenuEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#dragEnterEvent">dragEnterEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#dragLeaveEvent">dragLeaveEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#dragMoveEvent">dragMoveEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><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 rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#dropEvent">dropEvent</a></b> ( QGraphicsSceneDragDropEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#focusInEvent">focusInEvent</a></b> ( QFocusEvent * <i>focusEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#focusOutEvent">focusOutEvent</a></b> ( QFocusEvent * <i>focusEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#helpEvent">helpEvent</a></b> ( QGraphicsSceneHelpEvent * <i>helpEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#inputMethodEvent">inputMethodEvent</a></b> ( QInputMethodEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#keyPressEvent">keyPressEvent</a></b> ( QKeyEvent * <i>keyEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#keyReleaseEvent">keyReleaseEvent</a></b> ( QKeyEvent * <i>keyEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#mouseMoveEvent">mouseMoveEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#mousePressEvent">mousePressEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#mouseReleaseEvent">mouseReleaseEvent</a></b> ( QGraphicsSceneMouseEvent * <i>mouseEvent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#wheelEvent">wheelEvent</a></b> ( QGraphicsSceneWheelEvent * <i>wheelEvent</i> )</td></tr>
</table>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#event">event</a></b> ( QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#eventFilter">eventFilter</a></b> ( QObject * <i>watched</i>, QEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="protected-slots"></a>
<h2>Protected Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsscene.html#focusNextPrevChild">focusNextPrevChild</a></b> ( bool <i>next</i> )</td></tr>
</table>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QGraphicsScene-description -->
<div class="descr">
<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 the <a href="graphicsview.html">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 class="cpp"> <span class="type">QGraphicsScene</span> scene;
 scene<span class="operator">.</span><a href="qgraphicsscene.html#addText">addText</a>(<span class="string">&quot;Hello, world!&quot;</span>);

 <span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
 view<span class="operator">.</span>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>
</div>
<p><b>See also </b><a href="qgraphicsitem.html">QGraphicsItem</a> and <a href="qgraphicsview.html">QGraphicsView</a>.</p>
<!-- @@@QGraphicsScene -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$ItemIndexMethod$$$BspTreeIndex$$$NoIndex -->
<h3 class="fn"><a name="ItemIndexMethod-enum"></a>enum QGraphicsScene::<span class="name">ItemIndexMethod</span></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>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QGraphicsScene::BspTreeIndex</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">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 class="topAlign"><tt>QGraphicsScene::NoIndex</tt></td><td class="topAlign"><tt>-1</tt></td><td class="topAlign">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><b>See also </b><a href="qgraphicsscene.html#itemIndexMethod-prop">setItemIndexMethod</a>() and <a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a>.</p>
<!-- @@@ItemIndexMethod -->
<!-- $$$SceneLayer$$$ItemLayer$$$BackgroundLayer$$$ForegroundLayer$$$AllLayers -->
<h3 class="flags"><a name="SceneLayer-enum"></a>enum QGraphicsScene::<span class="name">SceneLayer</span><br/>flags QGraphicsScene::<span class="name">SceneLayers</span></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>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QGraphicsScene::ItemLayer</tt></td><td class="topAlign"><tt>0x1</tt></td><td class="topAlign">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 class="topAlign"><tt>QGraphicsScene::BackgroundLayer</tt></td><td class="topAlign"><tt>0x2</tt></td><td class="topAlign">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 class="topAlign"><tt>QGraphicsScene::ForegroundLayer</tt></td><td class="topAlign"><tt>0x4</tt></td><td class="topAlign">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 class="topAlign"><tt>QGraphicsScene::AllLayers</tt></td><td class="topAlign"><tt>0xffff</tt></td><td class="topAlign">All layers; this value represents a combination of all three layers.</td></tr>
</table>
<p>This enum was introduced or modified 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><b>See also </b><a href="qgraphicsscene.html#invalidate">invalidate</a>() and <a href="qgraphicsview.html#invalidateScene">QGraphicsView::invalidateScene</a>().</p>
<!-- @@@SceneLayer -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$backgroundBrush-prop$$$backgroundBrush$$$setBackgroundBrushconstQBrush& -->
<h3 class="fn"><a name="backgroundBrush-prop"></a><span class="name">backgroundBrush</span> : <span class="type"><a href="qbrush.html">QBrush</a></span></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 class="cpp"> <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
 <span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
 view<span class="operator">.</span>show();

 <span class="comment">// a blue background</span>
 scene<span class="operator">.</span>setBackgroundBrush(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>blue);

 <span class="comment">// a gradient background</span>
 <span class="type"><a href="qradialgradient.html">QRadialGradient</a></span> gradient(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">10</span>);
 gradient<span class="operator">.</span>setSpread(<span class="type"><a href="qgradient.html">QGradient</a></span><span class="operator">::</span>RepeatSpread);
 scene<span class="operator">.</span>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">
<tr><td class="memItemLeft topAlign rightAlign"> QBrush </td><td class="memItemRight bottomAlign"><span class="name"><b>backgroundBrush</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setBackgroundBrush</b></span> ( const QBrush &amp; <i>brush</i> )</td></tr>
</table>
<!-- @@@backgroundBrush -->
<!-- $$$bspTreeDepth-prop$$$bspTreeDepth$$$setBspTreeDepthint -->
<h3 class="fn"><a name="bspTreeDepth-prop"></a><span class="name">bspTreeDepth</span> : <span class="type">int</span></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 class="cpp"> <span class="type"><a href="qsizef.html">QSizeF</a></span> segmentSize <span class="operator">=</span> sceneRect()<span class="operator">.</span>size() <span class="operator">/</span> pow(<span class="number">2</span><span class="operator">,</span> depth <span class="operator">-</span> <span class="number">1</span>);</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">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>bspTreeDepth</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setBspTreeDepth</b></span> ( int <i>depth</i> )</td></tr>
</table>
<p><b>See also </b><a href="qgraphicsscene.html#itemIndexMethod-prop">itemIndexMethod</a>.</p>
<!-- @@@bspTreeDepth -->
<!-- $$$font-prop$$$font$$$setFontconstQFont& -->
<h3 class="fn"><a name="font-prop"></a><span class="name">font</span> : <span class="type"><a href="qfont.html">QFont</a></span></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">
<tr><td class="memItemLeft topAlign rightAlign"> QFont </td><td class="memItemRight bottomAlign"><span class="name"><b>font</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setFont</b></span> ( const QFont &amp; <i>font</i> )</td></tr>
</table>
<p><b>See also </b><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>
<!-- @@@font -->
<!-- $$$foregroundBrush-prop$$$foregroundBrush$$$setForegroundBrushconstQBrush& -->
<h3 class="fn"><a name="foregroundBrush-prop"></a><span class="name">foregroundBrush</span> : <span class="type"><a href="qbrush.html">QBrush</a></span></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 class="cpp"> <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
 <span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span> view(<span class="operator">&amp;</span>scene);
 view<span class="operator">.</span>show();

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

 <span class="comment">// a grid foreground</span>
 scene<span class="operator">.</span>setForegroundBrush(<span class="type"><a href="qbrush.html">QBrush</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>lightGray<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>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">
<tr><td class="memItemLeft topAlign rightAlign"> QBrush </td><td class="memItemRight bottomAlign"><span class="name"><b>foregroundBrush</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setForegroundBrush</b></span> ( const QBrush &amp; <i>brush</i> )</td></tr>
</table>
<!-- @@@foregroundBrush -->
<!-- $$$itemIndexMethod-prop$$$itemIndexMethod$$$setItemIndexMethodItemIndexMethod -->
<h3 class="fn"><a name="itemIndexMethod-prop"></a><span class="name">itemIndexMethod</span> : <span class="type"><a href="qgraphicsscene.html#ItemIndexMethod-enum">ItemIndexMethod</a></span></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">
<tr><td class="memItemLeft topAlign rightAlign"> ItemIndexMethod </td><td class="memItemRight bottomAlign"><span class="name"><b>itemIndexMethod</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setItemIndexMethod</b></span> ( ItemIndexMethod <i>method</i> )</td></tr>
</table>
<p><b>See also </b><a href="qgraphicsscene.html#bspTreeDepth-prop">bspTreeDepth</a>.</p>
<!-- @@@itemIndexMethod -->
<!-- $$$palette-prop$$$palette$$$setPaletteconstQPalette& -->
<h3 class="fn"><a name="palette-prop"></a><span class="name">palette</span> : <span class="type"><a href="qpalette.html">QPalette</a></span></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">
<tr><td class="memItemLeft topAlign rightAlign"> QPalette </td><td class="memItemRight bottomAlign"><span class="name"><b>palette</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setPalette</b></span> ( const QPalette &amp; <i>palette</i> )</td></tr>
</table>
<p><b>See also </b><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>
<!-- @@@palette -->
<!-- $$$sceneRect-prop$$$sceneRect$$$setSceneRectconstQRectF&$$$setSceneRectqrealqrealqrealqreal -->
<h3 class="fn"><a name="sceneRect-prop"></a><span class="name">sceneRect</span> : <span class="type"><a href="qrectf.html">QRectF</a></span></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">
<tr><td class="memItemLeft topAlign rightAlign"> QRectF </td><td class="memItemRight bottomAlign"><span class="name"><b>sceneRect</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSceneRect</b></span> ( const QRectF &amp; <i>rect</i> )</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSceneRect</b></span> ( qreal <i>x</i>, qreal <i>y</i>, qreal <i>w</i>, qreal <i>h</i> )</td></tr>
</table>
<p><b>See also </b><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>
<!-- @@@sceneRect -->
<!-- $$$stickyFocus-prop$$$stickyFocus$$$setStickyFocusbool -->
<h3 class="fn"><a name="stickyFocus-prop"></a><span class="name">stickyFocus</span> : <span class="type">bool</span></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">
<tr><td class="memItemLeft topAlign rightAlign"> bool </td><td class="memItemRight bottomAlign"><span class="name"><b>stickyFocus</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setStickyFocus</b></span> ( bool <i>enabled</i> )</td></tr>
</table>
<p><b>See also </b><a href="qgraphicsscene.html#clearFocus">clearFocus</a>() and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<!-- @@@stickyFocus -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QGraphicsScene[overload1]$$$QGraphicsSceneQObject* -->
<h3 class="fn"><a name="QGraphicsScene"></a>QGraphicsScene::<span class="name">QGraphicsScene</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <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>
<!-- @@@QGraphicsScene -->
<!-- $$$QGraphicsScene$$$QGraphicsSceneconstQRectF&QObject* -->
<h3 class="fn"><a name="QGraphicsScene-2"></a>QGraphicsScene::<span class="name">QGraphicsScene</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>sceneRect</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <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><b>See also </b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>.</p>
<!-- @@@QGraphicsScene -->
<!-- $$$QGraphicsScene$$$QGraphicsSceneqrealqrealqrealqrealQObject* -->
<h3 class="fn"><a name="QGraphicsScene-3"></a>QGraphicsScene::<span class="name">QGraphicsScene</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>height</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <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><b>See also </b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>.</p>
<!-- @@@QGraphicsScene -->
<!-- $$$~QGraphicsScene[overload1]$$$~QGraphicsScene -->
<h3 class="fn"><a name="dtor.QGraphicsScene"></a>QGraphicsScene::<span class="name">~QGraphicsScene</span> ()<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>
<!-- @@@~QGraphicsScene -->
<!-- $$$activePanel[overload1]$$$activePanel -->
<h3 class="fn"><a name="activePanel"></a><span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * QGraphicsScene::<span class="name">activePanel</span> () 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><b>See also </b><a href="qgraphicsscene.html#setActivePanel">QGraphicsScene::setActivePanel</a>().</p>
<!-- @@@activePanel -->
<!-- $$$activeWindow[overload1]$$$activeWindow -->
<h3 class="fn"><a name="activeWindow"></a><span class="type"><a href="qgraphicswidget.html">QGraphicsWidget</a></span> * QGraphicsScene::<span class="name">activeWindow</span> () 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><b>See also </b><a href="qgraphicsscene.html#setActiveWindow">QGraphicsScene::setActiveWindow</a>().</p>
<!-- @@@activeWindow -->
<!-- $$$addEllipse[overload1]$$$addEllipseconstQRectF&constQPen&constQBrush& -->
<h3 class="fn"><a name="addEllipse"></a><span class="type"><a href="qgraphicsellipseitem.html">QGraphicsEllipseItem</a></span> * QGraphicsScene::<span class="name">addEllipse</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &amp; <i>pen</i> = QPen(), const <span class="type"><a href="qbrush.html">QBrush</a></span> &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><b>See also </b><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>
<!-- @@@addEllipse -->
<!-- $$$addEllipse$$$addEllipseqrealqrealqrealqrealconstQPen&constQBrush& -->
<h3 class="fn"><a name="addEllipse-2"></a><span class="type"><a href="qgraphicsellipseitem.html">QGraphicsEllipseItem</a></span> * QGraphicsScene::<span class="name">addEllipse</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>h</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &amp; <i>pen</i> = QPen(), const <span class="type"><a href="qbrush.html">QBrush</a></span> &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>
<!-- @@@addEllipse -->
<!-- $$$addItem[overload1]$$$addItemQGraphicsItem* -->
<h3 class="fn"><a name="addItem"></a><span class="type">void</span> QGraphicsScene::<span class="name">addItem</span> ( <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * <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><b>See also </b><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>
<!-- @@@addItem -->
<!-- $$$addLine[overload1]$$$addLineconstQLineF&constQPen& -->
<h3 class="fn"><a name="addLine"></a><span class="type"><a href="qgraphicslineitem.html">QGraphicsLineItem</a></span> * QGraphicsScene::<span class="name">addLine</span> ( const <span class="type"><a href="qlinef.html">QLineF</a></span> &amp; <i>line</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &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><b>See also </b><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>
<!-- @@@addLine -->
<!-- $$$addLine$$$addLineqrealqrealqrealqrealconstQPen& -->
<h3 class="fn"><a name="addLine-2"></a><span class="type"><a href="qgraphicslineitem.html">QGraphicsLineItem</a></span> * QGraphicsScene::<span class="name">addLine</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x1</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y1</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x2</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y2</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &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>
<!-- @@@addLine -->
<!-- $$$addPath[overload1]$$$addPathconstQPainterPath&constQPen&constQBrush& -->
<h3 class="fn"><a name="addPath"></a><span class="type"><a href="qgraphicspathitem.html">QGraphicsPathItem</a></span> * QGraphicsScene::<span class="name">addPath</span> ( const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp; <i>path</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &amp; <i>pen</i> = QPen(), const <span class="type"><a href="qbrush.html">QBrush</a></span> &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><b>See also </b><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>
<!-- @@@addPath -->
<!-- $$$addPixmap[overload1]$$$addPixmapconstQPixmap& -->
<h3 class="fn"><a name="addPixmap"></a><span class="type"><a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a></span> * QGraphicsScene::<span class="name">addPixmap</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &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><b>See also </b><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>
<!-- @@@addPixmap -->
<!-- $$$addPolygon[overload1]$$$addPolygonconstQPolygonF&constQPen&constQBrush& -->
<h3 class="fn"><a name="addPolygon"></a><span class="type"><a href="qgraphicspolygonitem.html">QGraphicsPolygonItem</a></span> * QGraphicsScene::<span class="name">addPolygon</span> ( const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp; <i>polygon</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &amp; <i>pen</i> = QPen(), const <span class="type"><a href="qbrush.html">QBrush</a></span> &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><b>See also </b><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>
<!-- @@@addPolygon -->
<!-- $$$addRect[overload1]$$$addRectconstQRectF&constQPen&constQBrush& -->
<h3 class="fn"><a name="addRect"></a><span class="type"><a href="qgraphicsrectitem.html">QGraphicsRectItem</a></span> * QGraphicsScene::<span class="name">addRect</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &amp; <i>pen</i> = QPen(), const <span class="type"><a href="qbrush.html">QBrush</a></span> &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><b>See also </b><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>
<!-- @@@addRect -->
<!-- $$$addRect$$$addRectqrealqrealqrealqrealconstQPen&constQBrush& -->
<h3 class="fn"><a name="addRect-2"></a><span class="type"><a href="qgraphicsrectitem.html">QGraphicsRectItem</a></span> * QGraphicsScene::<span class="name">addRect</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>h</i>, const <span class="type"><a href="qpen.html">QPen</a></span> &amp; <i>pen</i> = QPen(), const <span class="type"><a href="qbrush.html">QBrush</a></span> &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>
<!-- @@@addRect -->
<!-- $$$addSimpleText[overload1]$$$addSimpleTextconstQString&constQFont& -->
<h3 class="fn"><a name="addSimpleText"></a><span class="type"><a href="qgraphicssimpletextitem.html">QGraphicsSimpleTextItem</a></span> * QGraphicsScene::<span class="name">addSimpleText</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i>, const <span class="type"><a href="qfont.html">QFont</a></span> &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><b>See also </b><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>
<!-- @@@addSimpleText -->
<!-- $$$addText[overload1]$$$addTextconstQString&constQFont& -->
<h3 class="fn"><a name="addText"></a><span class="type"><a href="qgraphicstextitem.html">QGraphicsTextItem</a></span> * QGraphicsScene::<span class="name">addText</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i>, const <span class="type"><a href="qfont.html">QFont</a></span> &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><b>See also </b><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>
<!-- @@@addText -->
<!-- $$$addWidget[overload1]$$$addWidgetQWidget*Qt::WindowFlags -->
<h3 class="fn"><a name="addWidget"></a><span class="type"><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a></span> * QGraphicsScene::<span class="name">addWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i>, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <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><b>See also </b><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>
<!-- @@@addWidget -->
<!-- $$$advance[overload1]$$$advance -->
<h3 class="fn"><a name="advance"></a><span class="type">void</span> QGraphicsScene::<span class="name">advance</span> ()<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><b>See also </b><a href="qgraphicsitem.html#advance">QGraphicsItem::advance</a>(), <a href="qgraphicsitemanimation.html">QGraphicsItemAnimation</a>, and <a href="qtimeline.html">QTimeLine</a>.</p>
<!-- @@@advance -->
<!-- $$$changed[overload1]$$$changedconstQList<QRectF>& -->
<h3 class="fn"><a name="changed"></a><span class="type">void</span> QGraphicsScene::<span class="name">changed</span> ( const <span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qrectf.html">QRectF</a></span>&gt; &amp; <i>region</i> )<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><b>See also </b><a href="qgraphicsview.html#updateScene">QGraphicsView::updateScene</a>().</p>
<!-- @@@changed -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QGraphicsScene::<span class="name">clear</span> ()<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><b>See also </b><a href="qgraphicsscene.html#addItem">addItem</a>().</p>
<!-- @@@clear -->
<!-- $$$clearFocus[overload1]$$$clearFocus -->
<h3 class="fn"><a name="clearFocus"></a><span class="type">void</span> QGraphicsScene::<span class="name">clearFocus</span> ()</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><b>See also </b><a href="qgraphicsscene.html#hasFocus">hasFocus</a>(), <a href="qgraphicsscene.html#setFocus">setFocus</a>(), and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<!-- @@@clearFocus -->
<!-- $$$clearSelection[overload1]$$$clearSelection -->
<h3 class="fn"><a name="clearSelection"></a><span class="type">void</span> QGraphicsScene::<span class="name">clearSelection</span> ()<tt> [slot]</tt></h3>
<p>Clears the current selection.</p>
<p><b>See also </b><a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>() and <a href="qgraphicsscene.html#selectedItems">selectedItems</a>().</p>
<!-- @@@clearSelection -->
<!-- $$$collidingItems[overload1]$$$collidingItemsconstQGraphicsItem*Qt::ItemSelectionMode -->
<h3 class="fn"><a name="collidingItems"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">collidingItems</span> ( const <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * <i>item</i>, <span class="type"><a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <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><b>See also </b><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>
<!-- @@@collidingItems -->
<!-- $$$contextMenuEvent[overload1]$$$contextMenuEventQGraphicsSceneContextMenuEvent* -->
<h3 class="fn"><a name="contextMenuEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">contextMenuEvent</span> ( <span class="type"><a href="qgraphicsscenecontextmenuevent.html">QGraphicsSceneContextMenuEvent</a></span> * <i>contextMenuEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#contextMenuEvent">QGraphicsItem::contextMenuEvent</a>().</p>
<!-- @@@contextMenuEvent -->
<!-- $$$createItemGroup[overload1]$$$createItemGroupconstQList<QGraphicsItem*>& -->
<h3 class="fn"><a name="createItemGroup"></a><span class="type"><a href="qgraphicsitemgroup.html">QGraphicsItemGroup</a></span> * QGraphicsScene::<span class="name">createItemGroup</span> ( const <span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&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><b>See also </b><a href="qgraphicsscene.html#destroyItemGroup">destroyItemGroup</a>() and <a href="qgraphicsitemgroup.html#addToGroup">QGraphicsItemGroup::addToGroup</a>().</p>
<!-- @@@createItemGroup -->
<!-- $$$destroyItemGroup[overload1]$$$destroyItemGroupQGraphicsItemGroup* -->
<h3 class="fn"><a name="destroyItemGroup"></a><span class="type">void</span> QGraphicsScene::<span class="name">destroyItemGroup</span> ( <span class="type"><a href="qgraphicsitemgroup.html">QGraphicsItemGroup</a></span> * <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><b>See also </b><a href="qgraphicsscene.html#createItemGroup">createItemGroup</a>() and <a href="qgraphicsitemgroup.html#removeFromGroup">QGraphicsItemGroup::removeFromGroup</a>().</p>
<!-- @@@destroyItemGroup -->
<!-- $$$dragEnterEvent[overload1]$$$dragEnterEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn"><a name="dragEnterEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">dragEnterEvent</span> ( <span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> * <i>event</i> )<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><b>See also </b><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>
<!-- @@@dragEnterEvent -->
<!-- $$$dragLeaveEvent[overload1]$$$dragLeaveEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn"><a name="dragLeaveEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">dragLeaveEvent</span> ( <span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> * <i>event</i> )<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><b>See also </b><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>
<!-- @@@dragLeaveEvent -->
<!-- $$$dragMoveEvent[overload1]$$$dragMoveEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn"><a name="dragMoveEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">dragMoveEvent</span> ( <span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> * <i>event</i> )<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><b>See also </b><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>
<!-- @@@dragMoveEvent -->
<!-- $$$drawBackground[overload1]$$$drawBackgroundQPainter*constQRectF& -->
<h3 class="fn"><a name="drawBackground"></a><span class="type">void</span> QGraphicsScene::<span class="name">drawBackground</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> * <i>painter</i>, const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i> )<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><b>See also </b><a href="qgraphicsscene.html#drawForeground">drawForeground</a>() and <a href="qgraphicsscene-obsolete.html#drawItems" class="obsolete">drawItems</a>().</p>
<!-- @@@drawBackground -->
<!-- $$$drawForeground[overload1]$$$drawForegroundQPainter*constQRectF& -->
<h3 class="fn"><a name="drawForeground"></a><span class="type">void</span> QGraphicsScene::<span class="name">drawForeground</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> * <i>painter</i>, const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i> )<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><b>See also </b><a href="qgraphicsscene.html#drawBackground">drawBackground</a>() and <a href="qgraphicsscene-obsolete.html#drawItems" class="obsolete">drawItems</a>().</p>
<!-- @@@drawForeground -->
<!-- $$$dropEvent[overload1]$$$dropEventQGraphicsSceneDragDropEvent* -->
<h3 class="fn"><a name="dropEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">dropEvent</span> ( <span class="type"><a href="qgraphicsscenedragdropevent.html">QGraphicsSceneDragDropEvent</a></span> * <i>event</i> )<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><b>See also </b><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>
<!-- @@@dropEvent -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QGraphicsScene::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<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><b>See also </b><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>
<!-- @@@event -->
<!-- $$$eventFilter[overload1]$$$eventFilterQObject*QEvent* -->
<h3 class="fn"><a name="eventFilter"></a><span class="type">bool</span> QGraphicsScene::<span class="name">eventFilter</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>watched</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<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>
<!-- @@@eventFilter -->
<!-- $$$focusInEvent[overload1]$$$focusInEventQFocusEvent* -->
<h3 class="fn"><a name="focusInEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">focusInEvent</span> ( <span class="type"><a href="qfocusevent.html">QFocusEvent</a></span> * <i>focusEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#focusOutEvent">QGraphicsItem::focusOutEvent</a>().</p>
<!-- @@@focusInEvent -->
<!-- $$$focusItem[overload1]$$$focusItem -->
<h3 class="fn"><a name="focusItem"></a><span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * QGraphicsScene::<span class="name">focusItem</span> () 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><b>See also </b><a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>(), <a href="qgraphicsitem.html#hasFocus">QGraphicsItem::hasFocus</a>(), and <a href="qgraphicsscene.html#isActive">isActive</a>().</p>
<!-- @@@focusItem -->
<!-- $$$focusNextPrevChild[overload1]$$$focusNextPrevChildbool -->
<h3 class="fn"><a name="focusNextPrevChild"></a><span class="type">bool</span> QGraphicsScene::<span class="name">focusNextPrevChild</span> ( <span class="type">bool</span> <i>next</i> )<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>
<!-- @@@focusNextPrevChild -->
<!-- $$$focusOutEvent[overload1]$$$focusOutEventQFocusEvent* -->
<h3 class="fn"><a name="focusOutEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">focusOutEvent</span> ( <span class="type"><a href="qfocusevent.html">QFocusEvent</a></span> * <i>focusEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#focusInEvent">QGraphicsItem::focusInEvent</a>().</p>
<!-- @@@focusOutEvent -->
<!-- $$$hasFocus[overload1]$$$hasFocus -->
<h3 class="fn"><a name="hasFocus"></a><span class="type">bool</span> QGraphicsScene::<span class="name">hasFocus</span> () 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><b>See also </b><a href="qgraphicsscene.html#setFocus">setFocus</a>() and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<!-- @@@hasFocus -->
<!-- $$$height[overload1]$$$height -->
<h3 class="fn"><a name="height"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QGraphicsScene::<span class="name">height</span> () const</h3>
<p>This convenience function is equivalent to calling <tt>sceneRect().height()</tt>.</p>
<p><b>See also </b><a href="qgraphicsscene.html#width">width</a>().</p>
<!-- @@@height -->
<!-- $$$helpEvent[overload1]$$$helpEventQGraphicsSceneHelpEvent* -->
<h3 class="fn"><a name="helpEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">helpEvent</span> ( <span class="type"><a href="qgraphicsscenehelpevent.html">QGraphicsSceneHelpEvent</a></span> * <i>helpEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#toolTip">QGraphicsItem::toolTip</a>() and <a href="qgraphicsscenehelpevent.html">QGraphicsSceneHelpEvent</a>.</p>
<!-- @@@helpEvent -->
<!-- $$$inputMethodEvent[overload1]$$$inputMethodEventQInputMethodEvent* -->
<h3 class="fn"><a name="inputMethodEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">inputMethodEvent</span> ( <span class="type"><a href="qinputmethodevent.html">QInputMethodEvent</a></span> * <i>event</i> )<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><b>See also </b><a href="qgraphicsitem.html#inputMethodEvent">QGraphicsItem::inputMethodEvent</a>().</p>
<!-- @@@inputMethodEvent -->
<!-- $$$inputMethodQuery[overload1]$$$inputMethodQueryQt::InputMethodQuery -->
<h3 class="fn"><a name="inputMethodQuery"></a><span class="type"><a href="qvariant.html">QVariant</a></span> QGraphicsScene::<span class="name">inputMethodQuery</span> ( <span class="type"><a href="qt.html#InputMethodQuery-enum">Qt::InputMethodQuery</a></span> <i>query</i> ) const<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><b>See also </b><a href="qwidget.html#inputMethodQuery">QWidget::inputMethodQuery</a>().</p>
<!-- @@@inputMethodQuery -->
<!-- $$$invalidate[overload1]$$$invalidateconstQRectF&SceneLayers -->
<h3 class="fn"><a name="invalidate"></a><span class="type">void</span> QGraphicsScene::<span class="name">invalidate</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i> = QRectF(), <span class="type"><a href="qgraphicsscene.html#SceneLayer-enum">SceneLayers</a></span> <i>layers</i> = AllLayers )<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 class="cpp"> <span class="type"><a href="qrectf.html">QRectF</a></span> TileScene<span class="operator">::</span>rectForTile(<span class="type">int</span> x<span class="operator">,</span> <span class="type">int</span> y) <span class="keyword">const</span>
 {
     <span class="comment">// Return the rectangle for the tile at position (x, y).</span>
     <span class="keyword">return</span> <span class="type"><a href="qrectf.html">QRectF</a></span>(x <span class="operator">*</span> tileWidth<span class="operator">,</span> y <span class="operator">*</span> tileHeight<span class="operator">,</span> tileWidth<span class="operator">,</span> tileHeight);
 }

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

 <span class="type">void</span> TileScene<span class="operator">::</span>drawBackground(<span class="type"><a href="qpainter.html">QPainter</a></span> <span class="operator">*</span>painter<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qrectf.html">QRectF</a></span> <span class="operator">&amp;</span>exposed)
 {
     <span class="comment">// Draws all tiles that intersect the exposed area.</span>
     <span class="keyword">for</span> (<span class="type">int</span> y <span class="operator">=</span> <span class="number">0</span>; y <span class="operator">&lt;</span> numTilesV; <span class="operator">+</span><span class="operator">+</span>y) {
         <span class="keyword">for</span> (<span class="type">int</span> x <span class="operator">=</span> <span class="number">0</span>; x <span class="operator">&lt;</span> numTilesH; <span class="operator">+</span><span class="operator">+</span>x) {
             <span class="type"><a href="qrectf.html">QRectF</a></span> rect <span class="operator">=</span> rectForTile(x<span class="operator">,</span> y);
             <span class="keyword">if</span> (exposed<span class="operator">.</span>intersects(rect))
                 painter<span class="operator">-</span><span class="operator">&gt;</span>drawPixmap(rect<span class="operator">.</span>topLeft()<span class="operator">,</span> tiles<span class="operator">[</span>y<span class="operator">]</span><span class="operator">[</span>x<span class="operator">]</span>);
         }
     }
 }</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><b>See also </b><a href="qgraphicsview.html#resetCachedContent">QGraphicsView::resetCachedContent</a>().</p>
<!-- @@@invalidate -->
<!-- $$$invalidate$$$invalidateqrealqrealqrealqrealSceneLayers -->
<h3 class="fn"><a name="invalidate-2"></a><span class="type">void</span> QGraphicsScene::<span class="name">invalidate</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>h</i>, <span class="type"><a href="qgraphicsscene.html#SceneLayer-enum">SceneLayers</a></span> <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>
<!-- @@@invalidate -->
<!-- $$$isActive[overload1]$$$isActive -->
<h3 class="fn"><a name="isActive"></a><span class="type">bool</span> QGraphicsScene::<span class="name">isActive</span> () 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><b>See also </b><a href="qgraphicsitem.html#isActive">QGraphicsItem::isActive</a>() and <a href="qwidget.html#isActiveWindow-prop">QWidget::isActiveWindow</a>().</p>
<!-- @@@isActive -->
<!-- $$$itemAt[overload1]$$$itemAtconstQPointF&constQTransform& -->
<h3 class="fn"><a name="itemAt"></a><span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * QGraphicsScene::<span class="name">itemAt</span> ( const <span class="type"><a href="qpointf.html">QPointF</a></span> &amp; <i>position</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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><b>See also </b><a href="qgraphicsscene.html#items">items</a>(), <a href="qgraphicsscene.html#collidingItems">collidingItems</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@itemAt -->
<!-- $$$itemAt$$$itemAtqrealqrealconstQTransform& -->
<h3 class="fn"><a name="itemAt-3"></a><span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * QGraphicsScene::<span class="name">itemAt</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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>
<!-- @@@itemAt -->
<!-- $$$items[overload1]$$$items -->
<h3 class="fn"><a name="items"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">items</span> () const</h3>
<p>Returns a list of all items in the scene in descending stacking order.</p>
<p><b>See also </b><a href="qgraphicsscene.html#addItem">addItem</a>(), <a href="qgraphicsscene.html#removeItem">removeItem</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsQt::SortOrder -->
<h3 class="fn"><a name="items-2"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">items</span> ( <span class="type"><a href="qt.html#SortOrder-enum">Qt::SortOrder</a></span> <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><b>See also </b><a href="qgraphicsscene.html#addItem">addItem</a>(), <a href="qgraphicsscene.html#removeItem">removeItem</a>(), and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQPointF&Qt::ItemSelectionModeQt::SortOrderconstQTransform& -->
<h3 class="fn"><a name="items-3"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">items</span> ( const <span class="type"><a href="qpointf.html">QPointF</a></span> &amp; <i>pos</i>, <span class="type"><a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i>, <span class="type"><a href="qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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><b>See also </b><a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsqrealqrealqrealqrealQt::ItemSelectionModeQt::SortOrderconstQTransform& -->
<h3 class="fn"><a name="items-7"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">items</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>h</i>, <span class="type"><a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i>, <span class="type"><a href="qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQRectF&Qt::ItemSelectionModeQt::SortOrderconstQTransform& -->
<h3 class="fn"><a name="items-10"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">items</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i>, <span class="type"><a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i>, <span class="type"><a href="qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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><b>See also </b><a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQPolygonF&Qt::ItemSelectionModeQt::SortOrderconstQTransform& -->
<h3 class="fn"><a name="items-11"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">items</span> ( const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp; <i>polygon</i>, <span class="type"><a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i>, <span class="type"><a href="qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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><b>See also </b><a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$items$$$itemsconstQPainterPath&Qt::ItemSelectionModeQt::SortOrderconstQTransform& -->
<h3 class="fn"><a name="items-12"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">items</span> ( const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp; <i>path</i>, <span class="type"><a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i>, <span class="type"><a href="qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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><b>See also </b><a href="qgraphicsscene.html#itemAt">itemAt</a>() and <a href="qgraphicsitem.html#sorting">Sorting</a>.</p>
<!-- @@@items -->
<!-- $$$itemsBoundingRect[overload1]$$$itemsBoundingRect -->
<h3 class="fn"><a name="itemsBoundingRect"></a><span class="type"><a href="qrectf.html">QRectF</a></span> QGraphicsScene::<span class="name">itemsBoundingRect</span> () 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><b>See also </b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>().</p>
<!-- @@@itemsBoundingRect -->
<!-- $$$keyPressEvent[overload1]$$$keyPressEventQKeyEvent* -->
<h3 class="fn"><a name="keyPressEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">keyPressEvent</span> ( <span class="type"><a href="qkeyevent.html">QKeyEvent</a></span> * <i>keyEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#keyPressEvent">QGraphicsItem::keyPressEvent</a>() and <a href="qgraphicsscene.html#focusItem">focusItem</a>().</p>
<!-- @@@keyPressEvent -->
<!-- $$$keyReleaseEvent[overload1]$$$keyReleaseEventQKeyEvent* -->
<h3 class="fn"><a name="keyReleaseEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">keyReleaseEvent</span> ( <span class="type"><a href="qkeyevent.html">QKeyEvent</a></span> * <i>keyEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#keyReleaseEvent">QGraphicsItem::keyReleaseEvent</a>() and <a href="qgraphicsscene.html#focusItem">focusItem</a>().</p>
<!-- @@@keyReleaseEvent -->
<!-- $$$mouseDoubleClickEvent[overload1]$$$mouseDoubleClickEventQGraphicsSceneMouseEvent* -->
<h3 class="fn"><a name="mouseDoubleClickEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">mouseDoubleClickEvent</span> ( <span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> * <i>mouseEvent</i> )<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><b>See also </b><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>
<!-- @@@mouseDoubleClickEvent -->
<!-- $$$mouseGrabberItem[overload1]$$$mouseGrabberItem -->
<h3 class="fn"><a name="mouseGrabberItem"></a><span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * QGraphicsScene::<span class="name">mouseGrabberItem</span> () 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>
<!-- @@@mouseGrabberItem -->
<!-- $$$mouseMoveEvent[overload1]$$$mouseMoveEventQGraphicsSceneMouseEvent* -->
<h3 class="fn"><a name="mouseMoveEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">mouseMoveEvent</span> ( <span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> * <i>mouseEvent</i> )<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><b>See also </b><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>
<!-- @@@mouseMoveEvent -->
<!-- $$$mousePressEvent[overload1]$$$mousePressEventQGraphicsSceneMouseEvent* -->
<h3 class="fn"><a name="mousePressEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">mousePressEvent</span> ( <span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> * <i>mouseEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#mousePressEvent">QGraphicsItem::mousePressEvent</a>() and <a href="qgraphicsitem.html#setAcceptedMouseButtons">QGraphicsItem::setAcceptedMouseButtons</a>().</p>
<!-- @@@mousePressEvent -->
<!-- $$$mouseReleaseEvent[overload1]$$$mouseReleaseEventQGraphicsSceneMouseEvent* -->
<h3 class="fn"><a name="mouseReleaseEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">mouseReleaseEvent</span> ( <span class="type"><a href="qgraphicsscenemouseevent.html">QGraphicsSceneMouseEvent</a></span> * <i>mouseEvent</i> )<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><b>See also </b><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>
<!-- @@@mouseReleaseEvent -->
<!-- $$$removeItem[overload1]$$$removeItemQGraphicsItem* -->
<h3 class="fn"><a name="removeItem"></a><span class="type">void</span> QGraphicsScene::<span class="name">removeItem</span> ( <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * <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><b>See also </b><a href="qgraphicsscene.html#addItem">addItem</a>().</p>
<!-- @@@removeItem -->
<!-- $$$render[overload1]$$$renderQPainter*constQRectF&constQRectF&Qt::AspectRatioMode -->
<h3 class="fn"><a name="render"></a><span class="type">void</span> QGraphicsScene::<span class="name">render</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> * <i>painter</i>, const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>target</i> = QRectF(), const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>source</i> = QRectF(), <span class="type"><a href="qt.html#AspectRatioMode-enum">Qt::AspectRatioMode</a></span> <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 class="cpp"> <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene;
 scene<span class="operator">.</span><a href="qgraphicsscene.html#addItem">addItem</a>(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="type"><a href="qprinter.html">QPrinter</a></span> printer(<span class="type"><a href="qprinter.html">QPrinter</a></span><span class="operator">::</span>HighResolution);
 printer<span class="operator">.</span>setPaperSize(<span class="type"><a href="qprinter.html">QPrinter</a></span><span class="operator">::</span>A4);

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="operator">&amp;</span>printer);
 scene<span class="operator">.</span>render(<span class="operator">&amp;</span>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><b>See also </b><a href="qgraphicsview.html#render">QGraphicsView::render</a>().</p>
<!-- @@@render -->
<!-- $$$sceneRectChanged[overload1]$$$sceneRectChangedconstQRectF& -->
<h3 class="fn"><a name="sceneRectChanged"></a><span class="type">void</span> QGraphicsScene::<span class="name">sceneRectChanged</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i> )<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><b>See also </b><a href="qgraphicsview.html#updateSceneRect">QGraphicsView::updateSceneRect</a>().</p>
<!-- @@@sceneRectChanged -->
<!-- $$$selectedItems[overload1]$$$selectedItems -->
<h3 class="fn"><a name="selectedItems"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> *&gt; QGraphicsScene::<span class="name">selectedItems</span> () const</h3>
<p>Returns a list of all currently selected items. The items are returned in no particular order.</p>
<p><b>See also </b><a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>().</p>
<!-- @@@selectedItems -->
<!-- $$$selectionArea[overload1]$$$selectionArea -->
<h3 class="fn"><a name="selectionArea"></a><span class="type"><a href="qpainterpath.html">QPainterPath</a></span> QGraphicsScene::<span class="name">selectionArea</span> () 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><b>See also </b><a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>().</p>
<!-- @@@selectionArea -->
<!-- $$$selectionChanged[overload1]$$$selectionChanged -->
<h3 class="fn"><a name="selectionChanged"></a><span class="type">void</span> QGraphicsScene::<span class="name">selectionChanged</span> ()<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><b>See also </b><a href="qgraphicsscene.html#setSelectionArea">setSelectionArea</a>(), <a href="qgraphicsscene.html#selectedItems">selectedItems</a>(), and <a href="qgraphicsitem.html#setSelected">QGraphicsItem::setSelected</a>().</p>
<!-- @@@selectionChanged -->
<!-- $$$sendEvent[overload1]$$$sendEventQGraphicsItem*QEvent* -->
<h3 class="fn"><a name="sendEvent"></a><span class="type">bool</span> QGraphicsScene::<span class="name">sendEvent</span> ( <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * <i>item</i>, <span class="type"><a href="qevent.html">QEvent</a></span> * <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><b>See also </b><a href="qgraphicsitem.html#sceneEvent">QGraphicsItem::sceneEvent</a>() and <a href="qgraphicsitem.html#sceneEventFilter">QGraphicsItem::sceneEventFilter</a>().</p>
<!-- @@@sendEvent -->
<!-- $$$setActivePanel[overload1]$$$setActivePanelQGraphicsItem* -->
<h3 class="fn"><a name="setActivePanel"></a><span class="type">void</span> QGraphicsScene::<span class="name">setActivePanel</span> ( <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * <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><b>See also </b><a href="qgraphicsscene.html#activePanel">activePanel</a>(), <a href="qgraphicsscene.html#isActive">isActive</a>(), and <a href="qgraphicsitem.html#isActive">QGraphicsItem::isActive</a>().</p>
<!-- @@@setActivePanel -->
<!-- $$$setActiveWindow[overload1]$$$setActiveWindowQGraphicsWidget* -->
<h3 class="fn"><a name="setActiveWindow"></a><span class="type">void</span> QGraphicsScene::<span class="name">setActiveWindow</span> ( <span class="type"><a href="qgraphicswidget.html">QGraphicsWidget</a></span> * <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><b>See also </b><a href="qgraphicsscene.html#activeWindow">activeWindow</a>() and <a href="qgraphicswidget.html#isActiveWindow">QGraphicsWidget::isActiveWindow</a>().</p>
<!-- @@@setActiveWindow -->
<!-- $$$setFocus[overload1]$$$setFocusQt::FocusReason -->
<h3 class="fn"><a name="setFocus"></a><span class="type">void</span> QGraphicsScene::<span class="name">setFocus</span> ( <span class="type"><a href="qt.html#FocusReason-enum">Qt::FocusReason</a></span> <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><b>See also </b><a href="qgraphicsscene.html#hasFocus">hasFocus</a>(), <a href="qgraphicsscene.html#clearFocus">clearFocus</a>(), and <a href="qgraphicsscene.html#setFocusItem">setFocusItem</a>().</p>
<!-- @@@setFocus -->
<!-- $$$setFocusItem[overload1]$$$setFocusItemQGraphicsItem*Qt::FocusReason -->
<h3 class="fn"><a name="setFocusItem"></a><span class="type">void</span> QGraphicsScene::<span class="name">setFocusItem</span> ( <span class="type"><a href="qgraphicsitem.html">QGraphicsItem</a></span> * <i>item</i>, <span class="type"><a href="qt.html#FocusReason-enum">Qt::FocusReason</a></span> <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><b>See also </b><a href="qgraphicsscene.html#focusItem">focusItem</a>(), <a href="qgraphicsscene.html#hasFocus">hasFocus</a>(), and <a href="qgraphicsscene.html#setFocus">setFocus</a>().</p>
<!-- @@@setFocusItem -->
<!-- $$$setSelectionArea[overload1]$$$setSelectionAreaconstQPainterPath&constQTransform& -->
<h3 class="fn"><a name="setSelectionArea"></a><span class="type">void</span> QGraphicsScene::<span class="name">setSelectionArea</span> ( const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp; <i>path</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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><b>See also </b><a href="qgraphicsscene.html#clearSelection">clearSelection</a>() and <a href="qgraphicsscene.html#selectionArea">selectionArea</a>().</p>
<!-- @@@setSelectionArea -->
<!-- $$$setSelectionArea$$$setSelectionAreaconstQPainterPath&Qt::ItemSelectionModeconstQTransform& -->
<h3 class="fn"><a name="setSelectionArea-4"></a><span class="type">void</span> QGraphicsScene::<span class="name">setSelectionArea</span> ( const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp; <i>path</i>, <span class="type"><a href="qt.html#ItemSelectionMode-enum">Qt::ItemSelectionMode</a></span> <i>mode</i>, const <span class="type"><a href="qtransform.html">QTransform</a></span> &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><b>See also </b><a href="qgraphicsscene.html#clearSelection">clearSelection</a>() and <a href="qgraphicsscene.html#selectionArea">selectionArea</a>().</p>
<!-- @@@setSelectionArea -->
<!-- $$$setStyle[overload1]$$$setStyleQStyle* -->
<h3 class="fn"><a name="setStyle"></a><span class="type">void</span> QGraphicsScene::<span class="name">setStyle</span> ( <span class="type"><a href="qstyle.html">QStyle</a></span> * <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><b>See also </b><a href="qgraphicsscene.html#style">style</a>().</p>
<!-- @@@setStyle -->
<!-- $$$style[overload1]$$$style -->
<h3 class="fn"><a name="style"></a><span class="type"><a href="qstyle.html">QStyle</a></span> * QGraphicsScene::<span class="name">style</span> () 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><b>See also </b><a href="qgraphicsscene.html#setStyle">setStyle</a>().</p>
<!-- @@@style -->
<!-- $$$update[overload1]$$$updateconstQRectF& -->
<h3 class="fn"><a name="update"></a><span class="type">void</span> QGraphicsScene::<span class="name">update</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rect</i> = QRectF() )<tt> [slot]</tt></h3>
<p>Schedules a redraw of the area <i>rect</i> on the scene.</p>
<p><b>See also </b><a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>() and <a href="qgraphicsscene.html#changed">changed</a>().</p>
<!-- @@@update -->
<!-- $$$update$$$updateqrealqrealqrealqreal -->
<h3 class="fn"><a name="update-2"></a><span class="type">void</span> QGraphicsScene::<span class="name">update</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>w</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <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>
<!-- @@@update -->
<!-- $$$views[overload1]$$$views -->
<h3 class="fn"><a name="views"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span> *&gt; QGraphicsScene::<span class="name">views</span> () const</h3>
<p>Returns a list of all the views that display this scene.</p>
<p><b>See also </b><a href="qgraphicsview.html#scene">QGraphicsView::scene</a>().</p>
<!-- @@@views -->
<!-- $$$wheelEvent[overload1]$$$wheelEventQGraphicsSceneWheelEvent* -->
<h3 class="fn"><a name="wheelEvent"></a><span class="type">void</span> QGraphicsScene::<span class="name">wheelEvent</span> ( <span class="type"><a href="qgraphicsscenewheelevent.html">QGraphicsSceneWheelEvent</a></span> * <i>wheelEvent</i> )<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><b>See also </b><a href="qgraphicsitem.html#wheelEvent">QGraphicsItem::wheelEvent</a>().</p>
<!-- @@@wheelEvent -->
<!-- $$$width[overload1]$$$width -->
<h3 class="fn"><a name="width"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QGraphicsScene::<span class="name">width</span> () const</h3>
<p>This convenience function is equivalent to calling <a href="qgraphicsscene.html#sceneRect-prop">sceneRect</a>().width().</p>
<p><b>See also </b><a href="qgraphicsscene.html#height">height</a>().</p>
<!-- @@@width -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>