1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QRegion Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QRegion Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QRegion class specifies a clip region for a painter.
<a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qregion.html#RegionType-enum">RegionType</a></b> { Rectangle, Ellipse }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qregion.html#QRegion">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-2">__init__</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, RegionType <i>type</i> = QRegion.Rectangle)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-3">__init__</a></b> (<i>self</i>, QRect <i>r</i>, RegionType <i>type</i> = QRegion.Rectangle)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-4">__init__</a></b> (<i>self</i>, QPolygon <i>a</i>, Qt.FillRule <i>fillRule</i> = Qt.OddEvenFill)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-5">__init__</a></b> (<i>self</i>, QBitmap <i>bitmap</i>)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-6">__init__</a></b> (<i>self</i>, QRegion <i>region</i>)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-7">__init__</a></b> (<i>self</i>, QVariant <i>variant</i>)</li><li><div class="fn" />QRect <b><a href="qregion.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#contains">contains</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#contains-2">contains</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#eor">eor</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#intersect">intersect</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#intersected">intersected</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#intersected-2">intersected</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#intersects">intersects</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#intersects-2">intersects</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qregion.html#numRects">numRects</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qregion.html#rectCount">rectCount</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QRect <b><a href="qregion.html#rects">rects</a></b> (<i>self</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#subtract">subtract</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#subtracted">subtracted</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" /><b><a href="qregion.html#swap">swap</a></b> (<i>self</i>, QRegion <i>other</i>)</li><li><div class="fn" /><b><a href="qregion.html#translate">translate</a></b> (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</li><li><div class="fn" /><b><a href="qregion.html#translate-2">translate</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#translated">translated</a></b> (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#translated-2">translated</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#unite">unite</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#united">united</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#united-2">united</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#xored">xored</a></b> (<i>self</i>, QRegion <i>r</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QRegion <b><a href="qregion.html#__add__">__add__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__add__-2">__add__</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__and__">__and__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__and__-2">__and__</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />int <b><a href="qregion.html#__bool__">__bool__</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qregion.html#__contains__">__contains__</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" />int <b><a href="qregion.html#__contains__-2">__contains__</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#__eq__">__eq__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iadd__">__iadd__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iadd__-2">__iadd__</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iand__">__iand__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iand__-2">__iand__</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__ior__">__ior__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__isub__">__isub__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__ixor__">__ixor__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__mul__">__mul__</a></b> (<i>self</i>, QMatrix <i>m</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__mul__-2">__mul__</a></b> (<i>self</i>, QTransform <i>m</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#__ne__">__ne__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__or__">__or__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__sub__">__sub__</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__xor__">__xor__</a></b> (<i>self</i>, QRegion <i>r</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QRegion class specifies a clip region for a painter.</p>
<p>QRegion is used with <a href="qpainter.html#setClipRegion">QPainter.setClipRegion</a>() to
limit the paint area to what needs to be painted. There is also a
<a href="qwidget.html#repaint">QWidget.repaint</a>() function that
takes a QRegion parameter. QRegion is the best tool for minimizing
the amount of screen area to be updated by a repaint.</p>
<p>This class is not suitable for constructing shapes for
rendering, especially as outlines. Use <a href="qpainterpath.html">QPainterPath</a> to create paths and shapes for
use with <a href="qpainter.html">QPainter</a>.</p>
<p>QRegion is an <a href="implicit-sharing.html#implicitly-shared">implicitly shared</a>
class.</p>
<a id="creating-and-using-regions" name="creating-and-using-regions" />
<h3>Creating and Using Regions</h3>
<p>A region can be created from a rectangle, an ellipse, a polygon
or a bitmap. Complex regions may be created by combining simple
regions using <a href="qregion.html#united">united</a>(), <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#subtracted">subtracted</a>(), or <a href="qregion.html#xored">xored</a>() (exclusive or). You can move a
region using <a href="qregion.html#translate">translate</a>().</p>
<p>You can test whether a region <a href="qregion.html#isEmpty">isEmpty</a>() or if it <a href="qregion.html#contains">contains</a>() a <a href="qpoint.html">QPoint</a> or <a href="qrect.html">QRect</a>. The
bounding rectangle can be found with <a href="qregion.html#boundingRect">boundingRect</a>().</p>
<p>The function <a href="qregion.html#rects">rects</a>() gives a
decomposition of the region into rectangles.</p>
<p>Example of using complex regions:</p>
<pre class="cpp">
<span class="type">void</span> MyWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type">QRegion</span> r1(<span class="type"><a href="qrect.html">QRect</a></span>(<span class="number">100</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">200</span><span class="operator">,</span> <span class="number">80</span>)<span class="operator">,</span> <span class="comment">// r1: elliptic region</span>
<span class="type">QRegion</span><span class="operator">.</span>Ellipse);
<span class="type">QRegion</span> r2(<span class="type"><a href="qrect.html">QRect</a></span>(<span class="number">100</span><span class="operator">,</span> <span class="number">120</span><span class="operator">,</span> <span class="number">90</span><span class="operator">,</span> <span class="number">30</span>)); <span class="comment">// r2: rectangular region</span>
<span class="type">QRegion</span> r3 <span class="operator">=</span> r1<span class="operator">.</span>intersected(r2); <span class="comment">// r3: intersection</span>
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>setClipRegion(r3);
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> <span class="comment">// paint clipped graphics</span>
}
</pre>
<a id="additional-license-information" name="additional-license-information" />
<h3>Additional License Information</h3>
<p>On Embedded Linux, Windows CE and X11 platforms, parts of this
class rely on code obtained under the following licenses:</p>
<div class="LegaleseLeft">
<p>Copyright (c) 1987 X Consortium</p>
<p>Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<p>Except as contained in this notice, the name of the X Consortium
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the X Consortium.</p>
</div>
<br />
<div class="LegaleseLeft">
<p>Copyright 1987 by Digital Equipment Corporation, Maynard,
Massachusetts.</p>
<p>All Rights Reserved</p>
<p>Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that copyright notice and this permission
notice appear in supporting documentation, and that the name of
Digital not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.</p>
<p>DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p>
</div>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="RegionType-enum" />QRegion.RegionType</h3><p>Specifies the shape of the region to be created.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QRegion.Rectangle</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">the region covers the entire rectangle.</td>
</tr>
<tr>
<td class="topAlign"><tt>QRegion.Ellipse</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">the region is an ellipse inside the
rectangle.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QRegion" />QRegion.__init__ (<i>self</i>)</h3><p>Constructs an empty region.</p>
<p><b>See also</b> <a href="qregion.html#isEmpty">isEmpty</a>().</p>
<h3 class="fn"><a name="QRegion-2" />QRegion.__init__ (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, <a href="qregion.html#RegionType-enum">RegionType</a> <i>type</i> = QRegion.Rectangle)</h3><p>Constructs a rectangular or elliptic region.</p>
<p>If <i>t</i> is <tt>Rectangle</tt>, the region is the filled
rectangle (<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>). If <i>t</i> is
<tt>Ellipse</tt>, the region is the filled ellipse with center at
(<i>x</i> + <i>w</i> / 2, <i>y</i> + <i>h</i> / 2) and size
(<i>w</i> ,<i>h</i>).</p>
<h3 class="fn"><a name="QRegion-3" />QRegion.__init__ (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>, <a href="qregion.html#RegionType-enum">RegionType</a> <i>type</i> = QRegion.Rectangle)</h3><p>Constructs a polygon region from the point array <i>a</i> with
the fill rule specified by <i>fillRule</i>.</p>
<p>If <i>fillRule</i> is <a href="qt.html#FillRule-enum">Qt.WindingFill</a>, the polygon region is
defined using the winding algorithm; if it is <a href="qt.html#FillRule-enum">Qt.OddEvenFill</a>, the odd-even fill
algorithm is used.</p>
<p><b>Warning:</b> This constructor can be used to create complex
regions that will slow down painting when used.</p>
<h3 class="fn"><a name="QRegion-4" />QRegion.__init__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a> <i>a</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a> <i>fillRule</i> = Qt.OddEvenFill)</h3><h3 class="fn"><a name="QRegion-5" />QRegion.__init__ (<i>self</i>, <a href="qbitmap.html">QBitmap</a> <i>bitmap</i>)</h3><p>Constructs a new region which is equal to region <i>r</i>.</p>
<h3 class="fn"><a name="QRegion-6" />QRegion.__init__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>region</i>)</h3><p>Constructs a region from the bitmap <i>bm</i>.</p>
<p>The resulting region consists of the pixels in bitmap <i>bm</i>
that are <a href="qt.html#GlobalColor-enum">Qt.color1</a>, as if
each pixel was a 1 by 1 rectangle.</p>
<p>This constructor may create complex regions that will slow down
painting when used. Note that drawing masked pixmaps can be done
much faster using <a href="qpixmap.html#setMask">QPixmap.setMask</a>().</p>
<h3 class="fn"><a name="QRegion-7" />QRegion.__init__ (<i>self</i>, QVariant <i>variant</i>)</h3><p>This is an overloaded function.</p>
<p>Create a region based on the rectange <i>r</i> with region type
<i>t</i>.</p>
<p>If the rectangle is invalid a null region will be created.</p>
<p><b>See also</b> <a href="qregion.html#RegionType-enum">QRegion.RegionType</a>.</p>
<h3 class="fn"><a name="boundingRect" /><a href="qrect.html">QRect</a> QRegion.boundingRect (<i>self</i>)</h3><p>Returns the bounding rectangle of this region. An empty region
gives a rectangle that is <a href="qrect.html#isNull">QRect.isNull</a>().</p>
<h3 class="fn"><a name="contains" />bool QRegion.contains (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>)</h3><p>Returns true if the region contains the point <i>p</i>;
otherwise returns false.</p>
<h3 class="fn"><a name="contains-2" />bool QRegion.contains (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><p>This is an overloaded function.</p>
<p>Returns true if the region overlaps the rectangle <i>r</i>;
otherwise returns false.</p>
<h3 class="fn"><a name="eor" /><a href="qregion.html">QRegion</a> QRegion.eor (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="intersect" /><a href="qregion.html">QRegion</a> QRegion.intersect (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="intersected" /><a href="qregion.html">QRegion</a> QRegion.intersected (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><p>Returns a region which is the intersection of this region and
<i>r</i>.</p>
<p class="centerAlign"><img alt="Region Intersection" src="images/rintersect.png" /></p>
<p>The figure shows the intersection of two elliptical regions.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#subtracted">subtracted</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#xored">xored</a>().</p>
<h3 class="fn"><a name="intersected-2" /><a href="qregion.html">QRegion</a> QRegion.intersected (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><p>Returns a region which is the intersection of this region and
the given <i>rect</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qregion.html#subtracted">subtracted</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#xored">xored</a>().</p>
<h3 class="fn"><a name="intersects" />bool QRegion.intersects (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><p>Returns true if this region intersects with <i>region</i>,
otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="intersects-2" />bool QRegion.intersects (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><p>Returns true if this region intersects with <i>rect</i>,
otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<h3 class="fn"><a name="isEmpty" />bool QRegion.isEmpty (<i>self</i>)</h3><p>Returns true if the region is empty; otherwise returns false. An
empty region is a region that contains no points.</p>
<p>Example:</p>
<pre class="cpp">
<span class="type"><a href="qregion.html">QRegion</a></span> r1(<span class="number">10</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="number">20</span><span class="operator">,</span> <span class="number">20</span>);
r1<span class="operator">.</span>isEmpty(); <span class="comment">// false</span>
<span class="type"><a href="qregion.html">QRegion</a></span> r3;
r3<span class="operator">.</span>isEmpty(); <span class="comment">// true</span>
<span class="type"><a href="qregion.html">QRegion</a></span> r2(<span class="number">40</span><span class="operator">,</span> <span class="number">40</span><span class="operator">,</span> <span class="number">20</span><span class="operator">,</span> <span class="number">20</span>);
r3 <span class="operator">=</span> r1<span class="operator">.</span><a href="qregion.html#intersected">intersected</a>(r2); <span class="comment">// r3: intersection of r1 and r2</span>
r3<span class="operator">.</span>isEmpty(); <span class="comment">// true</span>
r3 <span class="operator">=</span> r1<span class="operator">.</span><a href="qregion.html#united">united</a>(r2); <span class="comment">// r3: union of r1 and r2</span>
r3<span class="operator">.</span>isEmpty(); <span class="comment">// false</span>
</pre>
<h3 class="fn"><a name="numRects" />int QRegion.numRects (<i>self</i>)</h3><h3 class="fn"><a name="rectCount" />int QRegion.rectCount (<i>self</i>)</h3><p>Returns the number of rectangles that will be returned in
<a href="qregion.html#rects">rects</a>().</p>
<p>This function was introduced in Qt 4.6.</p>
<h3 class="fn"><a name="rects" />list-of-QRect QRegion.rects (<i>self</i>)</h3><p>Returns an array of non-overlapping rectangles that make up the
region.</p>
<p>The union of all the rectangles is equal to the original
region.</p>
<p><b>See also</b> <a href="qregion.html#setRects">setRects</a>().</p>
<h3 class="fn"><a name="subtract" /><a href="qregion.html">QRegion</a> QRegion.subtract (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="subtracted" /><a href="qregion.html">QRegion</a> QRegion.subtracted (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><p>Returns a region which is <i>r</i> subtracted from this
region.</p>
<p class="centerAlign"><img alt="Region Subtraction" src="images/rsubtract.png" /></p>
<p>The figure shows the result when the ellipse on the right is
subtracted from the ellipse on the left (<tt>left -
right</tt>).</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#xored">xored</a>().</p>
<h3 class="fn"><a name="swap" />QRegion.swap (<i>self</i>, <a href="qregion.html">QRegion</a> <i>other</i>)</h3><p>Swaps region <i>other</i> with this region. This operation is
very fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>
<h3 class="fn"><a name="translate" />QRegion.translate (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</h3><p>Translates (moves) the region <i>dx</i> along the X axis and
<i>dy</i> along the Y axis.</p>
<h3 class="fn"><a name="translate-2" />QRegion.translate (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Translates the region <i>point</i><i>.x()</i> along the x axis
and <i>point</i><i>.y()</i> along the y axis, relative to the
current position. Positive values move the region to the right and
down.</p>
<p>Translates to the given <i>point</i>.</p>
<h3 class="fn"><a name="translated" /><a href="qregion.html">QRegion</a> QRegion.translated (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</h3><p>Returns a copy of the region 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 region to the right and
down.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qregion.html#translate">translate</a>().</p>
<h3 class="fn"><a name="translated-2" /><a href="qregion.html">QRegion</a> QRegion.translated (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Returns a copy of the regtion that is translated
<i>p</i><i>.x()</i> along the x axis and <i>p</i><i>.y()</i> along
the y axis, relative to the current position. Positive values move
the rectangle to the right and down.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qregion.html#translate">translate</a>().</p>
<h3 class="fn"><a name="unite" /><a href="qregion.html">QRegion</a> QRegion.unite (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="united" /><a href="qregion.html">QRegion</a> QRegion.united (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><p>Returns a region which is the union of this region and
<i>r</i>.</p>
<p class="centerAlign"><img alt="Region Union" src="images/runion.png" /></p>
<p>The figure shows the union of two elliptical regions.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#subtracted">subtracted</a>(), and <a href="qregion.html#xored">xored</a>().</p>
<h3 class="fn"><a name="united-2" /><a href="qregion.html">QRegion</a> QRegion.united (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><p>Returns a region which is the union of this region and the given
<i>rect</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#subtracted">subtracted</a>(), and <a href="qregion.html#xored">xored</a>().</p>
<h3 class="fn"><a name="xored" /><a href="qregion.html">QRegion</a> QRegion.xored (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><p>Returns a region which is the exclusive or (XOR) of this region
and <i>r</i>.</p>
<p class="centerAlign"><img alt="Region XORed" src="images/rxor.png" /></p>
<p>The figure shows the exclusive or of two elliptical regions.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#subtracted">subtracted</a>().</p>
<h3 class="fn"><a name="__add__" /><a href="qregion.html">QRegion</a> QRegion.__add__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__add__-2" /><a href="qregion.html">QRegion</a> QRegion.__add__ (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><h3 class="fn"><a name="__and__" /><a href="qregion.html">QRegion</a> QRegion.__and__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__and__-2" /><a href="qregion.html">QRegion</a> QRegion.__and__ (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><h3 class="fn"><a name="__bool__" />int QRegion.__bool__ (<i>self</i>)</h3><h3 class="fn"><a name="__contains__" />int QRegion.__contains__ (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>)</h3><h3 class="fn"><a name="__contains__-2" />int QRegion.__contains__ (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><h3 class="fn"><a name="__eq__" />bool QRegion.__eq__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qregion.html">QRegion</a> QRegion.__iadd__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__iadd__-2" /><a href="qregion.html">QRegion</a> QRegion.__iadd__ (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><h3 class="fn"><a name="__iand__" /><a href="qregion.html">QRegion</a> QRegion.__iand__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__iand__-2" /><a href="qregion.html">QRegion</a> QRegion.__iand__ (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><h3 class="fn"><a name="__ior__" /><a href="qregion.html">QRegion</a> QRegion.__ior__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__isub__" /><a href="qregion.html">QRegion</a> QRegion.__isub__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__ixor__" /><a href="qregion.html">QRegion</a> QRegion.__ixor__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__mul__" /><a href="qregion.html">QRegion</a> QRegion.__mul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a> <i>m</i>)</h3><h3 class="fn"><a name="__mul__-2" /><a href="qregion.html">QRegion</a> QRegion.__mul__ (<i>self</i>, <a href="qtransform.html">QTransform</a> <i>m</i>)</h3><h3 class="fn"><a name="__ne__" />bool QRegion.__ne__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__or__" /><a href="qregion.html">QRegion</a> QRegion.__or__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__sub__" /><a href="qregion.html">QRegion</a> QRegion.__sub__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><h3 class="fn"><a name="__xor__" /><a href="qregion.html">QRegion</a> QRegion.__xor__ (<i>self</i>, <a href="qregion.html">QRegion</a> <i>r</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.9.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.2</td></tr></table></div></address></body></html>
|