qcanvas.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 569 行 · 第 1/3 页

HTML
569
字号
</h3>Changes the size of the canvas to have a width of <em>w</em> and a height of <em>h</em>.This is a slow operation.<p>Examples: <a href="canvas-example.html#x2686">canvas/canvas.cpp</a> and <a href="canvas-chart-example.html#x2593">chart/chartform.cpp</a>.<h3 class=fn>void <a name="resized"></a>QCanvas::resized ()<tt> [signal]</tt></h3><p> This signal is emitted whenever the canvas is resized. Each <a href="qcanvasview.html">QCanvasView</a>connects to this signal to keep the scrollview size correct.<h3 class=fn>void <a name="retune"></a>QCanvas::retune ( int&nbsp;chunksze, int&nbsp;mxclusters = 100 )<tt> [virtual]</tt></h3><p> Change the efficiency tuning parameters to <em>mxclusters</em> clusters,each of size <em>chunksze</em>. This is a slow operation if there are manyobjects on the canvas.<p> The canvas is divided into chunks which are rectangular areas of the canvas<em>chunksze</em> wide by <em>chunksze</em> high. Use a chunk size which is aboutthe average size of the canvas items. If you choose a chunk size whichis too small it will increase the amount of calculation required whendrawing since each change will affect many chunks. If you choose a chunksize which is too large the amount of drawing required will increasebecause for each change, a lot of drawing will be required since therewill be many (unchanged) canvas items which are in the same chunk as thechanged canvas items.<p> Internally, a canvas uses a low-resolution "chunk matrix" to keeptrack of all the items in the canvas. A 64x64 chunk matrix is thedefault for a 1024x1024 pixel canvas, where each chunk collects canvasitems in a 16x16 pixel square. This default is also affected by<a href="#setTiles">setTiles</a>(). You can tune this default with this function. For exampleif you have a very large canvas and want to trade off speed for memorythen you might set the chunk size to 32 or 64.<p> The <em>mxclusters</em> argument is the number of rectangular groups of chunksthat will be separately drawn. If the canvas has a large number ofsmall, dispersed items, this should be about that number. Our testingsuggests that a large number of clusters is almost always best.<p> <h3 class=fn>void <a name="setAdvancePeriod"></a>QCanvas::setAdvancePeriod ( int&nbsp;ms )<tt> [virtual]</tt></h3>Sets the canvas to call <a href="#advance">advance</a>() every <em>ms</em> milliseconds. Anyprevious setting by <a href="#setAdvancePeriod">setAdvancePeriod</a>() or <a href="#setUpdatePeriod">setUpdatePeriod</a>() isoverridden.<p> If <em>ms</em> is less than 0 advancing will be stopped.<p>Example: <a href="canvas-example.html#x2739">canvas/main.cpp</a>.<h3 class=fn>void <a name="setAllChanged"></a>QCanvas::setAllChanged ()<tt> [virtual]</tt></h3>Marks the whole canvas as changed.All views of the canvas will be entirely redrawn when<a href="#update">update</a>() is called next.<h3 class=fn>void <a name="setBackgroundColor"></a>QCanvas::setBackgroundColor ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;c )<tt> [virtual]</tt></h3>Sets the solid background to be the color <em>c</em>.<p> <p>See also <a href="#backgroundColor">backgroundColor</a>(), <a href="#setBackgroundPixmap">setBackgroundPixmap</a>() and <a href="#setTiles">setTiles</a>().<h3 class=fn>void <a name="setBackgroundPixmap"></a>QCanvas::setBackgroundPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;p )<tt> [virtual]</tt></h3>Sets the solid background to be the pixmap <em>p</em> repeated asnecessary to cover the entire canvas.<p> <p>See also <a href="#backgroundPixmap">backgroundPixmap</a>(), <a href="#setBackgroundColor">setBackgroundColor</a>() and <a href="#setTiles">setTiles</a>().<h3 class=fn>void <a name="setChanged"></a>QCanvas::setChanged ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;area )<tt> [virtual]</tt></h3>Marks <em>area</em> as changed. This area will be redrawn in all viewsthat are showing it when <a href="#update">update</a>() is called next.<h3 class=fn>void <a name="setDoubleBuffering"></a>QCanvas::setDoubleBuffering ( bool&nbsp;y )<tt> [virtual]</tt></h3>If <em>y</em> is TRUE (the default) double-buffering is switched on;otherwise double-buffering is switched off.<p> Turning off double-buffering causes the redrawn areas to flicker abit and also gives a (usually small) performance improvement.<p>Example: <a href="canvas-example.html#x2687">canvas/canvas.cpp</a>.<h3 class=fn>void <a name="setTile"></a>QCanvas::setTile ( int&nbsp;x, int&nbsp;y, int&nbsp;tilenum )<tt> [virtual]</tt></h3>  Sets the tile at (<em>x</em>, <em>y</em>) to use tile number <em>tilenum</em>,which is an index into the tile pixmaps. The canvas will updateappropriately when <a href="#update">update</a>() is next called.<p> The images are taken from the pixmap set by <a href="#setTiles">setTiles</a>() and arearranged left to right, (and in the case of pixmaps that have multiplerows of tiles, top to bottom), with tile 0 in the top-left corner,tile 1 next to the right, and so on, e.g.<p> <center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#f0f0f0"> <td valign="top">0 <td valign="top">1 <td valign="top">2 <td valign="top">3<tr bgcolor="#d0d0d0"> <td valign="top">4 <td valign="top">5 <td valign="top">6 <td valign="top">7</table></center><p> <p>See also <a href="#tile">tile</a>() and <a href="#setTiles">setTiles</a>().<h3 class=fn>void <a name="setTiles"></a>QCanvas::setTiles ( <a href="qpixmap.html">QPixmap</a>&nbsp;p, int&nbsp;h, int&nbsp;v, int&nbsp;tilewidth, int&nbsp;tileheight )<tt> [virtual]</tt></h3>  Sets the QCanvas to be composed of <em>h</em> tiles horizontally and <em>v</em> tiles vertically. Each tile will be an image <em>tilewidth</em> by <em>tileheight</em> pixels from pixmap <em>p</em>.<p> The pixmap <em>p</em> is a list of tiles, arranged left to right, (and inthe 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 soon, e.g.<p> <center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#f0f0f0"> <td valign="top">0 <td valign="top">1 <td valign="top">2 <td valign="top">3<tr bgcolor="#d0d0d0"> <td valign="top">4 <td valign="top">5 <td valign="top">6 <td valign="top">7</table></center><p> If the canvas is larger than the matrix of tiles, the entire matrixis repeated as necessary to cover the whole canvas. If it is smaller,tiles to the right and bottom are not visible.<p> The width and height of <em>p</em> must be a multiple of <em>tilewidth</em> and<em>tileheight</em>. If they are not the function will do nothing.<h3 class=fn>void <a name="setUnchanged"></a>QCanvas::setUnchanged ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;area )<tt> [virtual]</tt></h3>Marks <em>area</em> as <em>unchanged</em>. The area will <em>not</em> be redrawn in theviews for the next <a href="#update">update</a>(), unless it is marked or changed againbefore the next call to update().<h3 class=fn>void <a name="setUpdatePeriod"></a>QCanvas::setUpdatePeriod ( int&nbsp;ms )<tt> [virtual]</tt></h3>Sets the canvas to call <a href="#update">update</a>() every <em>ms</em> milliseconds. Anyprevious setting by <a href="#setAdvancePeriod">setAdvancePeriod</a>() or <a href="#setUpdatePeriod">setUpdatePeriod</a>() isoverridden.<p> If <em>ms</em> is less than 0 automatic updating will be stopped.<h3 class=fn><a href="qsize.html">QSize</a> <a name="size"></a>QCanvas::size () const</h3><p> Returns the size of the canvas, in pixels.<h3 class=fn>int <a name="tile"></a>QCanvas::tile ( int&nbsp;x, int&nbsp;y ) const</h3><p> Returns the tile at position (<em>x</em>, <em>y</em>). Initially, all tiles are 0.<p> The parameters must be within range, i.e.0 &lt; <em>x</em> &lt; <a href="#tilesHorizontally">tilesHorizontally</a>() and0 &lt; <em>y</em> &lt; <a href="#tilesVertically">tilesVertically</a>().<p> <p>See also <a href="#setTile">setTile</a>().<h3 class=fn>int <a name="tileHeight"></a>QCanvas::tileHeight () const</h3><p> Returns the height of each tile.<h3 class=fn>int <a name="tileWidth"></a>QCanvas::tileWidth () const</h3><p> Returns the width of each tile.<h3 class=fn>int <a name="tilesHorizontally"></a>QCanvas::tilesHorizontally () const</h3><p> Returns the number of tiles horizontally.<h3 class=fn>int <a name="tilesVertically"></a>QCanvas::tilesVertically () const</h3><p> Returns the number of tiles vertically.<h3 class=fn>void <a name="update"></a>QCanvas::update ()<tt> [virtual slot]</tt></h3>Repaints changed areas in all views of the canvas.<p> <p>See also <a href="#advance">advance</a>().<h3 class=fn>bool <a name="validChunk"></a>QCanvas::validChunk ( int&nbsp;x, int&nbsp;y ) const</h3><p> Returns TRUE if the chunk position (<em>x</em>, <em>y</em>) is on the canvas;otherwise returns FALSE.<p> <p>See also <a href="#onCanvas">onCanvas</a>().<h3 class=fn>bool <a name="validChunk-2"></a>QCanvas::validChunk ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p ) const</h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> Returns TRUE if the chunk position <em>p</em> is on the canvas; otherwisereturns FALSE.<p> <p>See also <a href="#onCanvas">onCanvas</a>().<h3 class=fn>int <a name="width"></a>QCanvas::width () const</h3><p> Returns the width of the canvas, in pixels.<p>Example: <a href="canvas-example.html#x2688">canvas/canvas.cpp</a>.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright &copy; 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?