Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 4457

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" />
<!-- q3canvas.cpp -->
  <title>Qt 4.8: Q3Canvas 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="qt3support.html">Qt3Support</a></li>
<li>Q3Canvas</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-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="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3Canvas Class Reference</h1>
<!-- $$$Q3Canvas-brief -->
<p>The Q3Canvas class provides a 2D area that can contain <a href="q3canvasitem.html">Q3CanvasItem</a> objects. <a href="#details">More...</a></p>
<!-- @@@Q3Canvas -->
<pre class="cpp"> <span class="preprocessor">#include &lt;Q3Canvas&gt;</span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qcanvas">Porting to Qt 4</a> for more information.</p>
<p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<ul>
<li><a href="q3canvas-members.html">List of all members, including inherited members</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="q3canvas.html#Q3Canvas">Q3Canvas</a></b> ( QObject * <i>parent</i> = 0, const char * <i>name</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#Q3Canvas-2">Q3Canvas</a></b> ( int <i>w</i>, int <i>h</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#Q3Canvas-3">Q3Canvas</a></b> ( QPixmap <i>p</i>, int <i>h</i>, int <i>v</i>, int <i>tilewidth</i>, int <i>tileheight</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#dtor.Q3Canvas">~Q3Canvas</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3CanvasItemList </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#allItems">allItems</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QColor </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#backgroundColor">backgroundColor</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#backgroundPixmap">backgroundPixmap</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#chunkSize">chunkSize</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3CanvasItemList </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#collisions">collisions</a></b> ( const QPoint &amp; <i>p</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3CanvasItemList </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#collisions-2">collisions</a></b> ( const QRect &amp; <i>r</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3CanvasItemList </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#collisions-3">collisions</a></b> ( const Q3PointArray &amp; <i>chunklist</i>, const Q3CanvasItem * <i>item</i>, bool <i>exact</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#drawArea">drawArea</a></b> ( const QRect &amp; <i>clip</i>, QPainter * <i>painter</i>, bool <i>dbuf</i> = false )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#height">height</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#onCanvas">onCanvas</a></b> ( int <i>x</i>, int <i>y</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#onCanvas-2">onCanvas</a></b> ( const QPoint &amp; <i>p</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#rect">rect</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#resize">resize</a></b> ( int <i>w</i>, int <i>h</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#retune">retune</a></b> ( int <i>chunksze</i>, int <i>mxclusters</i> = 100 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setAdvancePeriod">setAdvancePeriod</a></b> ( int <i>ms</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setAllChanged">setAllChanged</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setBackgroundColor">setBackgroundColor</a></b> ( const QColor &amp; <i>c</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setBackgroundPixmap">setBackgroundPixmap</a></b> ( const QPixmap &amp; <i>p</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setChanged">setChanged</a></b> ( const QRect &amp; <i>area</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setDoubleBuffering">setDoubleBuffering</a></b> ( bool <i>y</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setTile">setTile</a></b> ( int <i>x</i>, int <i>y</i>, int <i>tilenum</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setTiles">setTiles</a></b> ( QPixmap <i>p</i>, int <i>h</i>, int <i>v</i>, int <i>tilewidth</i>, int <i>tileheight</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setUnchanged">setUnchanged</a></b> ( const QRect &amp; <i>area</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#setUpdatePeriod">setUpdatePeriod</a></b> ( int <i>ms</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#size">size</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#tile">tile</a></b> ( int <i>x</i>, int <i>y</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#tileHeight">tileHeight</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#tileWidth">tileWidth</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#tilesHorizontally">tilesHorizontally</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#tilesVertically">tilesVertically</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#validChunk">validChunk</a></b> ( int <i>x</i>, int <i>y</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#validChunk-2">validChunk</a></b> ( const QPoint &amp; <i>p</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.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"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#advance">advance</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#update">update</a></b> ()</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="q3canvas.html#resized">resized</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="q3canvas.html#drawBackground">drawBackground</a></b> ( QPainter &amp; <i>painter</i>, const QRect &amp; <i>clip</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3canvas.html#drawForeground">drawForeground</a></b> ( QPainter &amp; <i>painter</i>, const QRect &amp; <i>clip</i> )</td></tr>
</table>
<ul>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$Q3Canvas-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3Canvas class provides a 2D area that can contain <a href="q3canvasitem.html">Q3CanvasItem</a> objects.</p>
<p>The Q3Canvas class manages its 2D graphic area and all the canvas items the area contains. The canvas has no visual appearance of its own. Instead, it is displayed on screen using a <a href="q3canvasview.html">Q3CanvasView</a>. Multiple <a href="q3canvasview.html">Q3CanvasView</a> widgets may be associated with a canvas to provide multiple views of the same canvas.</p>
<p>The canvas is optimized for large numbers of items, particularly where only a small percentage of the items change at any one time. If the entire display changes very frequently, you should consider using your own custom <a href="q3scrollview.html">Q3ScrollView</a> subclass.</p>
<p>Qt provides a rich set of canvas item classes, e.g&#x2e; <a href="q3canvasellipse.html">Q3CanvasEllipse</a>, <a href="q3canvasline.html">Q3CanvasLine</a>, <a href="q3canvaspolygon.html">Q3CanvasPolygon</a>, <a href="q3canvaspolygonalitem.html">Q3CanvasPolygonalItem</a>, <a href="q3canvasrectangle.html">Q3CanvasRectangle</a>, <a href="q3canvasspline.html">Q3CanvasSpline</a>, <a href="q3canvassprite.html">Q3CanvasSprite</a> and <a href="q3canvastext.html">Q3CanvasText</a>. You can subclass to create your own canvas items; <a href="q3canvaspolygonalitem.html">Q3CanvasPolygonalItem</a> is the most common base class used for this purpose.</p>
<p>Items appear on the canvas after their <a href="q3canvasitem.html#show">show()</a> function has been called (or <a href="q3canvasitem.html#setVisible">setVisible(true)</a>), and <i>after</i> <a href="q3canvas.html#update">update</a>() has been called. The canvas only shows items that are <a href="q3canvasitem.html#setVisible">visible</a>, and then only if <a href="q3canvas.html#update">update</a>() is called. (By default the canvas is white and so are canvas items, so if nothing appears try changing colors.)</p>
<p>If you created the canvas without passing a width and height to the constructor you must also call <a href="q3canvas.html#resize">resize</a>().</p>
<p>Although a canvas may appear to be similar to a widget with child widgets, there are several notable differences:</p>
<ul>
<li>Canvas items are usually much faster to manipulate and redraw than child widgets, with the speed advantage becoming especially great when there are <i>many</i> canvas items and non-rectangular items. In most situations canvas items are also a lot more memory efficient than child widgets.</li>
<li>It's easy to detect overlapping items (collision detection).</li>
<li>The canvas can be larger than a widget. A million-by-million canvas is perfectly possible. At such a size a widget might be very inefficient, and some window systems might not support it at all, whereas Q3Canvas scales well. Even with a billion pixels and a million items, finding a particular canvas item, detecting collisions, etc., is still fast (though the memory consumption may be prohibitive at such extremes).</li>
<li>Two or more <a href="q3canvasview.html">Q3CanvasView</a> objects can view the same canvas.</li>
<li>An arbitrary transformation matrix can be set on each <a href="q3canvasview.html">Q3CanvasView</a> which makes it easy to zoom, rotate or shear the viewed canvas.</li>
<li>Widgets provide a lot more functionality, such as input (<a href="qkeyevent.html">QKeyEvent</a>, <a href="qmouseevent.html">QMouseEvent</a> etc.) and layout management (<a href="qgridlayout.html">QGridLayout</a> etc.)&#x2e;</li>
</ul>
<p>A canvas consists of a background, a number of canvas items organized by x, y and z coordinates, and a foreground. A canvas item's z coordinate can be treated as a layer number -- canvas items with a higher z coordinate appear in front of canvas items with a lower z coordinate.</p>
<p>The background is white by default, but can be set to a different color using <a href="q3canvas.html#setBackgroundColor">setBackgroundColor</a>(), or to a repeated pixmap using <a href="q3canvas.html#setBackgroundPixmap">setBackgroundPixmap</a>() or to a mosaic of smaller pixmaps using <a href="q3canvas.html#setTiles">setTiles</a>(). Individual tiles can be set with <a href="q3canvas.html#setTile">setTile</a>(). There are corresponding get functions, e.g&#x2e; <a href="q3canvas.html#backgroundColor">backgroundColor</a>() and <a href="q3canvas.html#backgroundPixmap">backgroundPixmap</a>().</p>
<p>Note that Q3Canvas does not inherit from <a href="qwidget.html">QWidget</a>, even though it has some functions which provide the same functionality as those in <a href="qwidget.html">QWidget</a>. One of these is <a href="q3canvas.html#setBackgroundPixmap">setBackgroundPixmap</a>(); some others are <a href="q3canvas.html#resize">resize</a>(), <a href="q3canvas.html#size">size</a>(), <a href="q3canvas.html#width">width</a>() and <a href="q3canvas.html#height">height</a>(). <a href="q3canvasview.html">Q3CanvasView</a> is the widget used to display a canvas on the screen.</p>
<p>Canvas items are added to a canvas by constructing them and passing the canvas to the canvas item's constructor. An item can be moved to a different canvas using <a href="q3canvasitem.html#setCanvas">Q3CanvasItem::setCanvas</a>().</p>
<p>Canvas items are movable (and in the case of Q3CanvasSprites, animated) objects that inherit <a href="q3canvasitem.html">Q3CanvasItem</a>. Each canvas item has a position on the canvas (x, y coordinates) and a height (z coordinate), all of which are held as floating-point numbers. Moving canvas items also have x and y velocities. It's possible for a canvas item to be outside the canvas (for example <a href="q3canvasitem.html#x">Q3CanvasItem::x</a>() is greater than <a href="q3canvas.html#width">width</a>()). When a canvas item is off the canvas, <a href="q3canvas.html#onCanvas">onCanvas</a>() returns false and the canvas disregards the item. (Canvas items off the canvas do not slow down any of the common operations on the canvas.)</p>
<p>Canvas items can be moved with <a href="q3canvasitem.html#move">Q3CanvasItem::move</a>(). The <a href="q3canvas.html#advance">advance</a>() function moves all <a href="q3canvasitem.html#animated">Q3CanvasItem::animated</a>() canvas items and <a href="q3canvas.html#setAdvancePeriod">setAdvancePeriod</a>() makes Q3Canvas move them automatically on a periodic basis. In the context of the Q3Canvas classes, to `animate' a canvas item is to set it in motion, i.e&#x2e; using <a href="q3canvasitem.html#setVelocity">Q3CanvasItem::setVelocity</a>(). Animation of a canvas item itself, i.e&#x2e; items which change over time, is enabled by calling <a href="q3canvassprite.html#setFrameAnimation">Q3CanvasSprite::setFrameAnimation</a>(), or more generally by subclassing and reimplementing <a href="q3canvasitem.html#advance">Q3CanvasItem::advance</a>(). To detect collisions use one of the <a href="q3canvasitem.html#collisions">Q3CanvasItem::collisions</a>() functions.</p>
<p>The changed parts of the canvas are redrawn (if they are visible in a canvas view) whenever <a href="q3canvas.html#update">update</a>() is called. You can either call <a href="q3canvas.html#update">update</a>() manually after having changed the contents of the canvas, or force periodic updates using <a href="q3canvas.html#setUpdatePeriod">setUpdatePeriod</a>(). If you have moving objects on the canvas, you must call <a href="q3canvas.html#advance">advance</a>() every time the objects should move one step further. Periodic calls to <a href="q3canvas.html#advance">advance</a>() can be forced using <a href="q3canvas.html#setAdvancePeriod">setAdvancePeriod</a>(). The <a href="q3canvas.html#advance">advance</a>() function will call <a href="q3canvasitem.html#advance">Q3CanvasItem::advance</a>() on every item that is <a href="q3canvasitem.html#animated">animated</a> and trigger an update of the affected areas afterwards. (A canvas item that is `animated' is simply a canvas item that is in motion.)</p>
<p>Q3Canvas organizes its canvas items into <i>chunks</i>; these are areas on the canvas that are used to speed up most operations. Many operations start by eliminating most chunks (i.e&#x2e; those which haven't changed) and then process only the canvas items that are in the few interesting (i.e&#x2e; changed) chunks. A valid chunk, <a href="q3canvas.html#validChunk">validChunk</a>(), is one which is on the canvas.</p>
<p>The chunk size is a key factor to Q3Canvas's speed: if there are too many chunks, the speed benefit of grouping canvas items into chunks is reduced. If the chunks are too large, it takes too long to process each one. The Q3Canvas constructor tries to pick a suitable size, but you can call <a href="q3canvas.html#retune">retune</a>() to change it at any time. The <a href="q3canvas.html#chunkSize">chunkSize</a>() function returns the current chunk size. The canvas items always make sure they're in the right chunks; all you need to make sure of is that the canvas uses the right chunk size. A good rule of thumb is that the size should be a bit smaller than the average canvas item size. If you have moving objects, the chunk size should be a bit smaller than the average size of the moving items.</p>
<p>The foreground is normally nothing, but if you reimplement <a href="q3canvas.html#drawForeground">drawForeground</a>(), you can draw things in front of all the canvas items.</p>
<p>Areas can be set as changed with <a href="q3canvas.html#setChanged">setChanged</a>() and set unchanged with <a href="q3canvas.html#setUnchanged">setUnchanged</a>(). The entire canvas can be set as changed with <a href="q3canvas.html#setAllChanged">setAllChanged</a>(). A list of all the items on the canvas is returned by <a href="q3canvas.html#allItems">allItems</a>().</p>
<p>An area can be copied (painted) to a <a href="qpainter.html">QPainter</a> with <a href="q3canvas.html#drawArea">drawArea</a>().</p>
<p>If the canvas is resized it emits the <a href="q3canvas.html#resized">resized</a>() signal.</p>
<p>The examples/canvas application and the 2D graphics page of the examples/demo application demonstrate many of Q3Canvas's facilities.</p>
</div>
<p><b>See also </b><a href="q3canvasview.html">Q3CanvasView</a>, <a href="q3canvasitem.html">Q3CanvasItem</a>, <a href="http://www.qt.io/product/">QtCanvas</a>, and <a href="graphicsview-porting.html">Porting to Graphics View</a>.</p>
<!-- @@@Q3Canvas -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3Canvas[overload1]$$$Q3CanvasQObject*constchar* -->
<h3 class="fn"><a name="Q3Canvas"></a>Q3Canvas::<span class="name">Q3Canvas</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0, const <span class="type">char</span> * <i>name</i> = 0 )</h3>
<p>Create a <a href="q3canvas.html" class="compat">Q3Canvas</a> with no size. <i>parent</i> and <i>name</i> are passed to the <a href="qobject.html">QObject</a> superclass.</p>
<p><b>Warning:</b> You <i>must</i> call <a href="q3canvas.html#resize">resize</a>() at some time after creation to be able to use the canvas.</p>
<!-- @@@Q3Canvas -->
<!-- $$$Q3Canvas$$$Q3Canvasintint -->
<h3 class="fn"><a name="Q3Canvas-2"></a>Q3Canvas::<span class="name">Q3Canvas</span> ( <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i> )</h3>
<p>Constructs a <a href="q3canvas.html" class="compat">Q3Canvas</a> that is <i>w</i> pixels wide and <i>h</i> pixels high.</p>
<!-- @@@Q3Canvas -->
<!-- $$$Q3Canvas$$$Q3CanvasQPixmapintintintint -->
<h3 class="fn"><a name="Q3Canvas-3"></a>Q3Canvas::<span class="name">Q3Canvas</span> ( <span class="type"><a href="qpixmap.html">QPixmap</a></span> <i>p</i>, <span class="type">int</span> <i>h</i>, <span class="type">int</span> <i>v</i>, <span class="type">int</span> <i>tilewidth</i>, <span class="type">int</span> <i>tileheight</i> )</h3>
<p>Constructs a <a href="q3canvas.html" class="compat">Q3Canvas</a> which will be composed of <i>h</i> tiles horizontally and <i>v</i> tiles vertically. Each tile will be an image <i>tilewidth</i> by <i>tileheight</i> pixels taken from pixmap <i>p</i>.</p>
<p>The pixmap <i>p</i> is a list of tiles, arranged left to right, (and in the case of pixmaps that have multiple rows of tiles, top to bottom), with tile 0 in the top-left corner, tile 1 next to the right, and so on, e.g&#x2e;</p>
<table class="generic">
<tr valign="top" class="odd"><td >0</td><td >1</td><td >2</td><td >3</td></tr>
<tr valign="top" class="even"><td >4</td><td >5</td><td >6</td><td >7</td></tr>
</table>
<p>The <a href="q3canvas.html" class="compat">Q3Canvas</a> is initially sized to show exactly the given number of tiles horizontally and vertically. If it is resized to be larger, the entire matrix of tiles will be repeated as often as necessary to cover the area. If it is smaller, tiles to the right and bottom will not be visible.</p>
<p><b>See also </b><a href="q3canvas.html#setTiles">setTiles</a>().</p>
<!-- @@@Q3Canvas -->
<!-- $$$~Q3Canvas[overload1]$$$~Q3Canvas -->
<h3 class="fn"><a name="dtor.Q3Canvas"></a>Q3Canvas::<span class="name">~Q3Canvas</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the canvas and all the canvas's canvas items.</p>
<!-- @@@~Q3Canvas -->
<!-- $$$advance[overload1]$$$advance -->
<h3 class="fn"><a name="advance"></a><span class="type">void</span> Q3Canvas::<span class="name">advance</span> ()<tt> [virtual slot]</tt></h3>
<p>Moves all <a href="q3canvasitem.html#animated">Q3CanvasItem::animated</a>() canvas items on the canvas and refreshes all changes to all views of the canvas. (An `animated' item is an item that is in motion; see setVelocity().)</p>
<p>The advance takes place in two phases. In phase 0, the <a href="q3canvasitem.html#advance">Q3CanvasItem::advance</a>() function of each <a href="q3canvasitem.html#animated">Q3CanvasItem::animated</a>() canvas item is called with parameter 0. Then all these canvas items are called again, with parameter 1. In phase 0, the canvas items should not change position, merely examine other items on the canvas for which special processing is required, such as collisions between items. In phase 1, all canvas items should change positions, ignoring any other items on the canvas. This two-phase approach allows for considerations of &quot;fairness&quot;, although no <a href="q3canvasitem.html" class="compat">Q3CanvasItem</a> subclasses supplied with Qt do anything interesting in phase 0.</p>
<p>The canvas can be configured to call this function periodically with <a href="q3canvas.html#setAdvancePeriod">setAdvancePeriod</a>().</p>
<p><b>See also </b><a href="q3canvas.html#update">update</a>().</p>
<!-- @@@advance -->
<!-- $$$allItems[overload1]$$$allItems -->
<h3 class="fn"><a name="allItems"></a><span class="type"><a href="q3canvasitemlist.html">Q3CanvasItemList</a></span> Q3Canvas::<span class="name">allItems</span> ()</h3>
<p>Returns a list of all the items in the canvas.</p>
<!-- @@@allItems -->
<!-- $$$backgroundColor[overload1]$$$backgroundColor -->
<h3 class="fn"><a name="backgroundColor"></a><span class="type"><a href="qcolor.html">QColor</a></span> Q3Canvas::<span class="name">backgroundColor</span> () const</h3>
<p>Returns the color set by <a href="q3canvas.html#setBackgroundColor">setBackgroundColor</a>(). By default, this is white.</p>
<p>This function is not a reimplementation of QWidget::backgroundColor() (<a href="q3canvas.html" class="compat">Q3Canvas</a> is not a subclass of <a href="qwidget.html">QWidget</a>), but all Q3CanvasViews that are viewing the canvas will set their backgrounds to this color.</p>
<p><b>See also </b><a href="q3canvas.html#setBackgroundColor">setBackgroundColor</a>() and <a href="q3canvas.html#backgroundPixmap">backgroundPixmap</a>().</p>
<!-- @@@backgroundColor -->
<!-- $$$backgroundPixmap[overload1]$$$backgroundPixmap -->
<h3 class="fn"><a name="backgroundPixmap"></a><span class="type"><a href="qpixmap.html">QPixmap</a></span> Q3Canvas::<span class="name">backgroundPixmap</span> () const</h3>
<p>Returns the pixmap set by <a href="q3canvas.html#setBackgroundPixmap">setBackgroundPixmap</a>(). By default, this is a null pixmap.</p>
<p><b>See also </b><a href="q3canvas.html#setBackgroundPixmap">setBackgroundPixmap</a>() and <a href="q3canvas.html#backgroundColor">backgroundColor</a>().</p>
<!-- @@@backgroundPixmap -->
<!-- $$$chunkSize[overload1]$$$chunkSize -->
<h3 class="fn"><a name="chunkSize"></a><span class="type">int</span> Q3Canvas::<span class="name">chunkSize</span> () const</h3>
<p>Returns the chunk size of the canvas.</p>
<p><b>See also </b><a href="q3canvas.html#retune">retune</a>().</p>
<!-- @@@chunkSize -->
<!-- $$$collisions[overload1]$$$collisionsconstQPoint& -->
<h3 class="fn"><a name="collisions"></a><span class="type"><a href="q3canvasitemlist.html">Q3CanvasItemList</a></span> Q3Canvas::<span class="name">collisions</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp; <i>p</i> ) const</h3>
<p>Returns a list of canvas items that collide with the point <i>p</i>. The list is ordered by z coordinates, from highest z coordinate (front-most item) to lowest z coordinate (rear-most item).</p>
<!-- @@@collisions -->
<!-- $$$collisions$$$collisionsconstQRect& -->
<h3 class="fn"><a name="collisions-2"></a><span class="type"><a href="q3canvasitemlist.html">Q3CanvasItemList</a></span> Q3Canvas::<span class="name">collisions</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>r</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a list of items which collide with the rectangle <i>r</i>. The list is ordered by z coordinates, from highest z coordinate (front-most item) to lowest z coordinate (rear-most item).</p>
<!-- @@@collisions -->
<!-- $$$collisions$$$collisionsconstQ3PointArray&constQ3CanvasItem*bool -->
<h3 class="fn"><a name="collisions-3"></a><span class="type"><a href="q3canvasitemlist.html">Q3CanvasItemList</a></span> Q3Canvas::<span class="name">collisions</span> ( const <span class="type"><a href="q3pointarray.html">Q3PointArray</a></span> &amp; <i>chunklist</i>, const <span class="type"><a href="q3canvasitem.html">Q3CanvasItem</a></span> * <i>item</i>, <span class="type">bool</span> <i>exact</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a list of canvas items which intersect with the chunks listed in <i>chunklist</i>, excluding <i>item</i>. If <i>exact</i> is true, only those which actually <a href="q3canvasitem.html#collidesWith">collide with</a> <i>item</i> are returned; otherwise canvas items are included just for being in the chunks.</p>
<p>This is a utility function mainly used to implement the simpler <a href="q3canvasitem.html#collisions">Q3CanvasItem::collisions</a>() function.</p>
<!-- @@@collisions -->
<!-- $$$drawArea[overload1]$$$drawAreaconstQRect&QPainter*bool -->
<h3 class="fn"><a name="drawArea"></a><span class="type">void</span> Q3Canvas::<span class="name">drawArea</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>clip</i>, <span class="type"><a href="qpainter.html">QPainter</a></span> * <i>painter</i>, <span class="type">bool</span> <i>dbuf</i> = false )</h3>
<p>Paints all canvas items that are in the area <i>clip</i> to <i>painter</i>, using double-buffering if <i>dbuf</i> is true.</p>
<p>e.g&#x2e; to print the canvas to a printer:</p>
<pre class="cpp"> <span class="type"><a href="qprinter.html">QPrinter</a></span> pr;
 <span class="keyword">if</span> (pr<span class="operator">.</span>setup()) {
     <span class="type"><a href="qpainter.html">QPainter</a></span> p(<span class="operator">&amp;</span>pr);
     canvas<span class="operator">.</span>drawArea(canvas<span class="operator">.</span>rect()<span class="operator">,</span> <span class="operator">&amp;</span>p);
 }</pre>
<!-- @@@drawArea -->
<!-- $$$drawBackground[overload1]$$$drawBackgroundQPainter&constQRect& -->
<h3 class="fn"><a name="drawBackground"></a><span class="type">void</span> Q3Canvas::<span class="name">drawBackground</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> &amp; <i>painter</i>, const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>clip</i> )<tt> [virtual protected]</tt></h3>
<p>This virtual function is called for all updates of the canvas. It renders any background graphics using the painter <i>painter</i>, in the area <i>clip</i>. If the canvas has a background pixmap or a tiled background, that graphic is used, otherwise the canvas is cleared using the background color.</p>
<p>If the graphics for an area change, you must explicitly call setChanged(const <a href="qrect.html">QRect</a>&amp;) for the result to be visible when <a href="q3canvas.html#update">update</a>() is next called.</p>
<p><b>See also </b><a href="q3canvas.html#setBackgroundColor">setBackgroundColor</a>(), <a href="q3canvas.html#setBackgroundPixmap">setBackgroundPixmap</a>(), and <a href="q3canvas.html#setTiles">setTiles</a>().</p>
<!-- @@@drawBackground -->
<!-- $$$drawForeground[overload1]$$$drawForegroundQPainter&constQRect& -->
<h3 class="fn"><a name="drawForeground"></a><span class="type">void</span> Q3Canvas::<span class="name">drawForeground</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> &amp; <i>painter</i>, const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>clip</i> )<tt> [virtual protected]</tt></h3>
<p>This virtual function is called for all updates of the canvas. It renders any foreground graphics using the painter <i>painter</i>, in the area <i>clip</i>.</p>
<p>If the graphics for an area change, you must explicitly call setChanged(const <a href="qrect.html">QRect</a>&amp;) for the result to be visible when <a href="q3canvas.html#update">update</a>() is next called.</p>
<p>The default is to draw nothing.</p>
<!-- @@@drawForeground -->
<!-- $$$height[overload1]$$$height -->
<h3 class="fn"><a name="height"></a><span class="type">int</span> Q3Canvas::<span class="name">height</span> () const</h3>
<p>Returns the height of the canvas, in pixels.</p>
<!-- @@@height -->
<!-- $$$onCanvas[overload1]$$$onCanvasintint -->
<h3 class="fn"><a name="onCanvas"></a><span class="type">bool</span> Q3Canvas::<span class="name">onCanvas</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i> ) const</h3>
<p>Returns true if the pixel position (<i>x</i>, <i>y</i>) is on the canvas; otherwise returns false.</p>
<p><b>See also </b><a href="q3canvas.html#validChunk">validChunk</a>().</p>
<!-- @@@onCanvas -->
<!-- $$$onCanvas$$$onCanvasconstQPoint& -->
<h3 class="fn"><a name="onCanvas-2"></a><span class="type">bool</span> Q3Canvas::<span class="name">onCanvas</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp; <i>p</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns true if the pixel position <i>p</i> is on the canvas; otherwise returns false.</p>
<p><b>See also </b><a href="q3canvas.html#validChunk">validChunk</a>().</p>
<!-- @@@onCanvas -->
<!-- $$$rect[overload1]$$$rect -->
<h3 class="fn"><a name="rect"></a><span class="type"><a href="qrect.html">QRect</a></span> Q3Canvas::<span class="name">rect</span> () const</h3>
<p>Returns a rectangle the size of the canvas.</p>
<!-- @@@rect -->
<!-- $$$resize[overload1]$$$resizeintint -->
<h3 class="fn"><a name="resize"></a><span class="type">void</span> Q3Canvas::<span class="name">resize</span> ( <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i> )<tt> [virtual]</tt></h3>
<p>Changes the size of the canvas to have a width of <i>w</i> and a height of <i>h</i>. This is a slow operation.</p>
<!-- @@@resize -->
<!-- $$$resized[overload1]$$$resized -->
<h3 class="fn"><a name="resized"></a><span class="type">void</span> Q3Canvas::<span class="name">resized</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the canvas is resized. Each <a href="q3canvasview.html" class="compat">Q3CanvasView</a> connects to this signal to keep the scrollview's size correct.</p>
<!-- @@@resized -->
<!-- $$$retune[overload1]$$$retuneintint -->
<h3 class="fn"><a name="retune"></a><span class="type">void</span> Q3Canvas::<span class="name">retune</span> ( <span class="type">int</span> <i>chunksze</i>, <span class="type">int</span> <i>mxclusters</i> = 100 )<tt> [virtual]</tt></h3>
<p>Change the efficiency tuning parameters to <i>mxclusters</i> clusters, each of size <i>chunksze</i>. This is a slow operation if there are many objects on the canvas.</p>
<p>The canvas is divided into chunks which are rectangular areas <i>chunksze</i> wide by <i>chunksze</i> high. Use a chunk size which is about the average size of the canvas items. If you choose a chunk size which is too small it will increase the amount of calculation required when drawing since each change will affect many chunks. If you choose a chunk size which is too large the amount of drawing required will increase because for each change, a lot of drawing will be required since there will be many (unchanged) canvas items which are in the same chunk as the changed canvas items.</p>
<p>Internally, a canvas uses a low-resolution &quot;chunk matrix&quot; to keep track of all the items in the canvas. A 64x64 chunk matrix is the default for a 1024x1024 pixel canvas, where each chunk collects canvas items in a 16x16 pixel square. This default is also affected by <a href="q3canvas.html#setTiles">setTiles</a>(). You can tune this default using this function. For example if you have a very large canvas and want to trade off speed for memory then you might set the chunk size to 32 or 64.</p>
<p>The <i>mxclusters</i> argument is the number of rectangular groups of chunks that will be separately drawn. If the canvas has a large number of small, dispersed items, this should be about that number. Our testing suggests that a large number of clusters is almost always best.</p>
<!-- @@@retune -->
<!-- $$$setAdvancePeriod[overload1]$$$setAdvancePeriodint -->
<h3 class="fn"><a name="setAdvancePeriod"></a><span class="type">void</span> Q3Canvas::<span class="name">setAdvancePeriod</span> ( <span class="type">int</span> <i>ms</i> )<tt> [virtual]</tt></h3>
<p>Sets the canvas to call <a href="q3canvas.html#advance">advance</a>() every <i>ms</i> milliseconds. Any previous setting by setAdvancePeriod() or <a href="q3canvas.html#setUpdatePeriod">setUpdatePeriod</a>() is overridden.</p>
<p>If <i>ms</i> is less than 0 advancing will be stopped.</p>
<!-- @@@setAdvancePeriod -->
<!-- $$$setAllChanged[overload1]$$$setAllChanged -->
<h3 class="fn"><a name="setAllChanged"></a><span class="type">void</span> Q3Canvas::<span class="name">setAllChanged</span> ()<tt> [virtual]</tt></h3>
<p>Marks the whole canvas as changed. All views of the canvas will be entirely redrawn when <a href="q3canvas.html#update">update</a>() is called next.</p>
<!-- @@@setAllChanged -->
<!-- $$$setBackgroundColor[overload1]$$$setBackgroundColorconstQColor& -->
<h3 class="fn"><a name="setBackgroundColor"></a><span class="type">void</span> Q3Canvas::<span class="name">setBackgroundColor</span> ( const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; <i>c</i> )<tt> [virtual]</tt></h3>
<p>Sets the solid background to be the color <i>c</i>.</p>
<p><b>See also </b><a href="q3canvas.html#backgroundColor">backgroundColor</a>(), <a href="q3canvas.html#setBackgroundPixmap">setBackgroundPixmap</a>(), and <a href="q3canvas.html#setTiles">setTiles</a>().</p>
<!-- @@@setBackgroundColor -->
<!-- $$$setBackgroundPixmap[overload1]$$$setBackgroundPixmapconstQPixmap& -->
<h3 class="fn"><a name="setBackgroundPixmap"></a><span class="type">void</span> Q3Canvas::<span class="name">setBackgroundPixmap</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>p</i> )<tt> [virtual]</tt></h3>
<p>Sets the solid background to be the pixmap <i>p</i> repeated as necessary to cover the entire canvas.</p>
<p><b>See also </b><a href="q3canvas.html#backgroundPixmap">backgroundPixmap</a>(), <a href="q3canvas.html#setBackgroundColor">setBackgroundColor</a>(), and <a href="q3canvas.html#setTiles">setTiles</a>().</p>
<!-- @@@setBackgroundPixmap -->
<!-- $$$setChanged[overload1]$$$setChangedconstQRect& -->
<h3 class="fn"><a name="setChanged"></a><span class="type">void</span> Q3Canvas::<span class="name">setChanged</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>area</i> )<tt> [virtual]</tt></h3>
<p>Marks <i>area</i> as changed. This <i>area</i> will be redrawn in all views that are showing it when <a href="q3canvas.html#update">update</a>() is called next.</p>
<!-- @@@setChanged -->
<!-- $$$setDoubleBuffering[overload1]$$$setDoubleBufferingbool -->
<h3 class="fn"><a name="setDoubleBuffering"></a><span class="type">void</span> Q3Canvas::<span class="name">setDoubleBuffering</span> ( <span class="type">bool</span> <i>y</i> )<tt> [virtual]</tt></h3>
<p>If <i>y</i> is true (the default) double-buffering is switched on; otherwise double-buffering is switched off.</p>
<p>Turning off double-buffering causes the redrawn areas to flicker a little and also gives a (usually small) performance improvement.</p>
<!-- @@@setDoubleBuffering -->
<!-- $$$setTile[overload1]$$$setTileintintint -->
<h3 class="fn"><a name="setTile"></a><span class="type">void</span> Q3Canvas::<span class="name">setTile</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>tilenum</i> )<tt> [virtual]</tt></h3>
<p>Sets the tile at (<i>x</i>, <i>y</i>) to use tile number <i>tilenum</i>, which is an index into the tile pixmaps. The canvas will update appropriately when <a href="q3canvas.html#update">update</a>() is next called.</p>
<p>The images are taken from the pixmap set by <a href="q3canvas.html#setTiles">setTiles</a>() and are arranged left to right, (and in the case of pixmaps that have multiple rows of tiles, top to bottom), with tile 0 in the top-left corner, tile 1 next to the right, and so on, e.g&#x2e;</p>
<table class="generic">
<tr valign="top" class="odd"><td >0</td><td >1</td><td >2</td><td >3</td></tr>
<tr valign="top" class="even"><td >4</td><td >5</td><td >6</td><td >7</td></tr>
</table>
<p><b>See also </b><a href="q3canvas.html#tile">tile</a>() and <a href="q3canvas.html#setTiles">setTiles</a>().</p>
<!-- @@@setTile -->
<!-- $$$setTiles[overload1]$$$setTilesQPixmapintintintint -->
<h3 class="fn"><a name="setTiles"></a><span class="type">void</span> Q3Canvas::<span class="name">setTiles</span> ( <span class="type"><a href="qpixmap.html">QPixmap</a></span> <i>p</i>, <span class="type">int</span> <i>h</i>, <span class="type">int</span> <i>v</i>, <span class="type">int</span> <i>tilewidth</i>, <span class="type">int</span> <i>tileheight</i> )<tt> [virtual]</tt></h3>
<p>Sets the <a href="q3canvas.html" class="compat">Q3Canvas</a> to be composed of <i>h</i> tiles horizontally and <i>v</i> tiles vertically. Each tile will be an image <i>tilewidth</i> by <i>tileheight</i> pixels from pixmap <i>p</i>.</p>
<p>The pixmap <i>p</i> is a list of tiles, arranged left to right, (and in the case of pixmaps that have multiple rows of tiles, top to bottom), with tile 0 in the top-left corner, tile 1 next to the right, and so on, e.g&#x2e;</p>
<table class="generic">
<tr valign="top" class="odd"><td >0</td><td >1</td><td >2</td><td >3</td></tr>
<tr valign="top" class="even"><td >4</td><td >5</td><td >6</td><td >7</td></tr>
</table>
<p>If the canvas is larger than the matrix of tiles, the entire matrix is repeated as necessary to cover the whole canvas. If it is smaller, tiles to the right and bottom are not visible.</p>
<p>The width and height of <i>p</i> must be a multiple of <i>tilewidth</i> and <i>tileheight</i>. If they are not the function will do nothing.</p>
<p>If you want to unset any tiling set, then just pass in a null pixmap and 0 for <i>h</i>, <i>v</i>, <i>tilewidth</i>, and <i>tileheight</i>.</p>
<!-- @@@setTiles -->
<!-- $$$setUnchanged[overload1]$$$setUnchangedconstQRect& -->
<h3 class="fn"><a name="setUnchanged"></a><span class="type">void</span> Q3Canvas::<span class="name">setUnchanged</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>area</i> )<tt> [virtual]</tt></h3>
<p>Marks <i>area</i> as <i>unchanged</i>. The area will <i>not</i> be redrawn in the views for the next <a href="q3canvas.html#update">update</a>(), unless it is marked or changed again before the next call to <a href="q3canvas.html#update">update</a>().</p>
<!-- @@@setUnchanged -->
<!-- $$$setUpdatePeriod[overload1]$$$setUpdatePeriodint -->
<h3 class="fn"><a name="setUpdatePeriod"></a><span class="type">void</span> Q3Canvas::<span class="name">setUpdatePeriod</span> ( <span class="type">int</span> <i>ms</i> )<tt> [virtual]</tt></h3>
<p>Sets the canvas to call <a href="q3canvas.html#update">update</a>() every <i>ms</i> milliseconds. Any previous setting by <a href="q3canvas.html#setAdvancePeriod">setAdvancePeriod</a>() or setUpdatePeriod() is overridden.</p>
<p>If <i>ms</i> is less than 0 automatic updating will be stopped.</p>
<!-- @@@setUpdatePeriod -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a><span class="type"><a href="qsize.html">QSize</a></span> Q3Canvas::<span class="name">size</span> () const</h3>
<p>Returns the size of the canvas, in pixels.</p>
<!-- @@@size -->
<!-- $$$tile[overload1]$$$tileintint -->
<h3 class="fn"><a name="tile"></a><span class="type">int</span> Q3Canvas::<span class="name">tile</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i> ) const</h3>
<p>Returns the tile at position (<i>x</i>, <i>y</i>). Initially, all tiles are 0.</p>
<p>The parameters must be within range, i.e&#x2e; 0 &lt; <i>x</i> &lt; <a href="q3canvas.html#tilesHorizontally">tilesHorizontally</a>() and 0 &lt; <i>y</i> &lt; <a href="q3canvas.html#tilesVertically">tilesVertically</a>().</p>
<p><b>See also </b><a href="q3canvas.html#setTile">setTile</a>().</p>
<!-- @@@tile -->
<!-- $$$tileHeight[overload1]$$$tileHeight -->
<h3 class="fn"><a name="tileHeight"></a><span class="type">int</span> Q3Canvas::<span class="name">tileHeight</span> () const</h3>
<p>Returns the height of each tile.</p>
<!-- @@@tileHeight -->
<!-- $$$tileWidth[overload1]$$$tileWidth -->
<h3 class="fn"><a name="tileWidth"></a><span class="type">int</span> Q3Canvas::<span class="name">tileWidth</span> () const</h3>
<p>Returns the width of each tile.</p>
<!-- @@@tileWidth -->
<!-- $$$tilesHorizontally[overload1]$$$tilesHorizontally -->
<h3 class="fn"><a name="tilesHorizontally"></a><span class="type">int</span> Q3Canvas::<span class="name">tilesHorizontally</span> () const</h3>
<p>Returns the number of tiles horizontally.</p>
<!-- @@@tilesHorizontally -->
<!-- $$$tilesVertically[overload1]$$$tilesVertically -->
<h3 class="fn"><a name="tilesVertically"></a><span class="type">int</span> Q3Canvas::<span class="name">tilesVertically</span> () const</h3>
<p>Returns the number of tiles vertically.</p>
<!-- @@@tilesVertically -->
<!-- $$$update[overload1]$$$update -->
<h3 class="fn"><a name="update"></a><span class="type">void</span> Q3Canvas::<span class="name">update</span> ()<tt> [virtual slot]</tt></h3>
<p>Repaints changed areas in all views of the canvas.</p>
<p><b>See also </b><a href="q3canvas.html#advance">advance</a>().</p>
<!-- @@@update -->
<!-- $$$validChunk[overload1]$$$validChunkintint -->
<h3 class="fn"><a name="validChunk"></a><span class="type">bool</span> Q3Canvas::<span class="name">validChunk</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i> ) const</h3>
<p>Returns true if the chunk position (<i>x</i>, <i>y</i>) is on the canvas; otherwise returns false.</p>
<p><b>See also </b><a href="q3canvas.html#onCanvas">onCanvas</a>().</p>
<!-- @@@validChunk -->
<!-- $$$validChunk$$$validChunkconstQPoint& -->
<h3 class="fn"><a name="validChunk-2"></a><span class="type">bool</span> Q3Canvas::<span class="name">validChunk</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp; <i>p</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns true if the chunk position <i>p</i> is on the canvas; otherwise returns false.</p>
<p><b>See also </b><a href="q3canvas.html#onCanvas">onCanvas</a>().</p>
<!-- @@@validChunk -->
<!-- $$$width[overload1]$$$width -->
<h3 class="fn"><a name="width"></a><span class="type">int</span> Q3Canvas::<span class="name">width</span> () const</h3>
<p>Returns the width of the canvas, in pixels.</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>