summaryrefslogtreecommitdiffstats
path: root/doc/html/qrect.html
blob: 79eba794a007a2a59530f3531a55c82ae25e3ec2 (plain)
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qrect.cpp:42 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QRect Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QRect Class Reference</h1>

<p>The QRect class defines a rectangle in the plane.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qrect-h.html">qrect.h</a>&gt;</tt>
<p><a href="qrect-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QRect"><b>QRect</b></a> ()</li>
<li class=fn><a href="#QRect-2"><b>QRect</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;topLeft, const&nbsp;QPoint&nbsp;&amp;&nbsp;bottomRight )</li>
<li class=fn><a href="#QRect-3"><b>QRect</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;topLeft, const&nbsp;QSize&nbsp;&amp;&nbsp;size )</li>
<li class=fn><a href="#QRect-4"><b>QRect</b></a> ( int&nbsp;left, int&nbsp;top, int&nbsp;width, int&nbsp;height )</li>
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
<li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
<li class=fn>QRect <a href="#normalize"><b>normalize</b></a> () const</li>
<li class=fn>int <a href="#left"><b>left</b></a> () const</li>
<li class=fn>int <a href="#top"><b>top</b></a> () const</li>
<li class=fn>int <a href="#right"><b>right</b></a> () const</li>
<li class=fn>int <a href="#bottom"><b>bottom</b></a> () const</li>
<li class=fn>QCOORD &amp; <a href="#rLeft"><b>rLeft</b></a> ()</li>
<li class=fn>QCOORD &amp; <a href="#rTop"><b>rTop</b></a> ()</li>
<li class=fn>QCOORD &amp; <a href="#rRight"><b>rRight</b></a> ()</li>
<li class=fn>QCOORD &amp; <a href="#rBottom"><b>rBottom</b></a> ()</li>
<li class=fn>int <a href="#x"><b>x</b></a> () const</li>
<li class=fn>int <a href="#y"><b>y</b></a> () const</li>
<li class=fn>void <a href="#setLeft"><b>setLeft</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#setTop"><b>setTop</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#setRight"><b>setRight</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#setBottom"><b>setBottom</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#setX"><b>setX</b></a> ( int&nbsp;x )</li>
<li class=fn>void <a href="#setY"><b>setY</b></a> ( int&nbsp;y )</li>
<li class=fn>void <a href="#setTopLeft"><b>setTopLeft</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#setBottomRight"><b>setBottomRight</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#setTopRight"><b>setTopRight</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#setBottomLeft"><b>setBottomLeft</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>QPoint <a href="#topLeft"><b>topLeft</b></a> () const</li>
<li class=fn>QPoint <a href="#bottomRight"><b>bottomRight</b></a> () const</li>
<li class=fn>QPoint <a href="#topRight"><b>topRight</b></a> () const</li>
<li class=fn>QPoint <a href="#bottomLeft"><b>bottomLeft</b></a> () const</li>
<li class=fn>QPoint <a href="#center"><b>center</b></a> () const</li>
<li class=fn>void <a href="#rect"><b>rect</b></a> ( int&nbsp;*&nbsp;x, int&nbsp;*&nbsp;y, int&nbsp;*&nbsp;w, int&nbsp;*&nbsp;h ) const</li>
<li class=fn>void <a href="#coords"><b>coords</b></a> ( int&nbsp;*&nbsp;xp1, int&nbsp;*&nbsp;yp1, int&nbsp;*&nbsp;xp2, int&nbsp;*&nbsp;yp2 ) const</li>
<li class=fn>void <a href="#moveLeft"><b>moveLeft</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#moveTop"><b>moveTop</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#moveRight"><b>moveRight</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#moveBottom"><b>moveBottom</b></a> ( int&nbsp;pos )</li>
<li class=fn>void <a href="#moveTopLeft"><b>moveTopLeft</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#moveBottomRight"><b>moveBottomRight</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#moveTopRight"><b>moveTopRight</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#moveBottomLeft"><b>moveBottomLeft</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#moveCenter"><b>moveCenter</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#moveBy"><b>moveBy</b></a> ( int&nbsp;dx, int&nbsp;dy )</li>
<li class=fn>void <a href="#setRect"><b>setRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>void <a href="#setCoords"><b>setCoords</b></a> ( int&nbsp;xp1, int&nbsp;yp1, int&nbsp;xp2, int&nbsp;yp2 )</li>
<li class=fn>void <a href="#addCoords"><b>addCoords</b></a> ( int&nbsp;xp1, int&nbsp;yp1, int&nbsp;xp2, int&nbsp;yp2 )</li>
<li class=fn>QSize <a href="#size"><b>size</b></a> () const</li>
<li class=fn>int <a href="#width"><b>width</b></a> () const</li>
<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
<li class=fn>void <a href="#setWidth"><b>setWidth</b></a> ( int&nbsp;w )</li>
<li class=fn>void <a href="#setHeight"><b>setHeight</b></a> ( int&nbsp;h )</li>
<li class=fn>void <a href="#setSize"><b>setSize</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s )</li>
<li class=fn>QRect <a href="#operator|"><b>operator|</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const</li>
<li class=fn>QRect <a href="#operator-and"><b>operator&amp;</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const</li>
<li class=fn>QRect &amp; <a href="#operator|-eq"><b>operator|=</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>QRect &amp; <a href="#operator-and-eq"><b>operator&amp;=</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>bool <a href="#contains"><b>contains</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p, bool&nbsp;proper = FALSE ) const</li>
<li class=fn>bool <a href="#contains-2"><b>contains</b></a> ( int&nbsp;x, int&nbsp;y ) const</li>
<li class=fn>bool <a href="#contains-3"><b>contains</b></a> ( int&nbsp;x, int&nbsp;y, bool&nbsp;proper ) const</li>
<li class=fn>bool <a href="#contains-4"><b>contains</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, bool&nbsp;proper = FALSE ) const</li>
<li class=fn>QRect <a href="#unite"><b>unite</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const</li>
<li class=fn>QRect <a href="#intersect"><b>intersect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const</li>
<li class=fn>bool <a href="#intersects"><b>intersects</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r1, const&nbsp;QRect&nbsp;&amp;&nbsp;r2 )</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r1, const&nbsp;QRect&nbsp;&amp;&nbsp;r2 )</li>
<li class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QRect&nbsp;&amp;&nbsp;r )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QRect class defines a rectangle in the plane.
<p> 


<p> A rectangle is internally represented as an upper-left corner and
a bottom-right corner, but it is normally expressed as an
upper-left corner and a size.
<p> The coordinate type is QCOORD (defined in <a href="qwindowdefs-h.html">qwindowdefs.h</a> as <tt>int</tt>). The minimum value of QCOORD is QCOORD_MIN (-2147483648) and
the maximum value is  QCOORD_MAX (2147483647).
<p> Note that the size (width and height) of a rectangle might be
different from what you are used to. If the top-left corner and
the bottom-right corner are the same, the height and the width of
the rectangle will both be 1.
<p> Generally, <em>width = right - left + 1</em> and <em>height = bottom - top + 1</em>. We designed it this way to make it correspond to
rectangular spaces used by drawing functions in which the width
and height denote a number of pixels. For example, drawing a
rectangle with width and height 1 draws a single pixel.
<p> The default coordinate system has origin (0, 0) in the top-left
corner. The positive direction of the y axis is down, and the
positive x axis is from left to right.
<p> A QRect can be constructed with a set of left, top, width and
height integers, from two QPoints or from a <a href="qpoint.html">QPoint</a> and a <a href="qsize.html">QSize</a>.
After creation the dimensions can be changed, e.g. with <a href="#setLeft">setLeft</a>(),
<a href="#setRight">setRight</a>(), <a href="#setTop">setTop</a>() and <a href="#setBottom">setBottom</a>(), or by setting sizes, e.g.
<a href="#setWidth">setWidth</a>(), <a href="#setHeight">setHeight</a>() and <a href="#setSize">setSize</a>(). The dimensions can also be
changed with the move functions, e.g. <a href="#moveBy">moveBy</a>(), <a href="#moveCenter">moveCenter</a>(),
<a href="#moveBottomRight">moveBottomRight</a>(), etc. You can also add coordinates to a
rectangle with <a href="#addCoords">addCoords</a>().
<p> You can test to see if a QRect contains a specific point with
<a href="#contains">contains</a>(). You can also test to see if two QRects intersect with
<a href="#intersects">intersects</a>() (see also <a href="#intersect">intersect</a>()). To get the bounding rectangle
of two QRects use <a href="#unite">unite</a>().
<p> <p>See also <a href="qpoint.html">QPoint</a>, <a href="qsize.html">QSize</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QRect"></a>QRect::QRect ()
</h3>

<p> Constructs an invalid rectangle.

<h3 class=fn><a name="QRect-2"></a>QRect::QRect ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;topLeft, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;bottomRight )
</h3>
Constructs a rectangle with <em>topLeft</em> as the top-left corner and
<em>bottomRight</em> as the bottom-right corner.

<h3 class=fn><a name="QRect-3"></a>QRect::QRect ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;topLeft, const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;size )
</h3>
Constructs a rectangle with <em>topLeft</em> as the top-left corner and
<em>size</em> as the rectangle size.

<h3 class=fn><a name="QRect-4"></a>QRect::QRect ( int&nbsp;left, int&nbsp;top, int&nbsp;width, int&nbsp;height )
</h3>

<p> Constructs a rectangle with the <em>top</em>, <em>left</em> corner and <em>width</em> and <em>height</em>.
<p> Example (creates three identical rectangles):
<pre>
        QRect r1( QPoint(100,200), QPoint(110,215) );
        QRect r2( QPoint(100,200), QSize(11,16) );
        QRect r3( 100, 200, 11, 16 );
    </pre>
 

<h3 class=fn>void <a name="addCoords"></a>QRect::addCoords ( int&nbsp;xp1, int&nbsp;yp1, int&nbsp;xp2, int&nbsp;yp2 )
</h3>
Adds <em>xp1</em>, <em>yp1</em>, <em>xp2</em> and <em>yp2</em> respectively to the
existing coordinates of the rectangle.

<p>Examples: <a href="qaxserver-example-multiple.html#x2544">multiple/ax1.h</a> and <a href="qaxserver-example-multiple.html#x2549">multiple/ax2.h</a>.
<h3 class=fn>int <a name="bottom"></a>QRect::bottom () const
</h3>

<p> Returns the bottom coordinate of the rectangle.
<p> <p>See also <a href="#setBottom">setBottom</a>(), <a href="#top">top</a>(), <a href="#bottomLeft">bottomLeft</a>(), and <a href="#bottomRight">bottomRight</a>().

<p>Examples: <a href="qaction-application-example.html#x1152">action/application.cpp</a>, <a href="simple-application-example.html#x1570">application/application.cpp</a>, <a href="desktop-example.html#x1748">desktop/desktop.cpp</a>, <a href="helpviewer-example.html#x1008">helpviewer/helpwindow.cpp</a>, <a href="qfd-example.html#x2003">qfd/fontdisplayer.cpp</a>, <a href="scribble-example.html#x925">scribble/scribble.cpp</a>, and <a href="themes-example.html#x236">themes/wood.cpp</a>.
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="bottomLeft"></a>QRect::bottomLeft () const
</h3>

<p> Returns the bottom-left position of the rectangle.
<p> <p>See also <a href="#setBottomLeft">setBottomLeft</a>(), <a href="#moveBottomLeft">moveBottomLeft</a>(), <a href="#topRight">topRight</a>(), <a href="#bottom">bottom</a>(), and <a href="#left">left</a>().

<p>Example: <a href="tictac-example.html#x32">tictac/tictac.cpp</a>.
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="bottomRight"></a>QRect::bottomRight () const
</h3>

<p> Returns the bottom-right position of the rectangle.
<p> <p>See also <a href="#setBottomRight">setBottomRight</a>(), <a href="#moveBottomRight">moveBottomRight</a>(), <a href="#topLeft">topLeft</a>(), <a href="#right">right</a>(), and <a href="#bottom">bottom</a>().

<p>Example: <a href="tictac-example.html#x33">tictac/tictac.cpp</a>.
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="center"></a>QRect::center () const
</h3>

<p> Returns the center point of the rectangle.
<p> <p>See also <a href="#moveCenter">moveCenter</a>(), <a href="#topLeft">topLeft</a>(), <a href="#bottomRight">bottomRight</a>(), <a href="#topRight">topRight</a>(), and <a href="#bottomLeft">bottomLeft</a>().

<p>Example: <a href="tooltip-example.html#x447">tooltip/tooltip.cpp</a>.
<h3 class=fn>bool <a name="contains"></a>QRect::contains ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, bool&nbsp;proper = FALSE ) const
</h3>
Returns TRUE if the point <em>p</em> is inside or on the edge of the
rectangle; otherwise returns FALSE.
<p> If <em>proper</em> is TRUE, this function returns TRUE only if <em>p</em> is
inside (not on the edge).

<p>Example: <a href="tutorial1-14.html#x2426">t14/cannon.cpp</a>.
<h3 class=fn>bool <a name="contains-2"></a>QRect::contains ( int&nbsp;x, int&nbsp;y ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if the point <em>x</em>, <em>y</em> is inside this rectangle;
otherwise returns FALSE.

<h3 class=fn>bool <a name="contains-3"></a>QRect::contains ( int&nbsp;x, int&nbsp;y, bool&nbsp;proper ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if the point <em>x</em>, <em>y</em> is inside this rectangle;
otherwise returns FALSE.
<p> If <em>proper</em> is TRUE, this function returns TRUE only if the point
is entirely inside (not on the edge).

<h3 class=fn>bool <a name="contains-4"></a>QRect::contains ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, bool&nbsp;proper = FALSE ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if the rectangle <em>r</em> is inside this rectangle;
otherwise returns FALSE.
<p> If <em>proper</em> is TRUE, this function returns TRUE only if <em>r</em> is
entirely inside (not on the edge).
<p> <p>See also <a href="#unite">unite</a>(), <a href="#intersect">intersect</a>(), and <a href="#intersects">intersects</a>().

<h3 class=fn>void <a name="coords"></a>QRect::coords ( int&nbsp;*&nbsp;xp1, int&nbsp;*&nbsp;yp1, int&nbsp;*&nbsp;xp2, int&nbsp;*&nbsp;yp2 ) const
</h3>
Extracts the rectangle parameters as the top-left point <em>*xp1</em>,
<em>*yp1</em> and the bottom-right point <em>*xp2</em>, <em>*yp2</em>.
<p> <p>See also <a href="#setCoords">setCoords</a>() and <a href="#rect">rect</a>().

<p>Examples: <a href="themes-example.html#x297">themes/metal.cpp</a> and <a href="themes-example.html#x237">themes/wood.cpp</a>.
<h3 class=fn>int <a name="height"></a>QRect::height () const
</h3>

<p> Returns the height of the rectangle. The height includes both the
top and bottom edges, i.e. height = bottom - top + 1.
<p> <p>See also <a href="#width">width</a>(), <a href="#size">size</a>(), and <a href="#setHeight">setHeight</a>().

<p>Examples: <a href="coordsys.html#x2279">aclock/aclock.cpp</a>, <a href="desktop-example.html#x1749">desktop/desktop.cpp</a>, <a href="movies-example.html#x515">movies/main.cpp</a>, <a href="scribble-example.html#x926">scribble/scribble.cpp</a>, <a href="themes-example.html#x298">themes/metal.cpp</a>, <a href="themes-example.html#x238">themes/wood.cpp</a>, and <a href="xform-example.html#x1251">xform/xform.cpp</a>.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="intersect"></a>QRect::intersect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
Returns the intersection of this rectangle and rectangle <em>r</em>.
<tt>r.intersect(s)</tt> is equivalent to <tt>r&amp;s</tt>.

<h3 class=fn>bool <a name="intersects"></a>QRect::intersects ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
Returns TRUE if this rectangle intersects with rectangle <em>r</em>
(there is at least one pixel that is within both rectangles);
otherwise returns FALSE.
<p> <p>See also <a href="#intersect">intersect</a>() and <a href="#contains">contains</a>().

<p>Examples: <a href="tutorial1-11.html#x2370">t11/cannon.cpp</a>, <a href="tutorial1-12.html#x2393">t12/cannon.cpp</a>, <a href="tutorial1-13.html#x2406">t13/cannon.cpp</a>, and <a href="tutorial1-14.html#x2427">t14/cannon.cpp</a>.
<h3 class=fn>bool <a name="isEmpty"></a>QRect::isEmpty () const
</h3>

<p> Returns TRUE if the rectangle is empty; otherwise returns FALSE.
<p> An empty rectangle has a <a href="#left">left</a>() &gt; <a href="#right">right</a>() or <a href="#top">top</a>() &gt; <a href="#bottom">bottom</a>().
<p> An empty rectangle is not valid. <tt>isEmpty() == !isValid()</tt>
<p> <p>See also <a href="#isNull">isNull</a>(), <a href="#isValid">isValid</a>(), and <a href="#normalize">normalize</a>().

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

<p> Returns TRUE if the rectangle is a null rectangle; otherwise
returns FALSE.
<p> A null rectangle has both the width and the height set to 0, that
is <a href="#right">right</a>() == <a href="#left">left</a>() - 1 and <a href="#bottom">bottom</a>() == <a href="#top">top</a>() - 1.
<p> Note that if right() == left() and bottom() == top(), then the
rectangle has width 1 and height 1.
<p> A null rectangle is also empty.
<p> A null rectangle is not valid.
<p> <p>See also <a href="#isEmpty">isEmpty</a>() and <a href="#isValid">isValid</a>().

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

<p> Returns TRUE if the rectangle is valid; otherwise returns FALSE.
<p> A valid rectangle has a <a href="#left">left</a>() &lt;= <a href="#right">right</a>() and <a href="#top">top</a>() &lt;= <a href="#bottom">bottom</a>().
<p> Note that non-trivial operations like intersections are not defined
for invalid rectangles.
<p> <tt>isValid() == !isEmpty()</tt>
<p> <p>See also <a href="#isNull">isNull</a>(), <a href="#isEmpty">isEmpty</a>(), and <a href="#normalize">normalize</a>().

<p>Examples: <a href="themes-example.html#x299">themes/metal.cpp</a> and <a href="tooltip-example.html#x448">tooltip/tooltip.cpp</a>.
<h3 class=fn>int <a name="left"></a>QRect::left () const
</h3>

<p> Returns the left coordinate of the rectangle. Identical to <a href="#x">x</a>().
<p> <p>See also <a href="#setLeft">setLeft</a>(), <a href="#right">right</a>(), <a href="#topLeft">topLeft</a>(), and <a href="#bottomLeft">bottomLeft</a>().

<p>Examples: <a href="coordsys.html#x2280">aclock/aclock.cpp</a>, <a href="desktop-example.html#x1750">desktop/desktop.cpp</a>, <a href="i18n-example.html#x1942">i18n/main.cpp</a>, <a href="scribble-example.html#x927">scribble/scribble.cpp</a>, <a href="tictac-example.html#x35">tictac/tictac.cpp</a>, and <a href="xform-example.html#x1252">xform/xform.cpp</a>.
<h3 class=fn>void <a name="moveBottom"></a>QRect::moveBottom ( int&nbsp;pos )
</h3>
Sets the bottom position of the rectangle to <em>pos</em>, leaving the
size unchanged.
<p> <p>See also <a href="#bottom">bottom</a>(), <a href="#setBottom">setBottom</a>(), <a href="#moveLeft">moveLeft</a>(), <a href="#moveTop">moveTop</a>(), and <a href="#moveRight">moveRight</a>().

<h3 class=fn>void <a name="moveBottomLeft"></a>QRect::moveBottomLeft ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Sets the bottom-left position of the rectangle to <em>p</em>, leaving
the size unchanged.
<p> <p>See also <a href="#bottomLeft">bottomLeft</a>(), <a href="#setBottomLeft">setBottomLeft</a>(), <a href="#moveTopLeft">moveTopLeft</a>(), <a href="#moveBottomRight">moveBottomRight</a>(), and <a href="#moveTopRight">moveTopRight</a>().

<p>Example: <a href="tutorial1-10.html#x2360">t10/cannon.cpp</a>.
<h3 class=fn>void <a name="moveBottomRight"></a>QRect::moveBottomRight ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Sets the bottom-right position of the rectangle to <em>p</em>, leaving
the size unchanged.
<p> <p>See also <a href="#bottomRight">bottomRight</a>(), <a href="#setBottomRight">setBottomRight</a>(), <a href="#moveTopLeft">moveTopLeft</a>(), <a href="#moveTopRight">moveTopRight</a>(), and <a href="#moveBottomLeft">moveBottomLeft</a>().

<h3 class=fn>void <a name="moveBy"></a>QRect::moveBy ( int&nbsp;dx, int&nbsp;dy )
</h3>
Moves the rectangle <em>dx</em> along the x axis and <em>dy</em> along the y
axis, relative to the current position. Positive values move the
rectangle to the right and down.
<p> <p>See also <a href="#moveTopLeft">moveTopLeft</a>().

<p>Examples: <a href="qaction-application-example.html#x1154">action/application.cpp</a>, <a href="simple-application-example.html#x1572">application/application.cpp</a>, <a href="helpviewer-example.html#x1010">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2057">mdi/application.cpp</a>, <a href="themes-example.html#x239">themes/wood.cpp</a>, and <a href="xform-example.html#x1253">xform/xform.cpp</a>.
<h3 class=fn>void <a name="moveCenter"></a>QRect::moveCenter ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Sets the center point of the rectangle to <em>p</em>, leaving the size
unchanged.
<p> <p>See also <a href="#center">center</a>(), <a href="#moveTopLeft">moveTopLeft</a>(), <a href="#moveBottomRight">moveBottomRight</a>(), <a href="#moveTopRight">moveTopRight</a>(), and <a href="#moveBottomLeft">moveBottomLeft</a>().

<p>Examples: <a href="tutorial1-11.html#x2371">t11/cannon.cpp</a> and <a href="tutorial1-12.html#x2394">t12/cannon.cpp</a>.
<h3 class=fn>void <a name="moveLeft"></a>QRect::moveLeft ( int&nbsp;pos )
</h3>
Sets the left position of the rectangle to <em>pos</em>, leaving the
size unchanged.
<p> <p>See also <a href="#left">left</a>(), <a href="#setLeft">setLeft</a>(), <a href="#moveTop">moveTop</a>(), <a href="#moveRight">moveRight</a>(), and <a href="#moveBottom">moveBottom</a>().

<h3 class=fn>void <a name="moveRight"></a>QRect::moveRight ( int&nbsp;pos )
</h3>
Sets the right position of the rectangle to <em>pos</em>, leaving the
size unchanged.
<p> <p>See also <a href="#right">right</a>(), <a href="#setRight">setRight</a>(), <a href="#moveLeft">moveLeft</a>(), <a href="#moveTop">moveTop</a>(), and <a href="#moveBottom">moveBottom</a>().

<h3 class=fn>void <a name="moveTop"></a>QRect::moveTop ( int&nbsp;pos )
</h3>
Sets the top position of the rectangle to <em>pos</em>, leaving the
size unchanged.
<p> <p>See also <a href="#top">top</a>(), <a href="#setTop">setTop</a>(), <a href="#moveLeft">moveLeft</a>(), <a href="#moveRight">moveRight</a>(), and <a href="#moveBottom">moveBottom</a>().

<h3 class=fn>void <a name="moveTopLeft"></a>QRect::moveTopLeft ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Sets the top-left position of the rectangle to <em>p</em>, leaving the
size unchanged.
<p> <p>See also <a href="#topLeft">topLeft</a>(), <a href="#setTopLeft">setTopLeft</a>(), <a href="#moveBottomRight">moveBottomRight</a>(), <a href="#moveTopRight">moveTopRight</a>(), and <a href="#moveBottomLeft">moveBottomLeft</a>().

<p>Examples: <a href="helpsystem-example.html#x2681">helpsystem/tooltip.cpp</a> and <a href="xform-example.html#x1254">xform/xform.cpp</a>.
<h3 class=fn>void <a name="moveTopRight"></a>QRect::moveTopRight ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Sets the top-right position of the rectangle to <em>p</em>, leaving the
size unchanged.
<p> <p>See also <a href="#topRight">topRight</a>(), <a href="#setTopRight">setTopRight</a>(), <a href="#moveTopLeft">moveTopLeft</a>(), <a href="#moveBottomRight">moveBottomRight</a>(), and <a href="#moveBottomLeft">moveBottomLeft</a>().

<h3 class=fn><a href="qrect.html">QRect</a> <a name="normalize"></a>QRect::normalize () const
</h3>
Returns a normalized rectangle, i.e. a rectangle that has a
non-negative width and height.
<p> It swaps left and right if <a href="#left">left</a>() &gt; <a href="#right">right</a>(), and swaps top and
bottom if <a href="#top">top</a>() &gt; <a href="#bottom">bottom</a>().
<p> <p>See also <a href="#isValid">isValid</a>().

<p>Example: <a href="scribble-example.html#x928">scribble/scribble.cpp</a>.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="operator-and"></a>QRect::operator&amp; ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
Returns the intersection of this rectangle and rectangle <em>r</em>.
<p> Returns an empty rectangle if there is no intersection.
<p> <p>See also <a href="#operator-and-eq">operator&amp;=</a>(), <a href="#operator|">operator|</a>(), <a href="#isEmpty">isEmpty</a>(), <a href="#intersects">intersects</a>(), and <a href="#contains">contains</a>().

<h3 class=fn><a href="qrect.html">QRect</a>&nbsp;&amp; <a name="operator-and-eq"></a>QRect::operator&amp;= ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
Intersects this rectangle with rectangle <em>r</em>.

<h3 class=fn><a href="qrect.html">QRect</a> <a name="operator|"></a>QRect::operator| ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
Returns the bounding rectangle of this rectangle and rectangle <em>r</em>.
<p> The bounding rectangle of a nonempty rectangle and an empty or
invalid rectangle is defined to be the nonempty rectangle.
<p> <p>See also <a href="#operator|-eq">operator|=</a>(), <a href="#operator-and">operator&amp;</a>(), <a href="#intersects">intersects</a>(), and <a href="#contains">contains</a>().

<h3 class=fn><a href="qrect.html">QRect</a>&nbsp;&amp; <a name="operator|-eq"></a>QRect::operator|= ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
Unites this rectangle with rectangle <em>r</em>.

<h3 class=fn>QCOORD &amp; <a name="rBottom"></a>QRect::rBottom ()
</h3>

<p> Returns a reference to the bottom coordinate of the rectangle.
<p> <p>See also <a href="#rLeft">rLeft</a>(), <a href="#rTop">rTop</a>(), and <a href="#rRight">rRight</a>().

<h3 class=fn>QCOORD &amp; <a name="rLeft"></a>QRect::rLeft ()
</h3>

<p> Returns a reference to the left coordinate of the rectangle.
<p> <p>See also <a href="#rTop">rTop</a>(), <a href="#rRight">rRight</a>(), and <a href="#rBottom">rBottom</a>().

<h3 class=fn>QCOORD &amp; <a name="rRight"></a>QRect::rRight ()
</h3>

<p> Returns a reference to the right coordinate of the rectangle.
<p> <p>See also <a href="#rLeft">rLeft</a>(), <a href="#rTop">rTop</a>(), and <a href="#rBottom">rBottom</a>().

<h3 class=fn>QCOORD &amp; <a name="rTop"></a>QRect::rTop ()
</h3>

<p> Returns a reference to the top coordinate of the rectangle.
<p> <p>See also <a href="#rLeft">rLeft</a>(), <a href="#rRight">rRight</a>(), and <a href="#rBottom">rBottom</a>().

<h3 class=fn>void <a name="rect"></a>QRect::rect ( int&nbsp;*&nbsp;x, int&nbsp;*&nbsp;y, int&nbsp;*&nbsp;w, int&nbsp;*&nbsp;h ) const
</h3>
Extracts the rectangle parameters as the position <em>*x</em>, <em>*y</em> and
width <em>*w</em> and height <em>*h</em>.
<p> <p>See also <a href="#setRect">setRect</a>() and <a href="#coords">coords</a>().

<p>Examples: <a href="themes-example.html#x300">themes/metal.cpp</a> and <a href="themes-example.html#x240">themes/wood.cpp</a>.
<h3 class=fn>int <a name="right"></a>QRect::right () const
</h3>

<p> Returns the right coordinate of the rectangle.
<p> <p>See also <a href="#setRight">setRight</a>(), <a href="#left">left</a>(), <a href="#topRight">topRight</a>(), and <a href="#bottomRight">bottomRight</a>().

<p>Examples: <a href="qaction-application-example.html#x1155">action/application.cpp</a>, <a href="simple-application-example.html#x1573">application/application.cpp</a>, <a href="customlayout-example.html#x1482">customlayout/flow.cpp</a>, <a href="desktop-example.html#x1751">desktop/desktop.cpp</a>, <a href="scribble-example.html#x929">scribble/scribble.cpp</a>, <a href="tutorial1-11.html#x2372">t11/cannon.cpp</a>, and <a href="themes-example.html#x241">themes/wood.cpp</a>.
<h3 class=fn>void <a name="setBottom"></a>QRect::setBottom ( int&nbsp;pos )
</h3>

<p> Sets the bottom edge of the rectangle to <em>pos</em>. May change the
height, but will never change the top edge of the rectangle.
<p> <p>See also <a href="#bottom">bottom</a>(), <a href="#setTop">setTop</a>(), and <a href="#setHeight">setHeight</a>().

<p>Example: <a href="scribble-example.html#x930">scribble/scribble.cpp</a>.
<h3 class=fn>void <a name="setBottomLeft"></a>QRect::setBottomLeft ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Set the bottom-left corner of the rectangle to <em>p</em>. May change
the size, but will the never change the top-right corner of
the rectangle.
<p> <p>See also <a href="#bottomLeft">bottomLeft</a>(), <a href="#moveBottomLeft">moveBottomLeft</a>(), <a href="#setTopLeft">setTopLeft</a>(), <a href="#setBottomRight">setBottomRight</a>(), and <a href="#setTopRight">setTopRight</a>().

<h3 class=fn>void <a name="setBottomRight"></a>QRect::setBottomRight ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Set the bottom-right corner of the rectangle to <em>p</em>. May change
the size, but will the never change the top-left corner of
the rectangle.
<p> <p>See also <a href="#bottomRight">bottomRight</a>(), <a href="#moveBottomRight">moveBottomRight</a>(), <a href="#setTopLeft">setTopLeft</a>(), <a href="#setTopRight">setTopRight</a>(), and <a href="#setBottomLeft">setBottomLeft</a>().

<h3 class=fn>void <a name="setCoords"></a>QRect::setCoords ( int&nbsp;xp1, int&nbsp;yp1, int&nbsp;xp2, int&nbsp;yp2 )
</h3>
Sets the coordinates of the rectangle's top-left corner to <em>(xp1, yp1)</em>, and the coordinates of its bottom-right corner to <em>(xp2, yp2)</em>.
<p> <p>See also <a href="#coords">coords</a>() and <a href="#setRect">setRect</a>().

<h3 class=fn>void <a name="setHeight"></a>QRect::setHeight ( int&nbsp;h )
</h3>
Sets the height of the rectangle to <em>h</em>. The top edge is not
moved, but the bottom edge may be moved.
<p> <p>See also <a href="#height">height</a>(), <a href="#setTop">setTop</a>(), <a href="#setBottom">setBottom</a>(), and <a href="#setSize">setSize</a>().

<p>Example: <a href="desktop-example.html#x1752">desktop/desktop.cpp</a>.
<h3 class=fn>void <a name="setLeft"></a>QRect::setLeft ( int&nbsp;pos )
</h3>

<p> Sets the left edge of the rectangle to <em>pos</em>. May change the
width, but will never change the right edge of the rectangle.
<p> Identical to <a href="#setX">setX</a>().
<p> <p>See also <a href="#left">left</a>(), <a href="#setTop">setTop</a>(), and <a href="#setWidth">setWidth</a>().

<p>Example: <a href="scribble-example.html#x931">scribble/scribble.cpp</a>.
<h3 class=fn>void <a name="setRect"></a>QRect::setRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
</h3>
Sets the coordinates of the rectangle's top-left corner to <em>(x, y)</em>, and its size to <em>(w, h)</em>.
<p> <p>See also <a href="#rect">rect</a>() and <a href="#setCoords">setCoords</a>().

<p>Example: <a href="themes-example.html#x242">themes/wood.cpp</a>.
<h3 class=fn>void <a name="setRight"></a>QRect::setRight ( int&nbsp;pos )
</h3>

<p> Sets the right edge of the rectangle to <em>pos</em>. May change the
width, but will never change the left edge of the rectangle.
<p> <p>See also <a href="#right">right</a>(), <a href="#setLeft">setLeft</a>(), and <a href="#setWidth">setWidth</a>().

<p>Example: <a href="scribble-example.html#x932">scribble/scribble.cpp</a>.
<h3 class=fn>void <a name="setSize"></a>QRect::setSize ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s )
</h3>
Sets the size of the rectangle to <em>s</em>. The top-left corner is not
moved.
<p> <p>See also <a href="#size">size</a>(), <a href="#setWidth">setWidth</a>(), and <a href="#setHeight">setHeight</a>().

<p>Example: <a href="xform-example.html#x1255">xform/xform.cpp</a>.
<h3 class=fn>void <a name="setTop"></a>QRect::setTop ( int&nbsp;pos )
</h3>

<p> Sets the top edge of the rectangle to <em>pos</em>. May change the
height, but will never change the bottom edge of the rectangle.
<p> Identical to <a href="#setY">setY</a>().
<p> <p>See also <a href="#top">top</a>(), <a href="#setBottom">setBottom</a>(), and <a href="#setHeight">setHeight</a>().

<p>Example: <a href="scribble-example.html#x933">scribble/scribble.cpp</a>.
<h3 class=fn>void <a name="setTopLeft"></a>QRect::setTopLeft ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Set the top-left corner of the rectangle to <em>p</em>. May change
the size, but will the never change the bottom-right corner of
the rectangle.
<p> <p>See also <a href="#topLeft">topLeft</a>(), <a href="#moveTopLeft">moveTopLeft</a>(), <a href="#setBottomRight">setBottomRight</a>(), <a href="#setTopRight">setTopRight</a>(), and <a href="#setBottomLeft">setBottomLeft</a>().

<h3 class=fn>void <a name="setTopRight"></a>QRect::setTopRight ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
Set the top-right corner of the rectangle to <em>p</em>. May change
the size, but will the never change the bottom-left corner of
the rectangle.
<p> <p>See also <a href="#topRight">topRight</a>(), <a href="#moveTopRight">moveTopRight</a>(), <a href="#setTopLeft">setTopLeft</a>(), <a href="#setBottomRight">setBottomRight</a>(), and <a href="#setBottomLeft">setBottomLeft</a>().

<h3 class=fn>void <a name="setWidth"></a>QRect::setWidth ( int&nbsp;w )
</h3>
Sets the width of the rectangle to <em>w</em>. The right edge is
changed, but not the left edge.
<p> <p>See also <a href="#width">width</a>(), <a href="#setLeft">setLeft</a>(), <a href="#setRight">setRight</a>(), and <a href="#setSize">setSize</a>().

<p>Example: <a href="desktop-example.html#x1753">desktop/desktop.cpp</a>.
<h3 class=fn>void <a name="setX"></a>QRect::setX ( int&nbsp;x )
</h3>

<p> Sets the x position of the rectangle (its left end) to <em>x</em>. May
change the width, but will never change the right edge of the
rectangle.
<p> Identical to <a href="#setLeft">setLeft</a>().
<p> <p>See also <a href="#x">x</a>() and <a href="#setY">setY</a>().

<h3 class=fn>void <a name="setY"></a>QRect::setY ( int&nbsp;y )
</h3>

<p> Sets the y position of the rectangle (its top) to <em>y</em>. May change
the height, but will never change the bottom edge of the
rectangle.
<p> Identical to <a href="#setTop">setTop</a>().
<p> <p>See also <a href="#y">y</a>() and <a href="#setX">setX</a>().

<h3 class=fn><a href="qsize.html">QSize</a> <a name="size"></a>QRect::size () const
</h3>

<p> Returns the size of the rectangle.
<p> <p>See also <a href="#width">width</a>() and <a href="#height">height</a>().

<p>Examples: <a href="desktop-example.html#x1754">desktop/desktop.cpp</a>, <a href="movies-example.html#x516">movies/main.cpp</a>, and <a href="tutorial1-10.html#x2361">t10/cannon.cpp</a>.
<h3 class=fn>int <a name="top"></a>QRect::top () const
</h3>

<p> Returns the top coordinate of the rectangle. Identical to <a href="#y">y</a>().
<p> <p>See also <a href="#setTop">setTop</a>(), <a href="#bottom">bottom</a>(), <a href="#topLeft">topLeft</a>(), and <a href="#topRight">topRight</a>().

<p>Examples: <a href="coordsys.html#x2281">aclock/aclock.cpp</a>, <a href="desktop-example.html#x1755">desktop/desktop.cpp</a>, <a href="scribble-example.html#x934">scribble/scribble.cpp</a>, <a href="themes-example.html#x243">themes/wood.cpp</a>, <a href="tictac-example.html#x36">tictac/tictac.cpp</a>, and <a href="xform-example.html#x1256">xform/xform.cpp</a>.
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="topLeft"></a>QRect::topLeft () const
</h3>

<p> Returns the top-left position of the rectangle.
<p> <p>See also <a href="#setTopLeft">setTopLeft</a>(), <a href="#moveTopLeft">moveTopLeft</a>(), <a href="#bottomRight">bottomRight</a>(), <a href="#left">left</a>(), and <a href="#top">top</a>().

<p>Examples: <a href="helpsystem-example.html#x2682">helpsystem/tooltip.cpp</a>, <a href="tutorial1-10.html#x2362">t10/cannon.cpp</a>, and <a href="tictac-example.html#x37">tictac/tictac.cpp</a>.
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="topRight"></a>QRect::topRight () const
</h3>

<p> Returns the top-right position of the rectangle.
<p> <p>See also <a href="#setTopRight">setTopRight</a>(), <a href="#moveTopRight">moveTopRight</a>(), <a href="#bottomLeft">bottomLeft</a>(), <a href="#top">top</a>(), and <a href="#right">right</a>().

<p>Example: <a href="tictac-example.html#x38">tictac/tictac.cpp</a>.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="unite"></a>QRect::unite ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>
Returns the bounding rectangle of this rectangle and rectangle <em>r</em>. <tt>r.unite(s)</tt> is equivalent to <tt>r|s</tt>.

<p>Examples: <a href="tutorial1-11.html#x2373">t11/cannon.cpp</a>, <a href="tutorial1-12.html#x2395">t12/cannon.cpp</a>, and <a href="xform-example.html#x1257">xform/xform.cpp</a>.
<h3 class=fn>int <a name="width"></a>QRect::width () const
</h3>

<p> Returns the width of the rectangle. The width includes both the
left and right edges, i.e. width = right - left + 1.
<p> <p>See also <a href="#height">height</a>(), <a href="#size">size</a>(), and <a href="#setHeight">setHeight</a>().

<p>Examples: <a href="coordsys.html#x2282">aclock/aclock.cpp</a>, <a href="customlayout-example.html#x1505">customlayout/border.cpp</a>, <a href="desktop-example.html#x1756">desktop/desktop.cpp</a>, <a href="movies-example.html#x517">movies/main.cpp</a>, <a href="themes-example.html#x301">themes/metal.cpp</a>, <a href="themes-example.html#x244">themes/wood.cpp</a>, and <a href="xform-example.html#x1258">xform/xform.cpp</a>.
<h3 class=fn>int <a name="x"></a>QRect::x () const
</h3>

<p> Returns the left coordinate of the rectangle. Identical to <a href="#left">left</a>().
<p> <p>See also <a href="#left">left</a>(), <a href="#y">y</a>(), and <a href="#setX">setX</a>().

<p>Examples: <a href="customlayout-example.html#x1506">customlayout/border.cpp</a>, <a href="desktop-example.html#x1757">desktop/desktop.cpp</a>, <a href="movies-example.html#x518">movies/main.cpp</a>, <a href="scribble-example.html#x936">scribble/scribble.cpp</a>, <a href="tutorial1-12.html#x2396">t12/cannon.cpp</a>, <a href="themes-example.html#x302">themes/metal.cpp</a>, and <a href="themes-example.html#x245">themes/wood.cpp</a>.
<h3 class=fn>int <a name="y"></a>QRect::y () const
</h3>

<p> Returns the top coordinate of the rectangle. Identical to <a href="#top">top</a>().
<p> <p>See also <a href="#top">top</a>(), <a href="#x">x</a>(), and <a href="#setY">setY</a>().

<p>Examples: <a href="desktop-example.html#x1758">desktop/desktop.cpp</a>, <a href="movies-example.html#x519">movies/main.cpp</a>, <a href="scribble-example.html#x937">scribble/scribble.cpp</a>, <a href="tutorial1-12.html#x2397">t12/cannon.cpp</a>, <a href="tutorial1-14.html#x2429">t14/cannon.cpp</a>, <a href="themes-example.html#x303">themes/metal.cpp</a>, and <a href="themes-example.html#x246">themes/wood.cpp</a>.
<hr><h2>Related Functions</h2>
<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r1, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r2 )
</h3>

<p> Returns TRUE if <em>r1</em> and <em>r2</em> are different; otherwise returns FALSE.

<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>

<p> Writes the QRect, <em>r</em>, to the stream <em>s</em>, and returns a
reference to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.

<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r1, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r2 )
</h3>

<p> Returns TRUE if <em>r1</em> and <em>r2</em> are equal; otherwise returns FALSE.

<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>

<p> Reads a QRect from the stream <em>s</em> into rect <em>r</em> and returns a
reference to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>