⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qrect.html

📁 QT参考文档
💻 HTML
📖 第 1 页 / 共 3 页
字号:
</h3>
<p> 返回矩形的右下位置。
<p> <p>也可以参考<a href="#moveBottomRight">moveBottomRight</a>()、<a href="#bottomLeft">bottomLeft</a>()、<a href="#topLeft">topLeft</a>()、<a href="#topRight">topRight</a>()、<a href="#bottom">bottom</a>()和<a href="#right">right</a>()。
<p>实例:<a href="tictac-example.html#x129">tictac/tictac.cpp</a>。

<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="center"></a>QRect::center () const
</h3>
<p> 返回矩形中心点。
<p> <p>也可以参考<a href="#moveCenter">moveCenter</a>()、<a href="#topLeft">topLeft</a>()、<a href="#topRight">topRight</a>()、<a href="#bottomLeft">bottomLeft</a>()和<a href="#bottomRight">bottomRight</a>()。
<p>实例:<a href="tooltip-example.html#x566">tooltip/tooltip.cpp</a>。

<h3 class=fn>bool <a name="contains"></a>QRect::contains ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, bool&nbsp;proper = FALSE ) const
</h3>
如果点<em>p</em>在矩形内或者在矩形边缘上,返回真,否则返回假。
<p> 如果<em>proper</em>为真,这个函数只有在<em>p</em>在矩形里面时(不在边界上)的情况下,返回真。
<p>实例:<a href="tutorial1-14.html#x2413">t14/cannon.cpp</a>。

<h3 class=fn>bool <a name="contains-2"></a>QRect::contains ( int&nbsp;x, int&nbsp;y, bool&nbsp;proper = FALSE ) const
</h3>
这是一个重载成员函数,提供了方便。它的行为和上面的函数基本一致。
<p> 如果点<em>x</em>、<em>y</em>在矩形内,返回真,否则返回假。
<p> 如果<em>proper</em>为真,这个函数只有在<em>p</em>在矩形里面时(不在边界上)的情况下,返回真。

<h3 class=fn>bool <a name="contains-3"></a>QRect::contains ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, bool&nbsp;proper = FALSE ) const
</h3>
这是一个重载成员函数,提供了方便。它的行为和上面的函数基本一致。
<p> 如果矩形<em>r</em>在这个矩形里面,返回真,否则返回假。
<p> 如果<em>proper</em>为真,这个函数只有在<em>p</em>在矩形里面时(不在边界上)的情况下,返回真。
<p> <p>也可以参考<a href="#unite">unite</a>()、<a href="#intersect">intersect</a>()和<a href="#intersects">intersects</a>()。

<h3 class=fn>void <a name="coords"></a>QRect::coords ( int&nbsp;*&nbsp;xp1, int&nbsp;*&nbsp;yp1, int&nbsp;*&nbsp;xp2, int&nbsp;*&nbsp;yp2 ) const
</h3>
提取矩形的参数作为左上点<em>*xp1</em>、<em>*yp1</em>和右下点<em>*xp2</em>、<em>*yp2</em>。
<p> <p>也可以参考<a href="#setCoords">setCoords</a>()和<a href="#rect">rect</a>()。
<p>实例:<a href="themes-example.html#x257">themes/metal.cpp</a>和<a href="themes-example.html#x198">themes/wood.cpp</a>。

<h3 class=fn>int <a name="height"></a>QRect::height () const
</h3>
<p> 返回矩形的高。这个高包括左和下边界,比如height = bottom - top + 1。
<p> <p>也可以参考<a href="#width">width</a>()、<a href="#size">size</a>()和<a href="#setHeight">setHeight</a>()。
<p>实例:<a href="coordsys.html#x2438">aclock/aclock.cpp</a>、<a href="desktop-example.html#x1787">desktop/desktop.cpp</a>、<a href="movies-example.html#x466">movies/main.cpp</a>、<a href="scribble-example.html#x947">scribble/scribble.cpp</a>、<a href="themes-example.html#x258">themes/metal.cpp</a>、<a href="themes-example.html#x199">themes/wood.cpp</a>和<a href="xform-example.html#x1452">xform/xform.cpp</a>。

<h3 class=fn><a href="qrect.html">QRect</a> <a name="intersect"></a>QRect::intersect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
返回这个矩形和矩形<em>r</em>交集。<tt>r.intersect(s)</tt>与<tt>r&amp;s</tt>是相同的。

<h3 class=fn>bool <a name="intersects"></a>QRect::intersects ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
如果这个矩形和矩形<em>r</em>相交(至少两个矩形有一个相同象素),返回真,否则返回假。
<p> <p>也可以参考<a href="#intersect">intersect</a>()和<a href="#contains">contains</a>()。
<p>实例:<a href="tutorial1-11.html#x2357">t11/cannon.cpp</a>、<a href="tutorial1-12.html#x2380">t12/cannon.cpp</a>、<a href="tutorial1-13.html#x2393">t13/cannon.cpp</a>和<a href="tutorial1-14.html#x2414">t14/cannon.cpp</a>。

<h3 class=fn>bool <a name="isEmpty"></a>QRect::isEmpty () const
</h3>
<p> 如果这个矩形是空的,返回真,否则返回假。
<p> 一个空的矩形的<a href="#left">left</a>()&gt;<a href="#right">right</a>()或者<a href="#top">top</a>()&gt;<a href="#bottom">bottom</a>()。
<p> 一个空矩形是无效的。<tt>isEmpty()==!isValid()</tt>
<p> <p>也可以参考<a href="#isNull">isNull</a>()和<a href="#isValid">isValid</a>()。

<h3 class=fn>bool <a name="isNull"></a>QRect::isNull () const
</h3>
<p> 如果一个矩形是零矩形,返回真,否则返回假。
<p> 一个零矩形的宽和高都设置为0,并且<a href="#right">right</a>()==<a href="#left">left</a>()-1并且<a href="#bottom">bottom</a>()==<a href="#top">top</a>()-1。
<p> 注意如果right()==left()并且bottom()==top(),那么这个矩形的宽和高都为1。
<p> 一个零矩形也是空的。
<p> 一个零矩形是无效的。
<p> <p>也可以参考<a href="#isEmpty">isEmpty</a>()和<a href="#isValid">isValid</a>()。

<h3 class=fn>bool <a name="isValid"></a>QRect::isValid () const
</h3>

<p> Returns TRUE if the rectangle is valid or FALSE if it is invalid
(empty)。
如果一个矩形是有效的,反会诊,否则如果它是无效的(空的)就返回假。
<p> 一个有效的矩形中,<a href="#left">left</a>()&lt;=<a href="#right">right</a>()和<a href="#top">top</a>()&lt;=<a href="#bottom">bottom</a>()。
<p> <tt>isValid()==!isEmpty()</tt>
<p> <p>也可以参考<a href="#isNull">isNull</a>()、<a href="#isEmpty">isEmpty</a>()和<a href="#normalize">normalize</a>()。
<p>实例:<a href="themes-example.html#x259">themes/metal.cpp</a>和<a href="tooltip-example.html#x567">tooltip/tooltip.cpp</a>。

<h3 class=fn>int <a name="left"></a>QRect::left () const
</h3>
<p> 返回矩形的左坐标.与<a href="#x">x</a>()相同.
<p> <p>也可以参考<a href="#x">x</a>()、<a href="#top">top</a>()、<a href="#right">right</a>()、<a href="#setLeft">setLeft</a>()、<a href="#topLeft">topLeft</a>()和<a href="#bottomLeft">bottomLeft</a>()。
<p>实例:<a href="coordsys.html#x2439">aclock/aclock.cpp</a>、<a href="desktop-example.html#x1788">desktop/desktop.cpp</a>、<a href="qfd-example.html#x1986">qfd/fontdisplayer.cpp</a>、<a href="scribble-example.html#x948">scribble/scribble.cpp</a>、<a href="tictac-example.html#x131">tictac/tictac.cpp</a>和<a href="xform-example.html#x1453">xform/xform.cpp</a>。

<h3 class=fn>void <a name="moveBottomLeft"></a>QRect::moveBottomLeft ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
设置矩形的左下坐标为<em>p</em>,而大小不被改变。
<p> <p>也可以参考<a href="#bottomLeft">bottomLeft</a>()、<a href="#moveBottomRight">moveBottomRight</a>()、<a href="#moveTopLeft">moveTopLeft</a>()、<a href="#moveTopRight">moveTopRight</a>()、<a href="#setBottom">setBottom</a>()和<a href="#setLeft">setLeft</a>()。
<p>实例:<a href="tutorial1-10.html#x2347">t10/cannon.cpp</a>。

<h3 class=fn>void <a name="moveBottomRight"></a>QRect::moveBottomRight ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
设置矩形的右下坐标为<em>p</em>,而大小不被改变。
<p> <p>也可以参考<a href="#bottomRight">bottomRight</a>()、<a href="#moveBottomLeft">moveBottomLeft</a>()、<a href="#moveTopLeft">moveTopLeft</a>()、<a href="#moveTopRight">moveTopRight</a>()、<a href="#setBottom">setBottom</a>()和<a href="#setRight">setRight</a>()。

<h3 class=fn>void <a name="moveBy"></a>QRect::moveBy ( int&nbsp;dx, int&nbsp;dy )
</h3>
矩形相对于当前位置在x轴上移动<em>dx</em>,在y轴上移动<em>dy</em>。(正值时,向右和/或下移动矩形。)
<p>实例:<a href="helpviewer-example.html#x1013">helpviewer/helpwindow.cpp</a>、<a href="themes-example.html#x200">themes/wood.cpp</a>和<a href="xform-example.html#x1454">xform/xform.cpp</a>。

<h3 class=fn>void <a name="moveCenter"></a>QRect::moveCenter ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
设置矩形的中点为<em>p</em>,而大小不被改变。
<p> <p>也可以参考<a href="#center">center</a>()、<a href="#moveTopLeft">moveTopLeft</a>()、<a href="#moveTopRight">moveTopRight</a>()、<a href="#moveBottomLeft">moveBottomLeft</a>()和<a href="#moveBottomRight">moveBottomRight</a>()。
<p>实例:<a href="tutorial1-11.html#x2358">t11/cannon.cpp</a>和<a href="tutorial1-12.html#x2381">t12/cannon.cpp</a>。

<h3 class=fn>void <a name="moveTopLeft"></a>QRect::moveTopLeft ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
设置矩形的左上坐标为<em>p</em>,而大小不被改变。
<p> <p>也可以参考<a href="#topLeft">topLeft</a>()、<a href="#moveTopRight">moveTopRight</a>()、<a href="#moveBottomLeft">moveBottomLeft</a>()、<a href="#moveBottomRight">moveBottomRight</a>()、<a href="#setTop">setTop</a>()和<a href="#setLeft">setLeft</a>()。
<p>实例:<a href="xform-example.html#x1455">xform/xform.cpp</a>。

<h3 class=fn>void <a name="moveTopRight"></a>QRect::moveTopRight ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
设置矩形的右上坐标为<em>p</em>,而大小不被改变。
<p> <p>也可以参考<a href="#topRight">topRight</a>()、<a href="#moveTopLeft">moveTopLeft</a>()、<a href="#moveBottomLeft">moveBottomLeft</a>()、<a href="#moveBottomRight">moveBottomRight</a>()、<a href="#setTop">setTop</a>()和<a href="#setRight">setRight</a>()。

<h3 class=fn><a href="qrect.html">QRect</a> <a name="normalize"></a>QRect::normalize () const
</h3>
返回一个标准化的矩形,比如,一个宽高都为非负的矩形。
<p> 如果<a href="#left">left</a>()&gt;<a href="#right">right</a>(),交换左右,并且如果<a href="#top">top</a>()&gt;<a href="#bottom">bottom</a>(),交换上下。
<p> <p>也可以参考<a href="#isValid">isValid</a>()。
<p>实例:<a href="scribble-example.html#x949">scribble/scribble.cpp</a>。

<h3 class=fn><a href="qrect.html">QRect</a> <a name="operator-and"></a>QRect::operator&amp; ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
返回这个矩形和矩形<em>r</em>的交集。
<p> 如果没有交集,返回一个空矩形。
<p> <p>也可以参考<a href="#operator-and-eq">operator&amp;=</a>()、<a href="#operator|">operator|</a>()、<a href="#isEmpty">isEmpty</a>()、<a href="#intersects">intersects</a>()和<a href="#contains">contains</a>()。

<h3 class=fn><a href="qrect.html">QRect</a>&nbsp;&amp; <a name="operator-and-eq"></a>QRect::operator&amp;= ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
这个矩形和矩形<em>r</em>的交集。

<h3 class=fn><a href="qrect.html">QRect</a> <a name="operator|"></a>QRect::operator| ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
返回这个矩形和矩形<em>r</em>的边界矩形。
<p> 一个非空矩形和一个空矩形或者一个无效矩形的边界矩形定义为一个非空矩形。
<p> <p>也可以参考<a href="#operator|-eq">operator|=</a>()、<a href="#operator-and">operator&amp;</a>()、<a href="#intersects">intersects</a>()和<a href="#contains">contains</a>()。

<h3 class=fn><a href="qrect.html">QRect</a>&nbsp;&amp; <a name="operator|-eq"></a>QRect::operator|= ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
这个矩形和矩形<em>r</em>的并集。

<h3 class=fn>QCOORD &amp; <a name="rBottom"></a>QRect::rBottom ()
</h3>
<p> 返回矩形的下坐标引用。
<p> <p>也可以参考<a href="#rLeft">rLeft</a>()、<a href="#rTop">rTop</a>()和<a href="#rRight">rRight</a>()。

<h3 class=fn>QCOORD &amp; <a name="rLeft"></a>QRect::rLeft ()
</h3>
<p> 返回矩形的左坐标引用。
<p> <p>也可以参考<a href="#rTop">rTop</a>()、<a href="#rRight">rRight</a>()和<a href="#rBottom">rBottom</a>()。

<h3 class=fn>QCOORD &amp; <a name="rRight"></a>QRect::rRight ()
</h3>
<p> 返回矩形的右坐标引用。
<p> <p>也可以参考<a href="#rLeft">rLeft</a>()、<a href="#rTop">rTop</a>()和<a href="#rBottom">rBottom</a>()。

<h3 class=fn>QCOORD &amp; <a name="rTop"></a>QRect::rTop ()
</h3>
<p> 返回矩形的上坐标引用。
<p> <p>也可以参考<a href="#rLeft">rLeft</a>()、<a href="#rRight">rRight</a>()和<a href="#rBottom">rBottom</a>()。

⌨️ 快捷键说明

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