Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 659

qtbase5-doc-5.12.6-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qrect.cpp -->
  <title>QRect Class | Qt Core 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QRect</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<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="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#rendering">Rendering</a></li>
<li class="level2"><a href="#coordinates">Coordinates</a></li>
<li class="level2"><a href="#constraints">Constraints</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QRect Class</h1>
<!-- $$$QRect-brief -->
<p>The <a href="qrect.html">QRect</a> class defines a rectangle in the plane using integer precision. <a href="#details">More...</a></p>
<!-- @@@QRect -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QRect&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr></table></div><ul>
<li><a href="qrect-members.html">List of all members, including inherited members</a></li>
<li><a href="qrect-obsolete.html">Obsolete members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#QRect">QRect</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#QRect-1">QRect</a></b>(const QPoint &amp;<i>topLeft</i>, const QPoint &amp;<i>bottomRight</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#QRect-2">QRect</a></b>(const QPoint &amp;<i>topLeft</i>, const QSize &amp;<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#QRect-3">QRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#adjust">adjust</a></b>(int <i>dx1</i>, int <i>dy1</i>, int <i>dx2</i>, int <i>dy2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#adjusted">adjusted</a></b>(int <i>dx1</i>, int <i>dy1</i>, int <i>dx2</i>, int <i>dy2</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#bottom">bottom</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#bottomLeft">bottomLeft</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#bottomRight">bottomRight</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#center">center</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#contains">contains</a></b>(const QPoint &amp;<i>point</i>, bool <i>proper</i> = false) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#contains-1">contains</a></b>(const QRect &amp;<i>rectangle</i>, bool <i>proper</i> = false) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#contains-2">contains</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="qrect.html#contains-3">contains</a></b>(int <i>x</i>, int <i>y</i>, bool <i>proper</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#getCoords">getCoords</a></b>(int *<i>x1</i>, int *<i>y1</i>, int *<i>x2</i>, int *<i>y2</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#getRect">getRect</a></b>(int *<i>x</i>, int *<i>y</i>, int *<i>width</i>, int *<i>height</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#height">height</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#intersected">intersected</a></b>(const QRect &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#intersects">intersects</a></b>(const QRect &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#isEmpty">isEmpty</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#isNull">isNull</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#left">left</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#marginsAdded">marginsAdded</a></b>(const QMargins &amp;<i>margins</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#marginsRemoved">marginsRemoved</a></b>(const QMargins &amp;<i>margins</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveBottom">moveBottom</a></b>(int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveBottomLeft">moveBottomLeft</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveBottomRight">moveBottomRight</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveCenter">moveCenter</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveLeft">moveLeft</a></b>(int <i>x</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveRight">moveRight</a></b>(int <i>x</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveTo">moveTo</a></b>(int <i>x</i>, int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveTo-1">moveTo</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveTop">moveTop</a></b>(int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveTopLeft">moveTopLeft</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#moveTopRight">moveTopRight</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#normalized">normalized</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#right">right</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setBottom">setBottom</a></b>(int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setBottomLeft">setBottomLeft</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setBottomRight">setBottomRight</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setCoords">setCoords</a></b>(int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setHeight">setHeight</a></b>(int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setLeft">setLeft</a></b>(int <i>x</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setRect">setRect</a></b>(int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setRight">setRight</a></b>(int <i>x</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setSize">setSize</a></b>(const QSize &amp;<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setTop">setTop</a></b>(int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setTopLeft">setTopLeft</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setTopRight">setTopRight</a></b>(const QPoint &amp;<i>position</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setWidth">setWidth</a></b>(int <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setX">setX</a></b>(int <i>x</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#setY">setY</a></b>(int <i>y</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#size">size</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> CGRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#toCGRect">toCGRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#top">top</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#topLeft">topLeft</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#topRight">topRight</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#translate">translate</a></b>(int <i>dx</i>, int <i>dy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#translate-1">translate</a></b>(const QPoint &amp;<i>offset</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#translated">translated</a></b>(int <i>dx</i>, int <i>dy</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#translated-1">translated</a></b>(const QPoint &amp;<i>offset</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#transposed">transposed</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#united">united</a></b>(const QRect &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#width">width</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#x">x</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#y">y</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-and">operator&amp;</a></b>(const QRect &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect &amp;</td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-and-eq">operator&amp;=</a></b>(const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect &amp;</td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-2b-eq">operator+=</a></b>(const QMargins &amp;<i>margins</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect &amp;</td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator--eq">operator-=</a></b>(const QMargins &amp;<i>margins</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-7c">operator|</a></b>(const QRect &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect &amp;</td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-7c-eq">operator|=</a></b>(const QRect &amp;<i>rectangle</i>)</td></tr>
</table></div>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-not-eq">operator!=</a></b>(const QRect &amp;<i>r1</i>, const QRect &amp;<i>r2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-2b">operator+</a></b>(const QRect &amp;<i>rectangle</i>, const QMargins &amp;<i>margins</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-2b-1">operator+</a></b>(const QMargins &amp;<i>margins</i>, const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-">operator-</a></b>(const QRect &amp;<i>lhs</i>, const QMargins &amp;<i>rhs</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-lt-lt">operator&lt;&lt;</a></b>(QDataStream &amp;<i>stream</i>, const QRect &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-eq-eq">operator==</a></b>(const QRect &amp;<i>r1</i>, const QRect &amp;<i>r2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qrect.html#operator-gt-gt">operator&gt;&gt;</a></b>(QDataStream &amp;<i>stream</i>, QRect &amp;<i>rectangle</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QRect-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qrect.html">QRect</a> class defines a rectangle in the plane using integer precision.</p>
<p>A rectangle is normally expressed as a top-left corner and a size. The size (width and height) of a <a href="qrect.html">QRect</a> is always equivalent to the mathematical rectangle that forms the basis for its rendering.</p>
<p>A <a href="qrect.html">QRect</a> can be constructed with a set of left, top, width and height integers, or from a <a href="qpoint.html">QPoint</a> and a <a href="qsize.html">QSize</a>. The following code creates two identical rectangles.</p>
<pre class="cpp">

  <span class="type"><a href="qrect.html#QRect">QRect</a></span> r1(<span class="number">100</span><span class="operator">,</span> <span class="number">200</span><span class="operator">,</span> <span class="number">11</span><span class="operator">,</span> <span class="number">16</span>);
  <span class="type"><a href="qrect.html#QRect">QRect</a></span> r2(<span class="type"><a href="qpoint.html">QPoint</a></span>(<span class="number">100</span><span class="operator">,</span> <span class="number">200</span>)<span class="operator">,</span> <span class="type"><a href="qsize.html">QSize</a></span>(<span class="number">11</span><span class="operator">,</span> <span class="number">16</span>));

</pre>
<p>There is a third constructor that creates a <a href="qrect.html">QRect</a> using the top-left and bottom-right coordinates, but we recommend that you avoid using it. The rationale is that for historical reasons the values returned by the <a href="qrect.html#bottom">bottom</a>() and <a href="qrect.html#right">right</a>() functions deviate from the true bottom-right corner of the rectangle.</p>
<p>The <a href="qrect.html">QRect</a> class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. <a href="qrect.html">QRect</a> also provides functions to move the rectangle relative to the various coordinates. In addition there is a <a href="qrect.html#moveTo">moveTo</a>() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the <a href="qrect.html#translate">translate</a>() function moves the rectangle the given offset relative to the current position, and the <a href="qrect.html#translated">translated</a>() function returns a translated copy of this rectangle.</p>
<p>The <a href="qrect.html#size">size</a>() function returns the rectange's dimensions as a <a href="qsize.html">QSize</a>. The dimensions can also be retrieved separately using the <a href="qrect.html#width">width</a>() and <a href="qrect.html#height">height</a>() functions. To manipulate the dimensions use the <a href="qrect.html#setSize">setSize</a>(), <a href="qrect.html#setWidth">setWidth</a>() or <a href="qrect.html#setHeight">setHeight</a>() functions. Alternatively, the size can be changed by applying either of the functions setting the rectangle coordinates, for example, <a href="qrect.html#setBottom">setBottom</a>() or <a href="qrect.html#setRight">setRight</a>().</p>
<p>The <a href="qrect.html#contains">contains</a>() function tells whether a given point is inside the rectangle or not, and the <a href="qrect.html#intersects">intersects</a>() function returns <code>true</code> if this rectangle intersects with a given rectangle. The <a href="qrect.html">QRect</a> class also provides the <a href="qrect.html#intersected">intersected</a>() function which returns the intersection rectangle, and the <a href="qrect.html#united">united</a>() function which returns the rectangle that encloses the given rectangle and this:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/qrect-intersect.png" alt="" /></td><td ><img src="images/qrect-unite.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><a href="qrect.html#intersected">intersected</a>()</td><td ><a href="qrect.html#united">united</a>()</td></tr>
</table></div>
<p>The <a href="qrect.html#isEmpty">isEmpty</a>() function returns <code>true</code> if <a href="qrect.html#left">left</a>() &gt; <a href="qrect.html#right">right</a>() or <a href="qrect.html#top">top</a>() &gt; <a href="qrect.html#bottom">bottom</a>(). Note that an empty rectangle is not valid: The <a href="qrect.html#isValid">isValid</a>() function returns <code>true</code> if <a href="qrect.html#left">left</a>() &lt;= <a href="qrect.html#right">right</a>() <i>and</i> <a href="qrect.html#top">top</a>() &lt;= <a href="qrect.html#bottom">bottom</a>(). A null rectangle (<a href="qrect.html#isNull">isNull</a>() == true) on the other hand, has both width and height set to 0.</p>
<p>Note that due to the way <a href="qrect.html">QRect</a> and <a href="qrectf.html">QRectF</a> are defined, an empty <a href="qrect.html">QRect</a> is defined in essentially the same way as <a href="qrectf.html">QRectF</a>.</p>
<p>Finally, <a href="qrect.html">QRect</a> objects can be streamed as well as compared.</p>
<a name="rendering"></a>
<h3 id="rendering">Rendering</h3>
<p>When using an <a href="../qtgui/qpainter.html#RenderHint-enum">anti-aliased</a> painter, the boundary line of a <a href="qrect.html">QRect</a> will be rendered symmetrically on both sides of the mathematical rectangle's boundary line. But when using an aliased painter (the default) other rules apply.</p>
<p>Then, when rendering with a one pixel wide pen the <a href="qrect.html">QRect</a>'s boundary line will be rendered to the right and below the mathematical rectangle's boundary line.</p>
<p>When rendering with a two pixels wide pen the boundary line will be split in the middle by the mathematical rectangle. This will be the case whenever the pen is set to an even number of pixels, while rendering with a pen with an odd number of pixels, the spare pixel will be rendered to the right and below the mathematical rectangle as in the one pixel case.</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><img src="images/qrect-diagram-zero.png" alt="" /></td><td ><img src="images/qrect-diagram-one.png" alt="" /></td></tr>
<tr valign="top" class="even"><td >Logical representation</td><td >One pixel wide pen</td></tr>
<tr valign="top" class="odd"><td ><img src="images/qrect-diagram-two.png" alt="" /></td><td ><img src="images/qrect-diagram-three.png" alt="" /></td></tr>
<tr valign="top" class="even"><td >Two pixel wide pen</td><td >Three pixel wide pen</td></tr>
</table></div>
<a name="coordinates"></a>
<h3 id="coordinates">Coordinates</h3>
<p>The <a href="qrect.html">QRect</a> class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. <a href="qrect.html">QRect</a> also provides functions to move the rectangle relative to the various coordinates.</p>
<p>For example the <a href="qrect.html#left">left</a>(), <a href="qrect.html#setLeft">setLeft</a>() and <a href="qrect.html#moveLeft">moveLeft</a>() functions as an example: <a href="qrect.html#left">left</a>() returns the x-coordinate of the rectangle's left edge, <a href="qrect.html#setLeft">setLeft</a>() sets the left edge of the rectangle to the given x coordinate (it may change the width, but will never change the rectangle's right edge) and <a href="qrect.html#moveLeft">moveLeft</a>() moves the entire rectangle horizontally, leaving the rectangle's left edge at the given x coordinate and its size unchanged.</p>
<p class="centerAlign"><img src="images/qrect-coordinates.png" alt="" /></p><p>Note that for historical reasons the values returned by the <a href="qrect.html#bottom">bottom</a>() and <a href="qrect.html#right">right</a>() functions deviate from the true bottom-right corner of the rectangle: The <a href="qrect.html#right">right</a>() function returns <i> <a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() - 1</i> and the <a href="qrect.html#bottom">bottom</a>() function returns <i><a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1</i>. The same is the case for the point returned by the <a href="qrect.html#bottomRight">bottomRight</a>() convenience function. In addition, the x and y coordinate of the <a href="qrect.html#topRight">topRight</a>() and <a href="qrect.html#bottomLeft">bottomLeft</a>() functions, respectively, contain the same deviation from the true right and bottom edges.</p>
<p>We recommend that you use <a href="qrect.html#x">x</a>() + <a href="qrect.html#width">width</a>() and <a href="qrect.html#y">y</a>() + <a href="qrect.html#height">height</a>() to find the true bottom-right corner, and avoid <a href="qrect.html#right">right</a>() and <a href="qrect.html#bottom">bottom</a>(). Another solution is to use <a href="qrectf.html">QRectF</a>: The <a href="qrectf.html">QRectF</a> class defines a rectangle in the plane using floating point accuracy for coordinates, and the <a href="qrectf.html#right">QRectF::right</a>() and <a href="qrectf.html#bottom">QRectF::bottom</a>() functions <i>do</i> return the right and bottom coordinates.</p>
<p>It is also possible to add offsets to this rectangle's coordinates using the <a href="qrect.html#adjust">adjust</a>() function, as well as retrieve a new rectangle based on adjustments of the original one using the <a href="qrect.html#adjusted">adjusted</a>() function. If either of the width and height is negative, use the <a href="qrect.html#normalized">normalized</a>() function to retrieve a rectangle where the corners are swapped.</p>
<p>In addition, <a href="qrect.html">QRect</a> provides the <a href="qrect.html#getCoords">getCoords</a>() function which extracts the position of the rectangle's top-left and bottom-right corner, and the <a href="qrect.html#getRect">getRect</a>() function which extracts the rectangle's top-left corner, width and height. Use the <a href="qrect.html#setCoords">setCoords</a>() and <a href="qrect.html#setRect">setRect</a>() function to manipulate the rectangle's coordinates and dimensions in one go.</p>
<a name="constraints"></a>
<h3 id="constraints">Constraints</h3>
<p><a href="qrect.html">QRect</a> is limited to the minimum and maximum values for the <code>int</code> type. Operations on a <a href="qrect.html">QRect</a> that could potentially result in values outside this range will result in undefined behavior.</p>
</div>
<p><b>See also </b><a href="qrectf.html">QRectF</a> and <a href="../qtgui/qregion.html">QRegion</a>.</p>
<!-- @@@QRect -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QRect[overload1]$$$QRect -->
<h3 class="fn" id="QRect"><a name="QRect"></a>QRect::<span class="name">QRect</span>()</h3>
<p>Constructs a null rectangle.</p>
<p><b>See also </b><a href="qrect.html#isNull">isNull</a>().</p>
<!-- @@@QRect -->
<!-- $$$QRect$$$QRectconstQPoint&constQPoint& -->
<h3 class="fn" id="QRect-1"><a name="QRect-1"></a>QRect::<span class="name">QRect</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>topLeft</i>, const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>bottomRight</i>)</h3>
<p>Constructs a rectangle with the given <i>topLeft</i> and <i>bottomRight</i> corners.</p>
<p><b>See also </b><a href="qrect.html#setTopLeft">setTopLeft</a>() and <a href="qrect.html#setBottomRight">setBottomRight</a>().</p>
<!-- @@@QRect -->
<!-- $$$QRect$$$QRectconstQPoint&constQSize& -->
<h3 class="fn" id="QRect-2"><a name="QRect-2"></a>QRect::<span class="name">QRect</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>topLeft</i>, const <span class="type"><a href="qsize.html">QSize</a></span> &amp;<i>size</i>)</h3>
<p>Constructs a rectangle with the given <i>topLeft</i> corner and the given <i>size</i>.</p>
<p><b>See also </b><a href="qrect.html#setTopLeft">setTopLeft</a>() and <a href="qrect.html#setSize">setSize</a>().</p>
<!-- @@@QRect -->
<!-- $$$QRect$$$QRectintintintint -->
<h3 class="fn" id="QRect-3"><a name="QRect-3"></a>QRect::<span class="name">QRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>)</h3>
<p>Constructs a rectangle with (<i>x</i>, <i>y</i>) as its top-left corner and the given <i>width</i> and <i>height</i>.</p>
<p><b>See also </b><a href="qrect.html#setRect">setRect</a>().</p>
<!-- @@@QRect -->
<!-- $$$adjust[overload1]$$$adjustintintintint -->
<h3 class="fn" id="adjust"><a name="adjust"></a><span class="type">void</span> QRect::<span class="name">adjust</span>(<span class="type">int</span> <i>dx1</i>, <span class="type">int</span> <i>dy1</i>, <span class="type">int</span> <i>dx2</i>, <span class="type">int</span> <i>dy2</i>)</h3>
<p>Adds <i>dx1</i>, <i>dy1</i>, <i>dx2</i> and <i>dy2</i> respectively to the existing coordinates of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#adjusted">adjusted</a>() and <a href="qrect.html#setRect">setRect</a>().</p>
<!-- @@@adjust -->
<!-- $$$adjusted[overload1]$$$adjustedintintintint -->
<h3 class="fn" id="adjusted"><a name="adjusted"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">adjusted</span>(<span class="type">int</span> <i>dx1</i>, <span class="type">int</span> <i>dy1</i>, <span class="type">int</span> <i>dx2</i>, <span class="type">int</span> <i>dy2</i>) const</h3>
<p>Returns a new rectangle with <i>dx1</i>, <i>dy1</i>, <i>dx2</i> and <i>dy2</i> added respectively to the existing coordinates of this rectangle.</p>
<p><b>See also </b><a href="qrect.html#adjust">adjust</a>().</p>
<!-- @@@adjusted -->
<!-- $$$bottom[overload1]$$$bottom -->
<h3 class="fn" id="bottom"><a name="bottom"></a><span class="type">int</span> QRect::<span class="name">bottom</span>() const</h3>
<p>Returns the y-coordinate of the rectangle's bottom edge.</p>
<p>Note that for historical reasons this function returns <a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1; use <a href="qrect.html#y">y</a>() + <a href="qrect.html#height">height</a>() to retrieve the true y-coordinate.</p>
<p><b>See also </b><a href="qrect.html#setBottom">setBottom</a>(), <a href="qrect.html#bottomLeft">bottomLeft</a>(), and <a href="qrect.html#bottomRight">bottomRight</a>().</p>
<!-- @@@bottom -->
<!-- $$$bottomLeft[overload1]$$$bottomLeft -->
<h3 class="fn" id="bottomLeft"><a name="bottomLeft"></a><span class="type"><a href="qpoint.html">QPoint</a></span> QRect::<span class="name">bottomLeft</span>() const</h3>
<p>Returns the position of the rectangle's bottom-left corner. Note that for historical reasons this function returns <a href="qpoint.html">QPoint</a>(<a href="qrect.html#left">left</a>(), <a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1).</p>
<p><b>See also </b><a href="qrect.html#setBottomLeft">setBottomLeft</a>(), <a href="qrect.html#bottom">bottom</a>(), and <a href="qrect.html#left">left</a>().</p>
<!-- @@@bottomLeft -->
<!-- $$$bottomRight[overload1]$$$bottomRight -->
<h3 class="fn" id="bottomRight"><a name="bottomRight"></a><span class="type"><a href="qpoint.html">QPoint</a></span> QRect::<span class="name">bottomRight</span>() const</h3>
<p>Returns the position of the rectangle's bottom-right corner.</p>
<p>Note that for historical reasons this function returns <a href="qpoint.html">QPoint</a>(<a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() -1, <a href="qrect.html#top">top</a>() + <a href="qrect.html#height">height</a>() - 1).</p>
<p><b>See also </b><a href="qrect.html#setBottomRight">setBottomRight</a>(), <a href="qrect.html#bottom">bottom</a>(), and <a href="qrect.html#right">right</a>().</p>
<!-- @@@bottomRight -->
<!-- $$$center[overload1]$$$center -->
<h3 class="fn" id="center"><a name="center"></a><span class="type"><a href="qpoint.html">QPoint</a></span> QRect::<span class="name">center</span>() const</h3>
<p>Returns the center point of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#moveCenter">moveCenter</a>().</p>
<!-- @@@center -->
<!-- $$$contains[overload1]$$$containsconstQPoint&bool -->
<h3 class="fn" id="contains"><a name="contains"></a><span class="type">bool</span> QRect::<span class="name">contains</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>point</i>, <span class="type">bool</span> <i>proper</i> = false) const</h3>
<p>Returns <code>true</code> if the given <i>point</i> is inside or on the edge of the rectangle, otherwise returns <code>false</code>. If <i>proper</i> is true, this function only returns <code>true</code> if the given <i>point</i> is <i>inside</i> the rectangle (i.e&#x2e;, not on the edge).</p>
<p><b>See also </b><a href="qrect.html#intersects">intersects</a>().</p>
<!-- @@@contains -->
<!-- $$$contains$$$containsconstQRect&bool -->
<h3 class="fn" id="contains-1"><a name="contains-1"></a><span class="type">bool</span> QRect::<span class="name">contains</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>, <span class="type">bool</span> <i>proper</i> = false) const</h3>
<p>This is an overloaded function.</p>
<p>Returns <code>true</code> if the given <i>rectangle</i> is inside this rectangle. otherwise returns <code>false</code>. If <i>proper</i> is true, this function only returns <code>true</code> if the <i>rectangle</i> is entirely inside this rectangle (not on the edge).</p>
<!-- @@@contains -->
<!-- $$$contains$$$containsintint -->
<h3 class="fn" id="contains-2"><a name="contains-2"></a><span class="type">bool</span> QRect::<span class="name">contains</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Returns <code>true</code> if the point (<i>x</i>, <i>y</i>) is inside this rectangle, otherwise returns <code>false</code>.</p>
<!-- @@@contains -->
<!-- $$$contains$$$containsintintbool -->
<h3 class="fn" id="contains-3"><a name="contains-3"></a><span class="type">bool</span> QRect::<span class="name">contains</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">bool</span> <i>proper</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Returns <code>true</code> if the point (<i>x</i>, <i>y</i>) is inside or on the edge of the rectangle, otherwise returns <code>false</code>. If <i>proper</i> is true, this function only returns <code>true</code> if the point is entirely inside the rectangle(not on the edge).</p>
<!-- @@@contains -->
<!-- $$$getCoords[overload1]$$$getCoordsint*int*int*int* -->
<h3 class="fn" id="getCoords"><a name="getCoords"></a><span class="type">void</span> QRect::<span class="name">getCoords</span>(<span class="type">int</span> *<i>x1</i>, <span class="type">int</span> *<i>y1</i>, <span class="type">int</span> *<i>x2</i>, <span class="type">int</span> *<i>y2</i>) const</h3>
<p>Extracts the position of the rectangle's top-left corner to *<i>x1</i> and *<i>y1</i>, and the position of the bottom-right corner to *<i>x2</i> and *<i>y2</i>.</p>
<p><b>See also </b><a href="qrect.html#setCoords">setCoords</a>() and <a href="qrect.html#getRect">getRect</a>().</p>
<!-- @@@getCoords -->
<!-- $$$getRect[overload1]$$$getRectint*int*int*int* -->
<h3 class="fn" id="getRect"><a name="getRect"></a><span class="type">void</span> QRect::<span class="name">getRect</span>(<span class="type">int</span> *<i>x</i>, <span class="type">int</span> *<i>y</i>, <span class="type">int</span> *<i>width</i>, <span class="type">int</span> *<i>height</i>) const</h3>
<p>Extracts the position of the rectangle's top-left corner to *<i>x</i> and *<i>y</i>, and its dimensions to *<i>width</i> and *<i>height</i>.</p>
<p><b>See also </b><a href="qrect.html#setRect">setRect</a>() and <a href="qrect.html#getCoords">getCoords</a>().</p>
<!-- @@@getRect -->
<!-- $$$height[overload1]$$$height -->
<h3 class="fn" id="height"><a name="height"></a><span class="type">int</span> QRect::<span class="name">height</span>() const</h3>
<p>Returns the height of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#setHeight">setHeight</a>(), <a href="qrect.html#width">width</a>(), and <a href="qrect.html#size">size</a>().</p>
<!-- @@@height -->
<!-- $$$intersected[overload1]$$$intersectedconstQRect& -->
<h3 class="fn" id="intersected"><a name="intersected"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">intersected</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>) const</h3>
<p>Returns the intersection of this rectangle and the given <i>rectangle</i>. Note that <code>r.intersected(s)</code> is equivalent to <code>r &amp; s</code>.</p>
<p class="centerAlign"><img src="images/qrect-intersect.png" alt="" /></p><p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qrect.html#intersects">intersects</a>(), <a href="qrect.html#united">united</a>(), and <a href="qrect.html#operator-and-eq">operator&amp;=</a>().</p>
<!-- @@@intersected -->
<!-- $$$intersects[overload1]$$$intersectsconstQRect& -->
<h3 class="fn" id="intersects"><a name="intersects"></a><span class="type">bool</span> QRect::<span class="name">intersects</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>) const</h3>
<p>Returns <code>true</code> if this rectangle intersects with the given <i>rectangle</i> (i.e&#x2e;, there is at least one pixel that is within both rectangles), otherwise returns <code>false</code>.</p>
<p>The intersection rectangle can be retrieved using the <a href="qrect.html#intersected">intersected</a>() function.</p>
<p><b>See also </b><a href="qrect.html#contains">contains</a>().</p>
<!-- @@@intersects -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn" id="isEmpty"><a name="isEmpty"></a><span class="type">bool</span> QRect::<span class="name">isEmpty</span>() const</h3>
<p>Returns <code>true</code> if the rectangle is empty, otherwise returns <code>false</code>.</p>
<p>An empty rectangle has a <a href="qrect.html#left">left</a>() &gt; <a href="qrect.html#right">right</a>() or <a href="qrect.html#top">top</a>() &gt; <a href="qrect.html#bottom">bottom</a>(). An empty rectangle is not valid (i.e&#x2e;, isEmpty() == !<a href="qrect.html#isValid">isValid</a>()).</p>
<p>Use the <a href="qrect.html#normalized">normalized</a>() function to retrieve a rectangle where the corners are swapped.</p>
<p><b>See also </b><a href="qrect.html#isNull">isNull</a>(), <a href="qrect.html#isValid">isValid</a>(), and <a href="qrect.html#normalized">normalized</a>().</p>
<!-- @@@isEmpty -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QRect::<span class="name">isNull</span>() const</h3>
<p>Returns <code>true</code> if the rectangle is a null rectangle, otherwise returns <code>false</code>.</p>
<p>A null rectangle has both the width and the height set to 0 (i.e&#x2e;, <a href="qrect.html#right">right</a>() == <a href="qrect.html#left">left</a>() - 1 and <a href="qrect.html#bottom">bottom</a>() == <a href="qrect.html#top">top</a>() - 1). A null rectangle is also empty, and hence is not valid.</p>
<p><b>See also </b><a href="qrect.html#isEmpty">isEmpty</a>() and <a href="qrect.html#isValid">isValid</a>().</p>
<!-- @@@isNull -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QRect::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if the rectangle is valid, otherwise returns <code>false</code>.</p>
<p>A valid rectangle has a <a href="qrect.html#left">left</a>() &lt;= <a href="qrect.html#right">right</a>() and <a href="qrect.html#top">top</a>() &lt;= <a href="qrect.html#bottom">bottom</a>(). Note that non-trivial operations like intersections are not defined for invalid rectangles. A valid rectangle is not empty (i.e&#x2e;, isValid() == !<a href="qrect.html#isEmpty">isEmpty</a>()).</p>
<p><b>See also </b><a href="qrect.html#isNull">isNull</a>(), <a href="qrect.html#isEmpty">isEmpty</a>(), and <a href="qrect.html#normalized">normalized</a>().</p>
<!-- @@@isValid -->
<!-- $$$left[overload1]$$$left -->
<h3 class="fn" id="left"><a name="left"></a><span class="type">int</span> QRect::<span class="name">left</span>() const</h3>
<p>Returns the x-coordinate of the rectangle's left edge. Equivalent to <a href="qrect.html#x">x</a>().</p>
<p><b>See also </b><a href="qrect.html#setLeft">setLeft</a>(), <a href="qrect.html#topLeft">topLeft</a>(), and <a href="qrect.html#bottomLeft">bottomLeft</a>().</p>
<!-- @@@left -->
<!-- $$$marginsAdded[overload1]$$$marginsAddedconstQMargins& -->
<h3 class="fn" id="marginsAdded"><a name="marginsAdded"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">marginsAdded</span>(const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp;<i>margins</i>) const</h3>
<p>Returns a rectangle grown by the <i>margins</i>.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qrect.html#operator-2b-eq">operator+=</a>(), <a href="qrect.html#marginsRemoved">marginsRemoved</a>(), and <a href="qrect.html#operator--eq">operator-=</a>().</p>
<!-- @@@marginsAdded -->
<!-- $$$marginsRemoved[overload1]$$$marginsRemovedconstQMargins& -->
<h3 class="fn" id="marginsRemoved"><a name="marginsRemoved"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">marginsRemoved</span>(const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp;<i>margins</i>) const</h3>
<p>Removes the <i>margins</i> from the rectangle, shrinking it.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qrect.html#marginsAdded">marginsAdded</a>(), <a href="qrect.html#operator-2b-eq">operator+=</a>(), and <a href="qrect.html#operator--eq">operator-=</a>().</p>
<!-- @@@marginsRemoved -->
<!-- $$$moveBottom[overload1]$$$moveBottomint -->
<h3 class="fn" id="moveBottom"><a name="moveBottom"></a><span class="type">void</span> QRect::<span class="name">moveBottom</span>(<span class="type">int</span> <i>y</i>)</h3>
<p>Moves the rectangle vertically, leaving the rectangle's bottom edge at the given <i>y</i> coordinate. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#bottom">bottom</a>(), <a href="qrect.html#setBottom">setBottom</a>(), and <a href="qrect.html#moveTop">moveTop</a>().</p>
<!-- @@@moveBottom -->
<!-- $$$moveBottomLeft[overload1]$$$moveBottomLeftconstQPoint& -->
<h3 class="fn" id="moveBottomLeft"><a name="moveBottomLeft"></a><span class="type">void</span> QRect::<span class="name">moveBottomLeft</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Moves the rectangle, leaving the bottom-left corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#setBottomLeft">setBottomLeft</a>(), <a href="qrect.html#moveBottom">moveBottom</a>(), and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<!-- @@@moveBottomLeft -->
<!-- $$$moveBottomRight[overload1]$$$moveBottomRightconstQPoint& -->
<h3 class="fn" id="moveBottomRight"><a name="moveBottomRight"></a><span class="type">void</span> QRect::<span class="name">moveBottomRight</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Moves the rectangle, leaving the bottom-right corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#setBottomRight">setBottomRight</a>(), <a href="qrect.html#moveRight">moveRight</a>(), and <a href="qrect.html#moveBottom">moveBottom</a>().</p>
<!-- @@@moveBottomRight -->
<!-- $$$moveCenter[overload1]$$$moveCenterconstQPoint& -->
<h3 class="fn" id="moveCenter"><a name="moveCenter"></a><span class="type">void</span> QRect::<span class="name">moveCenter</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Moves the rectangle, leaving the center point at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#center">center</a>().</p>
<!-- @@@moveCenter -->
<!-- $$$moveLeft[overload1]$$$moveLeftint -->
<h3 class="fn" id="moveLeft"><a name="moveLeft"></a><span class="type">void</span> QRect::<span class="name">moveLeft</span>(<span class="type">int</span> <i>x</i>)</h3>
<p>Moves the rectangle horizontally, leaving the rectangle's left edge at the given <i>x</i> coordinate. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#left">left</a>(), <a href="qrect.html#setLeft">setLeft</a>(), and <a href="qrect.html#moveRight">moveRight</a>().</p>
<!-- @@@moveLeft -->
<!-- $$$moveRight[overload1]$$$moveRightint -->
<h3 class="fn" id="moveRight"><a name="moveRight"></a><span class="type">void</span> QRect::<span class="name">moveRight</span>(<span class="type">int</span> <i>x</i>)</h3>
<p>Moves the rectangle horizontally, leaving the rectangle's right edge at the given <i>x</i> coordinate. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#right">right</a>(), <a href="qrect.html#setRight">setRight</a>(), and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<!-- @@@moveRight -->
<!-- $$$moveTo[overload1]$$$moveTointint -->
<h3 class="fn" id="moveTo"><a name="moveTo"></a><span class="type">void</span> QRect::<span class="name">moveTo</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>)</h3>
<p>Moves the rectangle, leaving the top-left corner at the given position (<i>x</i>, <i>y</i>). The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#translate">translate</a>() and <a href="qrect.html#moveTopLeft">moveTopLeft</a>().</p>
<!-- @@@moveTo -->
<!-- $$$moveTo$$$moveToconstQPoint& -->
<h3 class="fn" id="moveTo-1"><a name="moveTo-1"></a><span class="type">void</span> QRect::<span class="name">moveTo</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Moves the rectangle, leaving the top-left corner at the given <i>position</i>.</p>
<!-- @@@moveTo -->
<!-- $$$moveTop[overload1]$$$moveTopint -->
<h3 class="fn" id="moveTop"><a name="moveTop"></a><span class="type">void</span> QRect::<span class="name">moveTop</span>(<span class="type">int</span> <i>y</i>)</h3>
<p>Moves the rectangle vertically, leaving the rectangle's top edge at the given <i>y</i> coordinate. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#top">top</a>(), <a href="qrect.html#setTop">setTop</a>(), and <a href="qrect.html#moveBottom">moveBottom</a>().</p>
<!-- @@@moveTop -->
<!-- $$$moveTopLeft[overload1]$$$moveTopLeftconstQPoint& -->
<h3 class="fn" id="moveTopLeft"><a name="moveTopLeft"></a><span class="type">void</span> QRect::<span class="name">moveTopLeft</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Moves the rectangle, leaving the top-left corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#setTopLeft">setTopLeft</a>(), <a href="qrect.html#moveTop">moveTop</a>(), and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<!-- @@@moveTopLeft -->
<!-- $$$moveTopRight[overload1]$$$moveTopRightconstQPoint& -->
<h3 class="fn" id="moveTopRight"><a name="moveTopRight"></a><span class="type">void</span> QRect::<span class="name">moveTopRight</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Moves the rectangle, leaving the top-right corner at the given <i>position</i>. The rectangle's size is unchanged.</p>
<p><b>See also </b><a href="qrect.html#setTopRight">setTopRight</a>(), <a href="qrect.html#moveTop">moveTop</a>(), and <a href="qrect.html#moveRight">moveRight</a>().</p>
<!-- @@@moveTopRight -->
<!-- $$$normalized[overload1]$$$normalized -->
<h3 class="fn" id="normalized"><a name="normalized"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">normalized</span>() const</h3>
<p>Returns a normalized rectangle; i.e&#x2e;, a rectangle that has a non-negative width and height.</p>
<p>If <a href="qrect.html#width">width</a>() &lt; 0 the function swaps the left and right corners, and it swaps the top and bottom corners if <a href="qrect.html#height">height</a>() &lt; 0.</p>
<p><b>See also </b><a href="qrect.html#isValid">isValid</a>() and <a href="qrect.html#isEmpty">isEmpty</a>().</p>
<!-- @@@normalized -->
<!-- $$$right[overload1]$$$right -->
<h3 class="fn" id="right"><a name="right"></a><span class="type">int</span> QRect::<span class="name">right</span>() const</h3>
<p>Returns the x-coordinate of the rectangle's right edge.</p>
<p>Note that for historical reasons this function returns <a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() - 1; use <a href="qrect.html#x">x</a>() + <a href="qrect.html#width">width</a>() to retrieve the true x-coordinate.</p>
<p><b>See also </b><a href="qrect.html#setRight">setRight</a>(), <a href="qrect.html#topRight">topRight</a>(), and <a href="qrect.html#bottomRight">bottomRight</a>().</p>
<!-- @@@right -->
<!-- $$$setBottom[overload1]$$$setBottomint -->
<h3 class="fn" id="setBottom"><a name="setBottom"></a><span class="type">void</span> QRect::<span class="name">setBottom</span>(<span class="type">int</span> <i>y</i>)</h3>
<p>Sets the bottom edge of the rectangle to the given <i>y</i> coordinate. May change the height, but will never change the top edge of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#bottom">bottom</a>() and <a href="qrect.html#moveBottom">moveBottom</a>().</p>
<!-- @@@setBottom -->
<!-- $$$setBottomLeft[overload1]$$$setBottomLeftconstQPoint& -->
<h3 class="fn" id="setBottomLeft"><a name="setBottomLeft"></a><span class="type">void</span> QRect::<span class="name">setBottomLeft</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Set the bottom-left corner of the rectangle to the given <i>position</i>. May change the size, but will never change the top-right corner of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#bottomLeft">bottomLeft</a>() and <a href="qrect.html#moveBottomLeft">moveBottomLeft</a>().</p>
<!-- @@@setBottomLeft -->
<!-- $$$setBottomRight[overload1]$$$setBottomRightconstQPoint& -->
<h3 class="fn" id="setBottomRight"><a name="setBottomRight"></a><span class="type">void</span> QRect::<span class="name">setBottomRight</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Set the bottom-right corner of the rectangle to the given <i>position</i>. May change the size, but will never change the top-left corner of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#bottomRight">bottomRight</a>() and <a href="qrect.html#moveBottomRight">moveBottomRight</a>().</p>
<!-- @@@setBottomRight -->
<!-- $$$setCoords[overload1]$$$setCoordsintintintint -->
<h3 class="fn" id="setCoords"><a name="setCoords"></a><span class="type">void</span> QRect::<span class="name">setCoords</span>(<span class="type">int</span> <i>x1</i>, <span class="type">int</span> <i>y1</i>, <span class="type">int</span> <i>x2</i>, <span class="type">int</span> <i>y2</i>)</h3>
<p>Sets the coordinates of the rectangle's top-left corner to (<i>x1</i>, <i>y1</i>), and the coordinates of its bottom-right corner to (<i>x2</i>, <i>y2</i>).</p>
<p><b>See also </b><a href="qrect.html#getCoords">getCoords</a>() and <a href="qrect.html#setRect">setRect</a>().</p>
<!-- @@@setCoords -->
<!-- $$$setHeight[overload1]$$$setHeightint -->
<h3 class="fn" id="setHeight"><a name="setHeight"></a><span class="type">void</span> QRect::<span class="name">setHeight</span>(<span class="type">int</span> <i>height</i>)</h3>
<p>Sets the height of the rectangle to the given <i>height</i>. The bottom edge is changed, but not the top one.</p>
<p><b>See also </b><a href="qrect.html#height">height</a>() and <a href="qrect.html#setSize">setSize</a>().</p>
<!-- @@@setHeight -->
<!-- $$$setLeft[overload1]$$$setLeftint -->
<h3 class="fn" id="setLeft"><a name="setLeft"></a><span class="type">void</span> QRect::<span class="name">setLeft</span>(<span class="type">int</span> <i>x</i>)</h3>
<p>Sets the left edge of the rectangle to the given <i>x</i> coordinate. May change the width, but will never change the right edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setX">setX</a>().</p>
<p><b>See also </b><a href="qrect.html#left">left</a>() and <a href="qrect.html#moveLeft">moveLeft</a>().</p>
<!-- @@@setLeft -->
<!-- $$$setRect[overload1]$$$setRectintintintint -->
<h3 class="fn" id="setRect"><a name="setRect"></a><span class="type">void</span> QRect::<span class="name">setRect</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>)</h3>
<p>Sets the coordinates of the rectangle's top-left corner to (<i>x</i>, <i>y</i>), and its size to the given <i>width</i> and <i>height</i>.</p>
<p><b>See also </b><a href="qrect.html#getRect">getRect</a>() and <a href="qrect.html#setCoords">setCoords</a>().</p>
<!-- @@@setRect -->
<!-- $$$setRight[overload1]$$$setRightint -->
<h3 class="fn" id="setRight"><a name="setRight"></a><span class="type">void</span> QRect::<span class="name">setRight</span>(<span class="type">int</span> <i>x</i>)</h3>
<p>Sets the right edge of the rectangle to the given <i>x</i> coordinate. May change the width, but will never change the left edge of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#right">right</a>() and <a href="qrect.html#moveRight">moveRight</a>().</p>
<!-- @@@setRight -->
<!-- $$$setSize[overload1]$$$setSizeconstQSize& -->
<h3 class="fn" id="setSize"><a name="setSize"></a><span class="type">void</span> QRect::<span class="name">setSize</span>(const <span class="type"><a href="qsize.html">QSize</a></span> &amp;<i>size</i>)</h3>
<p>Sets the size of the rectangle to the given <i>size</i>. The top-left corner is not moved.</p>
<p><b>See also </b><a href="qrect.html#size">size</a>(), <a href="qrect.html#setWidth">setWidth</a>(), and <a href="qrect.html#setHeight">setHeight</a>().</p>
<!-- @@@setSize -->
<!-- $$$setTop[overload1]$$$setTopint -->
<h3 class="fn" id="setTop"><a name="setTop"></a><span class="type">void</span> QRect::<span class="name">setTop</span>(<span class="type">int</span> <i>y</i>)</h3>
<p>Sets the top edge of the rectangle to the given <i>y</i> coordinate. May change the height, but will never change the bottom edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setY">setY</a>().</p>
<p><b>See also </b><a href="qrect.html#top">top</a>() and <a href="qrect.html#moveTop">moveTop</a>().</p>
<!-- @@@setTop -->
<!-- $$$setTopLeft[overload1]$$$setTopLeftconstQPoint& -->
<h3 class="fn" id="setTopLeft"><a name="setTopLeft"></a><span class="type">void</span> QRect::<span class="name">setTopLeft</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Set the top-left corner of the rectangle to the given <i>position</i>. May change the size, but will never change the bottom-right corner of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#topLeft">topLeft</a>() and <a href="qrect.html#moveTopLeft">moveTopLeft</a>().</p>
<!-- @@@setTopLeft -->
<!-- $$$setTopRight[overload1]$$$setTopRightconstQPoint& -->
<h3 class="fn" id="setTopRight"><a name="setTopRight"></a><span class="type">void</span> QRect::<span class="name">setTopRight</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>position</i>)</h3>
<p>Set the top-right corner of the rectangle to the given <i>position</i>. May change the size, but will never change the bottom-left corner of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#topRight">topRight</a>() and <a href="qrect.html#moveTopRight">moveTopRight</a>().</p>
<!-- @@@setTopRight -->
<!-- $$$setWidth[overload1]$$$setWidthint -->
<h3 class="fn" id="setWidth"><a name="setWidth"></a><span class="type">void</span> QRect::<span class="name">setWidth</span>(<span class="type">int</span> <i>width</i>)</h3>
<p>Sets the width of the rectangle to the given <i>width</i>. The right edge is changed, but not the left one.</p>
<p><b>See also </b><a href="qrect.html#width">width</a>() and <a href="qrect.html#setSize">setSize</a>().</p>
<!-- @@@setWidth -->
<!-- $$$setX[overload1]$$$setXint -->
<h3 class="fn" id="setX"><a name="setX"></a><span class="type">void</span> QRect::<span class="name">setX</span>(<span class="type">int</span> <i>x</i>)</h3>
<p>Sets the left edge of the rectangle to the given <i>x</i> coordinate. May change the width, but will never change the right edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setLeft">setLeft</a>().</p>
<p><b>See also </b><a href="qrect.html#x">x</a>(), <a href="qrect.html#setY">setY</a>(), and <a href="qrect.html#setTopLeft">setTopLeft</a>().</p>
<!-- @@@setX -->
<!-- $$$setY[overload1]$$$setYint -->
<h3 class="fn" id="setY"><a name="setY"></a><span class="type">void</span> QRect::<span class="name">setY</span>(<span class="type">int</span> <i>y</i>)</h3>
<p>Sets the top edge of the rectangle to the given <i>y</i> coordinate. May change the height, but will never change the bottom edge of the rectangle.</p>
<p>Equivalent to <a href="qrect.html#setTop">setTop</a>().</p>
<p><b>See also </b><a href="qrect.html#y">y</a>(), <a href="qrect.html#setX">setX</a>(), and <a href="qrect.html#setTopLeft">setTopLeft</a>().</p>
<!-- @@@setY -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn" id="size"><a name="size"></a><span class="type"><a href="qsize.html">QSize</a></span> QRect::<span class="name">size</span>() const</h3>
<p>Returns the size of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#setSize">setSize</a>(), <a href="qrect.html#width">width</a>(), and <a href="qrect.html#height">height</a>().</p>
<!-- @@@size -->
<!-- $$$toCGRect[overload1]$$$toCGRect -->
<h3 class="fn" id="toCGRect"><a name="toCGRect"></a><span class="type">CGRect</span> QRect::<span class="name">toCGRect</span>() const</h3>
<p>Creates a CGRect from a <a href="qrect.html">QRect</a>.</p>
<p>This function was introduced in  Qt 5.8.</p>
<p><b>See also </b><a href="qrectf.html#fromCGRect">QRectF::fromCGRect</a>().</p>
<!-- @@@toCGRect -->
<!-- $$$top[overload1]$$$top -->
<h3 class="fn" id="top"><a name="top"></a><span class="type">int</span> QRect::<span class="name">top</span>() const</h3>
<p>Returns the y-coordinate of the rectangle's top edge. Equivalent to <a href="qrect.html#y">y</a>().</p>
<p><b>See also </b><a href="qrect.html#setTop">setTop</a>(), <a href="qrect.html#topLeft">topLeft</a>(), and <a href="qrect.html#topRight">topRight</a>().</p>
<!-- @@@top -->
<!-- $$$topLeft[overload1]$$$topLeft -->
<h3 class="fn" id="topLeft"><a name="topLeft"></a><span class="type"><a href="qpoint.html">QPoint</a></span> QRect::<span class="name">topLeft</span>() const</h3>
<p>Returns the position of the rectangle's top-left corner.</p>
<p><b>See also </b><a href="qrect.html#setTopLeft">setTopLeft</a>(), <a href="qrect.html#top">top</a>(), and <a href="qrect.html#left">left</a>().</p>
<!-- @@@topLeft -->
<!-- $$$topRight[overload1]$$$topRight -->
<h3 class="fn" id="topRight"><a name="topRight"></a><span class="type"><a href="qpoint.html">QPoint</a></span> QRect::<span class="name">topRight</span>() const</h3>
<p>Returns the position of the rectangle's top-right corner.</p>
<p>Note that for historical reasons this function returns <a href="qpoint.html">QPoint</a>(<a href="qrect.html#left">left</a>() + <a href="qrect.html#width">width</a>() -1, <a href="qrect.html#top">top</a>()).</p>
<p><b>See also </b><a href="qrect.html#setTopRight">setTopRight</a>(), <a href="qrect.html#top">top</a>(), and <a href="qrect.html#right">right</a>().</p>
<!-- @@@topRight -->
<!-- $$$translate[overload1]$$$translateintint -->
<h3 class="fn" id="translate"><a name="translate"></a><span class="type">void</span> QRect::<span class="name">translate</span>(<span class="type">int</span> <i>dx</i>, <span class="type">int</span> <i>dy</i>)</h3>
<p>Moves the rectangle <i>dx</i> along the x axis and <i>dy</i> along the y axis, relative to the current position. Positive values move the rectangle to the right and down.</p>
<p><b>See also </b><a href="qrect.html#moveTopLeft">moveTopLeft</a>(), <a href="qrect.html#moveTo">moveTo</a>(), and <a href="qrect.html#translated">translated</a>().</p>
<!-- @@@translate -->
<!-- $$$translate$$$translateconstQPoint& -->
<h3 class="fn" id="translate-1"><a name="translate-1"></a><span class="type">void</span> QRect::<span class="name">translate</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>offset</i>)</h3>
<p>This is an overloaded function.</p>
<p>Moves the rectangle <i>offset</i>.<a href="qpoint.html#x">x()</a> along the x axis and <i>offset</i>.<a href="qpoint.html#y">y()</a> along the y axis, relative to the current position.</p>
<!-- @@@translate -->
<!-- $$$translated[overload1]$$$translatedintint -->
<h3 class="fn" id="translated"><a name="translated"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">translated</span>(<span class="type">int</span> <i>dx</i>, <span class="type">int</span> <i>dy</i>) const</h3>
<p>Returns a copy of the rectangle that is translated <i>dx</i> along the x axis and <i>dy</i> along the y axis, relative to the current position. Positive values move the rectangle to the right and down.</p>
<p><b>See also </b><a href="qrect.html#translate">translate</a>().</p>
<!-- @@@translated -->
<!-- $$$translated$$$translatedconstQPoint& -->
<h3 class="fn" id="translated-1"><a name="translated-1"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">translated</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp;<i>offset</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a copy of the rectangle that is translated <i>offset</i>.<a href="qpoint.html#x">x()</a> along the x axis and <i>offset</i>.<a href="qpoint.html#y">y()</a> along the y axis, relative to the current position.</p>
<!-- @@@translated -->
<!-- $$$transposed[overload1]$$$transposed -->
<h3 class="fn" id="transposed"><a name="transposed"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">transposed</span>() const</h3>
<p>Returns a copy of the rectangle that has its width and height exchanged:</p>
<pre class="cpp">

  <span class="type"><a href="qrect.html#QRect">QRect</a></span> r <span class="operator">=</span> {<span class="number">15</span><span class="operator">,</span> <span class="number">51</span><span class="operator">,</span> <span class="number">42</span><span class="operator">,</span> <span class="number">24</span>};
  r <span class="operator">=</span> r<span class="operator">.</span>transposed(); <span class="comment">// r == {15, 51, 24, 42}</span>

</pre>
<p>This function was introduced in  Qt 5.7.</p>
<p><b>See also </b><a href="qsize.html#transposed">QSize::transposed</a>().</p>
<!-- @@@transposed -->
<!-- $$$united[overload1]$$$unitedconstQRect& -->
<h3 class="fn" id="united"><a name="united"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">united</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>) const</h3>
<p>Returns the bounding rectangle of this rectangle and the given <i>rectangle</i>.</p>
<p class="centerAlign"><img src="images/qrect-unite.png" alt="" /></p><p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qrect.html#intersected">intersected</a>().</p>
<!-- @@@united -->
<!-- $$$width[overload1]$$$width -->
<h3 class="fn" id="width"><a name="width"></a><span class="type">int</span> QRect::<span class="name">width</span>() const</h3>
<p>Returns the width of the rectangle.</p>
<p><b>See also </b><a href="qrect.html#setWidth">setWidth</a>(), <a href="qrect.html#height">height</a>(), and <a href="qrect.html#size">size</a>().</p>
<!-- @@@width -->
<!-- $$$x[overload1]$$$x -->
<h3 class="fn" id="x"><a name="x"></a><span class="type">int</span> QRect::<span class="name">x</span>() const</h3>
<p>Returns the x-coordinate of the rectangle's left edge. Equivalent to <a href="qrect.html#left">left</a>().</p>
<p><b>See also </b><a href="qrect.html#setX">setX</a>(), <a href="qrect.html#y">y</a>(), and <a href="qrect.html#topLeft">topLeft</a>().</p>
<!-- @@@x -->
<!-- $$$y[overload1]$$$y -->
<h3 class="fn" id="y"><a name="y"></a><span class="type">int</span> QRect::<span class="name">y</span>() const</h3>
<p>Returns the y-coordinate of the rectangle's top edge. Equivalent to <a href="qrect.html#top">top</a>().</p>
<p><b>See also </b><a href="qrect.html#setY">setY</a>(), <a href="qrect.html#x">x</a>(), and <a href="qrect.html#topLeft">topLeft</a>().</p>
<!-- @@@y -->
<!-- $$$operator&[overload1]$$$operator&constQRect& -->
<h3 class="fn" id="operator-and"><a name="operator-and"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">operator&amp;</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>) const</h3>
<p>Returns the intersection of this rectangle and the given <i>rectangle</i>. Returns an empty rectangle if there is no intersection.</p>
<p><b>See also </b><a href="qrect.html#operator-and-eq">operator&amp;=</a>() and <a href="qrect.html#intersected">intersected</a>().</p>
<!-- @@@operator& -->
<!-- $$$operator&=[overload1]$$$operator&=constQRect& -->
<h3 class="fn" id="operator-and-eq"><a name="operator-and-eq"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;QRect::<span class="name">operator&amp;=</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>Intersects this rectangle with the given <i>rectangle</i>.</p>
<p><b>See also </b><a href="qrect.html#intersected">intersected</a>() and <a href="qrect.html#operator-and">operator&amp;</a>().</p>
<!-- @@@operator&= -->
<!-- $$$operator+=[overload1]$$$operator+=constQMargins& -->
<h3 class="fn" id="operator-2b-eq"><a name="operator-2b-eq"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;QRect::<span class="name">operator+=</span>(const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp;<i>margins</i>)</h3>
<p>Adds the <i>margins</i> to the rectangle, growing it.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qrect.html#marginsAdded">marginsAdded</a>(), <a href="qrect.html#marginsRemoved">marginsRemoved</a>(), and <a href="qrect.html#operator--eq">operator-=</a>().</p>
<!-- @@@operator+= -->
<!-- $$$operator-=[overload1]$$$operator-=constQMargins& -->
<h3 class="fn" id="operator--eq"><a name="operator--eq"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;QRect::<span class="name">operator-=</span>(const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp;<i>margins</i>)</h3>
<p>Returns a rectangle shrunk by the <i>margins</i>.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qrect.html#marginsRemoved">marginsRemoved</a>(), <a href="qrect.html#operator-2b-eq">operator+=</a>(), and <a href="qrect.html#marginsAdded">marginsAdded</a>().</p>
<!-- @@@operator-= -->
<!-- $$$operator|[overload1]$$$operator|constQRect& -->
<h3 class="fn" id="operator-7c"><a name="operator-7c"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> QRect::<span class="name">operator|</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>) const</h3>
<p>Returns the bounding rectangle of this rectangle and the given <i>rectangle</i>.</p>
<p><b>See also </b><a href="qrect.html#operator-7c-eq">operator|=</a>() and <a href="qrect.html#united">united</a>().</p>
<!-- @@@operator| -->
<!-- $$$operator|=[overload1]$$$operator|=constQRect& -->
<h3 class="fn" id="operator-7c-eq"><a name="operator-7c-eq"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;QRect::<span class="name">operator|=</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>Unites this rectangle with the given <i>rectangle</i>.</p>
<p><b>See also </b><a href="qrect.html#united">united</a>() and <a href="qrect.html#operator-7c">operator|</a>().</p>
<!-- @@@operator|= -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator!=[overload1]$$$operator!=constQRect&constQRect& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> <span class="name">operator!=</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>r1</i>, const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>r2</i>)</h3>
<p>Returns <code>true</code> if the rectangles <i>r1</i> and <i>r2</i> are different, otherwise returns <code>false</code>.</p>
<!-- @@@operator!= -->
<!-- $$$operator+[overload1]$$$operator+constQRect&constQMargins& -->
<h3 class="fn" id="operator-2b"><a name="operator-2b"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> <span class="name">operator+</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>, const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp;<i>margins</i>)</h3>
<p>Returns the <i>rectangle</i> grown by the <i>margins</i>.</p>
<p>This function was introduced in  Qt 5.1.</p>
<!-- @@@operator+ -->
<!-- $$$operator+$$$operator+constQMargins&constQRect& -->
<h3 class="fn" id="operator-2b-1"><a name="operator-2b-1"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> <span class="name">operator+</span>(const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp;<i>margins</i>, const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the <i>rectangle</i> grown by the <i>margins</i>.</p>
<p>This function was introduced in  Qt 5.1.</p>
<!-- @@@operator+ -->
<!-- $$$operator-[overload1]$$$operator-constQRect&constQMargins& -->
<h3 class="fn" id="operator-"><a name="operator-"></a><span class="type"><a href="qrect.html#QRect">QRect</a></span> <span class="name">operator-</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>lhs</i>, const <span class="type"><a href="qmargins.html">QMargins</a></span> &amp;<i>rhs</i>)</h3>
<p>Returns the <i>lhs</i> rectangle shrunk by the <i>rhs</i> margins.</p>
<p>This function was introduced in  Qt 5.3.</p>
<!-- @@@operator- -->
<!-- $$$operator<<[overload1]$$$operator<<QDataStream&constQRect& -->
<h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&lt;&lt;</span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<i>stream</i>, const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>Writes the given <i>rectangle</i> to the given <i>stream</i>, and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator==[overload1]$$$operator==constQRect&constQRect& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> <span class="name">operator==</span>(const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>r1</i>, const <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>r2</i>)</h3>
<p>Returns <code>true</code> if the rectangles <i>r1</i> and <i>r2</i> are equal, otherwise returns <code>false</code>.</p>
<!-- @@@operator== -->
<!-- $$$operator>>[overload1]$$$operator>>QDataStream&QRect& -->
<h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&gt;&gt;</span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<i>stream</i>, <span class="type"><a href="qrect.html#QRect">QRect</a></span> &amp;<i>rectangle</i>)</h3>
<p>Reads a rectangle from the given <i>stream</i> into the given <i>rectangle</i>, and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    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.<br/>    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. </p>
</div>
</body>
</html>