📄 qrect.html
字号:
<h3 class=fn>void <a name="rect"></a>QRect::rect ( int * x, int * y, int * w, int * h ) const
</h3>
提取矩形参数为位置<em>*x</em>、<em>*y</em>和宽<em>*w</em>和高<em>*h</em>。
<p> <p>也可以参考<a href="#setRect">setRect</a>()和<a href="#coords">coords</a>()。
<p>实例:<a href="themes-example.html#x260">themes/metal.cpp</a>和<a href="themes-example.html#x201">themes/wood.cpp</a>。
<h3 class=fn>int <a name="right"></a>QRect::right () const
</h3>
<p> 返回矩形的右坐标。
<p> <p>也可以参考<a href="#left">left</a>()、<a href="#setRight">setRight</a>()、<a href="#topRight">topRight</a>()和<a href="#bottomRight">bottomRight</a>()。
<p>实例:<a href="customlayout-example.html#x1353">customlayout/flow.cpp</a>、<a href="desktop-example.html#x1789">desktop/desktop.cpp</a>、<a href="helpviewer-example.html#x1014">helpviewer/helpwindow.cpp</a>、<a href="qfd-example.html#x1987">qfd/fontdisplayer.cpp</a>、<a href="scribble-example.html#x950">scribble/scribble.cpp</a>、<a href="tutorial1-11.html#x2359">t11/cannon.cpp</a>和<a href="themes-example.html#x202">themes/wood.cpp</a>。
<h3 class=fn>void <a name="setBottom"></a>QRect::setBottom ( int pos )
</h3>
<p> 设置矩形的下边缘为<em>pos</em>。也许改变高度,但决不会改变矩形的上边缘。
<p> <p>也可以参考<a href="#bottom">bottom</a>()、<a href="#setTop">setTop</a>()和<a href="#setHeight">setHeight</a>()。
<p>实例:<a href="scribble-example.html#x951">scribble/scribble.cpp</a>。
<h3 class=fn>void <a name="setCoords"></a>QRect::setCoords ( int xp1, int yp1, int xp2, int yp2 )
</h3>
设置矩形的左上角的坐标为<em>(xp1,yp1)</em>,并且它的右下角坐标为<em>(xp2,yp2)</em>。
<p> <p>也可以参考<a href="#coords">coords</a>()和<a href="#setRect">setRect</a>()。
<h3 class=fn>void <a name="setHeight"></a>QRect::setHeight ( int h )
</h3>
设置矩形的高为<em>h</em>。上边缘没有被移动,但是下边缘也许被移动。
<p> <p>也可以参考<a href="#height">height</a>()、<a href="#setTop">setTop</a>()、<a href="#setBottom">setBottom</a>()和<a href="#setSize">setSize</a>()。
<p>实例:<a href="desktop-example.html#x1790">desktop/desktop.cpp</a>。
<h3 class=fn>void <a name="setLeft"></a>QRect::setLeft ( int pos )
</h3>
<p> 设置矩形的左边缘为<em>pos</em>。也许改变宽度,但决不会改变矩形的右边缘。
<p> 与<a href="#setX">setX</a>()一样。
<p> <p>也可以参考<a href="#left">left</a>()、<a href="#setTop">setTop</a>()和<a href="#setWidth">setWidth</a>()。
<p>实例:<a href="scribble-example.html#x952">scribble/scribble.cpp</a>。
<h3 class=fn>void <a name="setRect"></a>QRect::setRect ( int x, int y, int w, int h )
</h3>
设置矩形左上角坐标为<em>(x,y)</em>,并且它的大小为<em>(w,h)</em>。
<p> <p>也可以参考<a href="#rect">rect</a>()和<a href="#setCoords">setCoords</a>()。
<p>实例:<a href="themes-example.html#x203">themes/wood.cpp</a>。
<h3 class=fn>void <a name="setRight"></a>QRect::setRight ( int pos )
</h3>
<p> 设置矩形的右边缘为<em>pos</em>。也许改变宽度,但决不会改变矩形的左边缘。
<p> <p>也可以参考<a href="#right">right</a>()、<a href="#setLeft">setLeft</a>()和<a href="#setWidth">setWidth</a>()。
<p>实例:<a href="scribble-example.html#x953">scribble/scribble.cpp</a>。
<h3 class=fn>void <a name="setSize"></a>QRect::setSize ( const <a href="qsize.html">QSize</a> & s )
</h3>
设置矩形的大小为<em>s</em>。左上角不被移动。
<p> <p>也可以参考<a href="#size">size</a>()、<a href="#setWidth">setWidth</a>()和<a href="#setHeight">setHeight</a>()。
<p>实例:<a href="xform-example.html#x1456">xform/xform.cpp</a>。
<h3 class=fn>void <a name="setTop"></a>QRect::setTop ( int pos )
</h3>
<p> 设置矩形的上边缘为<em>pos</em>。也许改变高度,但决不会改变矩形的下边缘。
<p> 与<a href="#setY">setY</a>()一样。
<p> <p>也可以参考<a href="#top">top</a>()、<a href="#setBottom">setBottom</a>()和<a href="#setHeight">setHeight</a>()。
<p>实例:<a href="scribble-example.html#x954">scribble/scribble.cpp</a>。
<h3 class=fn>void <a name="setWidth"></a>QRect::setWidth ( int w )
</h3>
Sets the width of the rectangle to <em>w</em>。 The right edge is
changed, but not the left edge.
设置矩形的宽为<em>w</em>。右边缘被改变,但是左边缘不会被改变。
<p> <p>也可以参考<a href="#width">width</a>()、<a href="#setLeft">setLeft</a>()、<a href="#setRight">setRight</a>()和<a href="#setSize">setSize</a>()。
<p>实例:<a href="desktop-example.html#x1791">desktop/desktop.cpp</a>。
<h3 class=fn>void <a name="setX"></a>QRect::setX ( int x )
</h3>
<p> 设置矩形的x位置(它的左边)为<em>x</em>。也许会改变宽度,但是不会改变矩形的右边界。
<p> 与<a href="#setLeft">setLeft</a>()一样。
<p> <p>也可以参考<a href="#x">x</a>()和<a href="#setY">setY</a>()。
<h3 class=fn>void <a name="setY"></a>QRect::setY ( int y )
</h3>
<p> 设置矩形的y位置(它的上边)为<em>y</em>。也许会改变高度,但是不会改变矩形的下边界。
<p> 与<a href="#setTop">setTop</a>()一样。
<p> <p>也可以参考<a href="#y">y</a>()和<a href="#setX">setX</a>()。
<h3 class=fn><a href="qsize.html">QSize</a> <a name="size"></a>QRect::size () const
</h3>
<p> 返回矩形的大小。
<p> <p>也可以参考<a href="#width">width</a>()和<a href="#height">height</a>()。
<p>实例:<a href="desktop-example.html#x1792">desktop/desktop.cpp</a>、<a href="movies-example.html#x467">movies/main.cpp</a>和<a href="tutorial1-10.html#x2348">t10/cannon.cpp</a>。
<h3 class=fn>int <a name="top"></a>QRect::top () const
</h3>
<p> 返回矩形的上坐标。与<a href="#y">y</a>()一样。
<p> <p>也可以参考<a href="#y">y</a>()、<a href="#left">left</a>()、<a href="#bottom">bottom</a>()、<a href="#setTop">setTop</a>()、<a href="#topLeft">topLeft</a>()和<a href="#topRight">topRight</a>()。
<p>实例:<a href="coordsys.html#x2440">aclock/aclock.cpp</a>、<a href="desktop-example.html#x1793">desktop/desktop.cpp</a>、<a href="helpviewer-example.html#x1015">helpviewer/helpwindow.cpp</a>、<a href="scribble-example.html#x955">scribble/scribble.cpp</a>、<a href="themes-example.html#x204">themes/wood.cpp</a>、<a href="tictac-example.html#x132">tictac/tictac.cpp</a>和<a href="xform-example.html#x1457">xform/xform.cpp</a>。
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="topLeft"></a>QRect::topLeft () const
</h3>
<p> 返回矩形的左上角位置。
<p> <p>也可以参考<a href="#moveTopLeft">moveTopLeft</a>()、<a href="#topRight">topRight</a>()、<a href="#bottomLeft">bottomLeft</a>()、<a href="#bottomRight">bottomRight</a>()、<a href="#left">left</a>()和<a href="#top">top</a>()。
<p>实例:<a href="tutorial1-10.html#x2349">t10/cannon.cpp</a>和<a href="tictac-example.html#x133">tictac/tictac.cpp</a>。
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="topRight"></a>QRect::topRight () const
</h3>
<p> 返回矩形的右上角位置。
<p> <p>也可以参考<a href="#moveTopRight">moveTopRight</a>()、<a href="#topLeft">topLeft</a>()、<a href="#bottomLeft">bottomLeft</a>()、<a href="#bottomRight">bottomRight</a>()、<a href="#top">top</a>()和<a href="#right">right</a>()。
<p>实例:<a href="tictac-example.html#x134">tictac/tictac.cpp</a>。
<h3 class=fn><a href="qrect.html">QRect</a> <a name="unite"></a>QRect::unite ( const <a href="qrect.html">QRect</a> & r ) const
</h3>
返回这个矩形和矩形<em>r</em>的边界矩形。<tt>r.unite(s)</tt>与<tt>r|s</tt>相同。
<p>实例:<a href="tutorial1-11.html#x2360">t11/cannon.cpp</a>、<a href="tutorial1-12.html#x2382">t12/cannon.cpp</a>和<a href="xform-example.html#x1458">xform/xform.cpp</a>。
<h3 class=fn>int <a name="width"></a>QRect::width () const
</h3>
<p> 返回矩形的宽度。宽度包括左和右边界,比如width = right - left + 1。
<p> <p>也可以参考<a href="#height">height</a>()、<a href="#size">size</a>()和<a href="#setHeight">setHeight</a>()。
<p>实例:<a href="coordsys.html#x2441">aclock/aclock.cpp</a>、<a href="customlayout-example.html#x1376">customlayout/border.cpp</a>、<a href="desktop-example.html#x1794">desktop/desktop.cpp</a>、<a href="movies-example.html#x468">movies/main.cpp</a>、<a href="themes-example.html#x261">themes/metal.cpp</a>、<a href="themes-example.html#x205">themes/wood.cpp</a>和<a href="xform-example.html#x1459">xform/xform.cpp</a>。
<h3 class=fn>int <a name="x"></a>QRect::x () const
</h3>
<p> 返回矩形的左坐标。与<a href="#left">left</a>()一样。
<p> <p>也可以参考<a href="#left">left</a>()、<a href="#y">y</a>()和<a href="#setX">setX</a>()。
<p>实例:<a href="customlayout-example.html#x1377">customlayout/border.cpp</a>、<a href="desktop-example.html#x1795">desktop/desktop.cpp</a>、<a href="movies-example.html#x469">movies/main.cpp</a>、<a href="scribble-example.html#x957">scribble/scribble.cpp</a>、<a href="tutorial1-12.html#x2383">t12/cannon.cpp</a>、<a href="themes-example.html#x262">themes/metal.cpp</a>和<a href="themes-example.html#x206">themes/wood.cpp</a>。
<h3 class=fn>int <a name="y"></a>QRect::y () const
</h3>
<p> 返回矩形的上坐标。与<a href="#top">top</a>()一样。
<p> <p>也可以参考<a href="#top">top</a>()、<a href="#x">x</a>()和<a href="#setY">setY</a>()。
<p>实例:<a href="desktop-example.html#x1796">desktop/desktop.cpp</a>、<a href="movies-example.html#x470">movies/main.cpp</a>、<a href="scribble-example.html#x958">scribble/scribble.cpp</a>、<a href="tutorial1-12.html#x2384">t12/cannon.cpp</a>、<a href="tutorial1-14.html#x2416">t14/cannon.cpp</a>、<a href="themes-example.html#x263">themes/metal.cpp</a>和<a href="themes-example.html#x207">themes/wood.cpp</a>。
<hr><h2>相关函数</h2>
<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const <a href="qrect.html">QRect</a> & r1, const <a href="qrect.html">QRect</a> & r2 )
</h3>
<p> 如果<em>r1</em>和<em>r2</em>不同,返回真,否则返回假。
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qrect.html">QRect</a> & r )
</h3>
<p> 写这个QRect<em>r</em>到流<em>s</em>中,并且返回这个流的引用。
<p> <p>也可以参考<a href="datastreamformat.html">QDataStream操作符的格式</a>。
<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const <a href="qrect.html">QRect</a> & r1, const <a href="qrect.html">QRect</a> & r2 )
</h3>
<p> 如果<em>r1</em>和<em>r2</em>相等,返回真,否则返回假。
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qrect.html">QRect</a> & r )
</h3>
<p> 从流<em>s</em>读一个QRect到<em>r</em>中,并且返回这个流的引用。
<p> <p>也可以参考<a href="datastreamformat.html">QDataStream操作符的格式</a>。
<!-- eof -->
<hr><p>
这个文件是<a href="index.html">Qt工具包</a>一部分。
版权所有 © 1995-2002
<a href="http://www.trolltech.com/">Trolltech</a>。保留所有权利。
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2002
<a href="http://www.trolltech.com">Trolltech</a>
<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td><a href="zh_CN.html">译者:Cavendish</a>
<td align=right><div align=right>Qt 3.0.5版</div>
</table></div></address></body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -