1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qrect.cpp:42 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QRect Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <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>
|
---|
33 |
|
---|
34 | <p>The QRect class defines a rectangle in the plane.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qrect-h.html">qrect.h</a>></tt>
|
---|
37 | <p><a href="qrect-members.html">List of all member functions.</a>
|
---|
38 | <h2>Public Members</h2>
|
---|
39 | <ul>
|
---|
40 | <li class=fn><a href="#QRect"><b>QRect</b></a> ()</li>
|
---|
41 | <li class=fn><a href="#QRect-2"><b>QRect</b></a> ( const QPoint & topLeft, const QPoint & bottomRight )</li>
|
---|
42 | <li class=fn><a href="#QRect-3"><b>QRect</b></a> ( const QPoint & topLeft, const QSize & size )</li>
|
---|
43 | <li class=fn><a href="#QRect-4"><b>QRect</b></a> ( int left, int top, int width, int height )</li>
|
---|
44 | <li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
|
---|
45 | <li class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</li>
|
---|
46 | <li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
|
---|
47 | <li class=fn>QRect <a href="#normalize"><b>normalize</b></a> () const</li>
|
---|
48 | <li class=fn>int <a href="#left"><b>left</b></a> () const</li>
|
---|
49 | <li class=fn>int <a href="#top"><b>top</b></a> () const</li>
|
---|
50 | <li class=fn>int <a href="#right"><b>right</b></a> () const</li>
|
---|
51 | <li class=fn>int <a href="#bottom"><b>bottom</b></a> () const</li>
|
---|
52 | <li class=fn>QCOORD & <a href="#rLeft"><b>rLeft</b></a> ()</li>
|
---|
53 | <li class=fn>QCOORD & <a href="#rTop"><b>rTop</b></a> ()</li>
|
---|
54 | <li class=fn>QCOORD & <a href="#rRight"><b>rRight</b></a> ()</li>
|
---|
55 | <li class=fn>QCOORD & <a href="#rBottom"><b>rBottom</b></a> ()</li>
|
---|
56 | <li class=fn>int <a href="#x"><b>x</b></a> () const</li>
|
---|
57 | <li class=fn>int <a href="#y"><b>y</b></a> () const</li>
|
---|
58 | <li class=fn>void <a href="#setLeft"><b>setLeft</b></a> ( int pos )</li>
|
---|
59 | <li class=fn>void <a href="#setTop"><b>setTop</b></a> ( int pos )</li>
|
---|
60 | <li class=fn>void <a href="#setRight"><b>setRight</b></a> ( int pos )</li>
|
---|
61 | <li class=fn>void <a href="#setBottom"><b>setBottom</b></a> ( int pos )</li>
|
---|
62 | <li class=fn>void <a href="#setX"><b>setX</b></a> ( int x )</li>
|
---|
63 | <li class=fn>void <a href="#setY"><b>setY</b></a> ( int y )</li>
|
---|
64 | <li class=fn>void <a href="#setTopLeft"><b>setTopLeft</b></a> ( const QPoint & p )</li>
|
---|
65 | <li class=fn>void <a href="#setBottomRight"><b>setBottomRight</b></a> ( const QPoint & p )</li>
|
---|
66 | <li class=fn>void <a href="#setTopRight"><b>setTopRight</b></a> ( const QPoint & p )</li>
|
---|
67 | <li class=fn>void <a href="#setBottomLeft"><b>setBottomLeft</b></a> ( const QPoint & p )</li>
|
---|
68 | <li class=fn>QPoint <a href="#topLeft"><b>topLeft</b></a> () const</li>
|
---|
69 | <li class=fn>QPoint <a href="#bottomRight"><b>bottomRight</b></a> () const</li>
|
---|
70 | <li class=fn>QPoint <a href="#topRight"><b>topRight</b></a> () const</li>
|
---|
71 | <li class=fn>QPoint <a href="#bottomLeft"><b>bottomLeft</b></a> () const</li>
|
---|
72 | <li class=fn>QPoint <a href="#center"><b>center</b></a> () const</li>
|
---|
73 | <li class=fn>void <a href="#rect"><b>rect</b></a> ( int * x, int * y, int * w, int * h ) const</li>
|
---|
74 | <li class=fn>void <a href="#coords"><b>coords</b></a> ( int * xp1, int * yp1, int * xp2, int * yp2 ) const</li>
|
---|
75 | <li class=fn>void <a href="#moveLeft"><b>moveLeft</b></a> ( int pos )</li>
|
---|
76 | <li class=fn>void <a href="#moveTop"><b>moveTop</b></a> ( int pos )</li>
|
---|
77 | <li class=fn>void <a href="#moveRight"><b>moveRight</b></a> ( int pos )</li>
|
---|
78 | <li class=fn>void <a href="#moveBottom"><b>moveBottom</b></a> ( int pos )</li>
|
---|
79 | <li class=fn>void <a href="#moveTopLeft"><b>moveTopLeft</b></a> ( const QPoint & p )</li>
|
---|
80 | <li class=fn>void <a href="#moveBottomRight"><b>moveBottomRight</b></a> ( const QPoint & p )</li>
|
---|
81 | <li class=fn>void <a href="#moveTopRight"><b>moveTopRight</b></a> ( const QPoint & p )</li>
|
---|
82 | <li class=fn>void <a href="#moveBottomLeft"><b>moveBottomLeft</b></a> ( const QPoint & p )</li>
|
---|
83 | <li class=fn>void <a href="#moveCenter"><b>moveCenter</b></a> ( const QPoint & p )</li>
|
---|
84 | <li class=fn>void <a href="#moveBy"><b>moveBy</b></a> ( int dx, int dy )</li>
|
---|
85 | <li class=fn>void <a href="#setRect"><b>setRect</b></a> ( int x, int y, int w, int h )</li>
|
---|
86 | <li class=fn>void <a href="#setCoords"><b>setCoords</b></a> ( int xp1, int yp1, int xp2, int yp2 )</li>
|
---|
87 | <li class=fn>void <a href="#addCoords"><b>addCoords</b></a> ( int xp1, int yp1, int xp2, int yp2 )</li>
|
---|
88 | <li class=fn>QSize <a href="#size"><b>size</b></a> () const</li>
|
---|
89 | <li class=fn>int <a href="#width"><b>width</b></a> () const</li>
|
---|
90 | <li class=fn>int <a href="#height"><b>height</b></a> () const</li>
|
---|
91 | <li class=fn>void <a href="#setWidth"><b>setWidth</b></a> ( int w )</li>
|
---|
92 | <li class=fn>void <a href="#setHeight"><b>setHeight</b></a> ( int h )</li>
|
---|
93 | <li class=fn>void <a href="#setSize"><b>setSize</b></a> ( const QSize & s )</li>
|
---|
94 | <li class=fn>QRect <a href="#operator|"><b>operator|</b></a> ( const QRect & r ) const</li>
|
---|
95 | <li class=fn>QRect <a href="#operator-and"><b>operator&</b></a> ( const QRect & r ) const</li>
|
---|
96 | <li class=fn>QRect & <a href="#operator|-eq"><b>operator|=</b></a> ( const QRect & r )</li>
|
---|
97 | <li class=fn>QRect & <a href="#operator-and-eq"><b>operator&=</b></a> ( const QRect & r )</li>
|
---|
98 | <li class=fn>bool <a href="#contains"><b>contains</b></a> ( const QPoint & p, bool proper = FALSE ) const</li>
|
---|
99 | <li class=fn>bool <a href="#contains-2"><b>contains</b></a> ( int x, int y ) const</li>
|
---|
100 | <li class=fn>bool <a href="#contains-3"><b>contains</b></a> ( int x, int y, bool proper ) const</li>
|
---|
101 | <li class=fn>bool <a href="#contains-4"><b>contains</b></a> ( const QRect & r, bool proper = FALSE ) const</li>
|
---|
102 | <li class=fn>QRect <a href="#unite"><b>unite</b></a> ( const QRect & r ) const</li>
|
---|
103 | <li class=fn>QRect <a href="#intersect"><b>intersect</b></a> ( const QRect & r ) const</li>
|
---|
104 | <li class=fn>bool <a href="#intersects"><b>intersects</b></a> ( const QRect & r ) const</li>
|
---|
105 | </ul>
|
---|
106 | <h2>Related Functions</h2>
|
---|
107 | <ul>
|
---|
108 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QRect & r1, const QRect & r2 )</li>
|
---|
109 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QRect & r1, const QRect & r2 )</li>
|
---|
110 | <li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QRect & r )</li>
|
---|
111 | <li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QRect & r )</li>
|
---|
112 | </ul>
|
---|
113 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
114 |
|
---|
115 |
|
---|
116 | The QRect class defines a rectangle in the plane.
|
---|
117 | <p>
|
---|
118 |
|
---|
119 |
|
---|
120 | <p> A rectangle is internally represented as an upper-left corner and
|
---|
121 | a bottom-right corner, but it is normally expressed as an
|
---|
122 | upper-left corner and a size.
|
---|
123 | <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
|
---|
124 | the maximum value is QCOORD_MAX (2147483647).
|
---|
125 | <p> Note that the size (width and height) of a rectangle might be
|
---|
126 | different from what you are used to. If the top-left corner and
|
---|
127 | the bottom-right corner are the same, the height and the width of
|
---|
128 | the rectangle will both be 1.
|
---|
129 | <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
|
---|
130 | rectangular spaces used by drawing functions in which the width
|
---|
131 | and height denote a number of pixels. For example, drawing a
|
---|
132 | rectangle with width and height 1 draws a single pixel.
|
---|
133 | <p> The default coordinate system has origin (0, 0) in the top-left
|
---|
134 | corner. The positive direction of the y axis is down, and the
|
---|
135 | positive x axis is from left to right.
|
---|
136 | <p> A QRect can be constructed with a set of left, top, width and
|
---|
137 | height integers, from two QPoints or from a <a href="qpoint.html">QPoint</a> and a <a href="qsize.html">QSize</a>.
|
---|
138 | After creation the dimensions can be changed, e.g. with <a href="#setLeft">setLeft</a>(),
|
---|
139 | <a href="#setRight">setRight</a>(), <a href="#setTop">setTop</a>() and <a href="#setBottom">setBottom</a>(), or by setting sizes, e.g.
|
---|
140 | <a href="#setWidth">setWidth</a>(), <a href="#setHeight">setHeight</a>() and <a href="#setSize">setSize</a>(). The dimensions can also be
|
---|
141 | changed with the move functions, e.g. <a href="#moveBy">moveBy</a>(), <a href="#moveCenter">moveCenter</a>(),
|
---|
142 | <a href="#moveBottomRight">moveBottomRight</a>(), etc. You can also add coordinates to a
|
---|
143 | rectangle with <a href="#addCoords">addCoords</a>().
|
---|
144 | <p> You can test to see if a QRect contains a specific point with
|
---|
145 | <a href="#contains">contains</a>(). You can also test to see if two QRects intersect with
|
---|
146 | <a href="#intersects">intersects</a>() (see also <a href="#intersect">intersect</a>()). To get the bounding rectangle
|
---|
147 | of two QRects use <a href="#unite">unite</a>().
|
---|
148 | <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>.
|
---|
149 |
|
---|
150 | <hr><h2>Member Function Documentation</h2>
|
---|
151 | <h3 class=fn><a name="QRect"></a>QRect::QRect ()
|
---|
152 | </h3>
|
---|
153 |
|
---|
154 | <p> Constructs an invalid rectangle.
|
---|
155 |
|
---|
156 | <h3 class=fn><a name="QRect-2"></a>QRect::QRect ( const <a href="qpoint.html">QPoint</a> & topLeft, const <a href="qpoint.html">QPoint</a> & bottomRight )
|
---|
157 | </h3>
|
---|
158 | Constructs a rectangle with <em>topLeft</em> as the top-left corner and
|
---|
159 | <em>bottomRight</em> as the bottom-right corner.
|
---|
160 |
|
---|
161 | <h3 class=fn><a name="QRect-3"></a>QRect::QRect ( const <a href="qpoint.html">QPoint</a> & topLeft, const <a href="qsize.html">QSize</a> & size )
|
---|
162 | </h3>
|
---|
163 | Constructs a rectangle with <em>topLeft</em> as the top-left corner and
|
---|
164 | <em>size</em> as the rectangle size.
|
---|
165 |
|
---|
166 | <h3 class=fn><a name="QRect-4"></a>QRect::QRect ( int left, int top, int width, int height )
|
---|
167 | </h3>
|
---|
168 |
|
---|
169 | <p> Constructs a rectangle with the <em>top</em>, <em>left</em> corner and <em>width</em> and <em>height</em>.
|
---|
170 | <p> Example (creates three identical rectangles):
|
---|
171 | <pre>
|
---|
172 | QRect r1( QPoint(100,200), QPoint(110,215) );
|
---|
173 | QRect r2( QPoint(100,200), QSize(11,16) );
|
---|
174 | QRect r3( 100, 200, 11, 16 );
|
---|
175 | </pre>
|
---|
176 |
|
---|
177 |
|
---|
178 | <h3 class=fn>void <a name="addCoords"></a>QRect::addCoords ( int xp1, int yp1, int xp2, int yp2 )
|
---|
179 | </h3>
|
---|
180 | Adds <em>xp1</em>, <em>yp1</em>, <em>xp2</em> and <em>yp2</em> respectively to the
|
---|
181 | existing coordinates of the rectangle.
|
---|
182 |
|
---|
183 | <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>.
|
---|
184 | <h3 class=fn>int <a name="bottom"></a>QRect::bottom () const
|
---|
185 | </h3>
|
---|
186 |
|
---|
187 | <p> Returns the bottom coordinate of the rectangle.
|
---|
188 | <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>().
|
---|
189 |
|
---|
190 | <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>.
|
---|
191 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="bottomLeft"></a>QRect::bottomLeft () const
|
---|
192 | </h3>
|
---|
193 |
|
---|
194 | <p> Returns the bottom-left position of the rectangle.
|
---|
195 | <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>().
|
---|
196 |
|
---|
197 | <p>Example: <a href="tictac-example.html#x32">tictac/tictac.cpp</a>.
|
---|
198 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="bottomRight"></a>QRect::bottomRight () const
|
---|
199 | </h3>
|
---|
200 |
|
---|
201 | <p> Returns the bottom-right position of the rectangle.
|
---|
202 | <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>().
|
---|
203 |
|
---|
204 | <p>Example: <a href="tictac-example.html#x33">tictac/tictac.cpp</a>.
|
---|
205 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="center"></a>QRect::center () const
|
---|
206 | </h3>
|
---|
207 |
|
---|
208 | <p> Returns the center point of the rectangle.
|
---|
209 | <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>().
|
---|
210 |
|
---|
211 | <p>Example: <a href="tooltip-example.html#x447">tooltip/tooltip.cpp</a>.
|
---|
212 | <h3 class=fn>bool <a name="contains"></a>QRect::contains ( const <a href="qpoint.html">QPoint</a> & p, bool proper = FALSE ) const
|
---|
213 | </h3>
|
---|
214 | Returns TRUE if the point <em>p</em> is inside or on the edge of the
|
---|
215 | rectangle; otherwise returns FALSE.
|
---|
216 | <p> If <em>proper</em> is TRUE, this function returns TRUE only if <em>p</em> is
|
---|
217 | inside (not on the edge).
|
---|
218 |
|
---|
219 | <p>Example: <a href="tutorial1-14.html#x2426">t14/cannon.cpp</a>.
|
---|
220 | <h3 class=fn>bool <a name="contains-2"></a>QRect::contains ( int x, int y ) const
|
---|
221 | </h3>
|
---|
222 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
223 | <p> Returns TRUE if the point <em>x</em>, <em>y</em> is inside this rectangle;
|
---|
224 | otherwise returns FALSE.
|
---|
225 |
|
---|
226 | <h3 class=fn>bool <a name="contains-3"></a>QRect::contains ( int x, int y, bool proper ) const
|
---|
227 | </h3>
|
---|
228 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
229 | <p> Returns TRUE if the point <em>x</em>, <em>y</em> is inside this rectangle;
|
---|
230 | otherwise returns FALSE.
|
---|
231 | <p> If <em>proper</em> is TRUE, this function returns TRUE only if the point
|
---|
232 | is entirely inside (not on the edge).
|
---|
233 |
|
---|
234 | <h3 class=fn>bool <a name="contains-4"></a>QRect::contains ( const <a href="qrect.html">QRect</a> & r, bool proper = FALSE ) const
|
---|
235 | </h3>
|
---|
236 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
237 | <p> Returns TRUE if the rectangle <em>r</em> is inside this rectangle;
|
---|
238 | otherwise returns FALSE.
|
---|
239 | <p> If <em>proper</em> is TRUE, this function returns TRUE only if <em>r</em> is
|
---|
240 | entirely inside (not on the edge).
|
---|
241 | <p> <p>See also <a href="#unite">unite</a>(), <a href="#intersect">intersect</a>(), and <a href="#intersects">intersects</a>().
|
---|
242 |
|
---|
243 | <h3 class=fn>void <a name="coords"></a>QRect::coords ( int * xp1, int * yp1, int * xp2, int * yp2 ) const
|
---|
244 | </h3>
|
---|
245 | Extracts the rectangle parameters as the top-left point <em>*xp1</em>,
|
---|
246 | <em>*yp1</em> and the bottom-right point <em>*xp2</em>, <em>*yp2</em>.
|
---|
247 | <p> <p>See also <a href="#setCoords">setCoords</a>() and <a href="#rect">rect</a>().
|
---|
248 |
|
---|
249 | <p>Examples: <a href="themes-example.html#x297">themes/metal.cpp</a> and <a href="themes-example.html#x237">themes/wood.cpp</a>.
|
---|
250 | <h3 class=fn>int <a name="height"></a>QRect::height () const
|
---|
251 | </h3>
|
---|
252 |
|
---|
253 | <p> Returns the height of the rectangle. The height includes both the
|
---|
254 | top and bottom edges, i.e. height = bottom - top + 1.
|
---|
255 | <p> <p>See also <a href="#width">width</a>(), <a href="#size">size</a>(), and <a href="#setHeight">setHeight</a>().
|
---|
256 |
|
---|
257 | <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>.
|
---|
258 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="intersect"></a>QRect::intersect ( const <a href="qrect.html">QRect</a> & r ) const
|
---|
259 | </h3>
|
---|
260 | Returns the intersection of this rectangle and rectangle <em>r</em>.
|
---|
261 | <tt>r.intersect(s)</tt> is equivalent to <tt>r&s</tt>.
|
---|
262 |
|
---|
263 | <h3 class=fn>bool <a name="intersects"></a>QRect::intersects ( const <a href="qrect.html">QRect</a> & r ) const
|
---|
264 | </h3>
|
---|
265 | Returns TRUE if this rectangle intersects with rectangle <em>r</em>
|
---|
266 | (there is at least one pixel that is within both rectangles);
|
---|
267 | otherwise returns FALSE.
|
---|
268 | <p> <p>See also <a href="#intersect">intersect</a>() and <a href="#contains">contains</a>().
|
---|
269 |
|
---|
270 | <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>.
|
---|
271 | <h3 class=fn>bool <a name="isEmpty"></a>QRect::isEmpty () const
|
---|
272 | </h3>
|
---|
273 |
|
---|
274 | <p> Returns TRUE if the rectangle is empty; otherwise returns FALSE.
|
---|
275 | <p> An empty rectangle has a <a href="#left">left</a>() > <a href="#right">right</a>() or <a href="#top">top</a>() > <a href="#bottom">bottom</a>().
|
---|
276 | <p> An empty rectangle is not valid. <tt>isEmpty() == !isValid()</tt>
|
---|
277 | <p> <p>See also <a href="#isNull">isNull</a>(), <a href="#isValid">isValid</a>(), and <a href="#normalize">normalize</a>().
|
---|
278 |
|
---|
279 | <h3 class=fn>bool <a name="isNull"></a>QRect::isNull () const
|
---|
280 | </h3>
|
---|
281 |
|
---|
282 | <p> Returns TRUE if the rectangle is a null rectangle; otherwise
|
---|
283 | returns FALSE.
|
---|
284 | <p> A null rectangle has both the width and the height set to 0, that
|
---|
285 | is <a href="#right">right</a>() == <a href="#left">left</a>() - 1 and <a href="#bottom">bottom</a>() == <a href="#top">top</a>() - 1.
|
---|
286 | <p> Note that if right() == left() and bottom() == top(), then the
|
---|
287 | rectangle has width 1 and height 1.
|
---|
288 | <p> A null rectangle is also empty.
|
---|
289 | <p> A null rectangle is not valid.
|
---|
290 | <p> <p>See also <a href="#isEmpty">isEmpty</a>() and <a href="#isValid">isValid</a>().
|
---|
291 |
|
---|
292 | <h3 class=fn>bool <a name="isValid"></a>QRect::isValid () const
|
---|
293 | </h3>
|
---|
294 |
|
---|
295 | <p> Returns TRUE if the rectangle is valid; otherwise returns FALSE.
|
---|
296 | <p> A valid rectangle has a <a href="#left">left</a>() <= <a href="#right">right</a>() and <a href="#top">top</a>() <= <a href="#bottom">bottom</a>().
|
---|
297 | <p> Note that non-trivial operations like intersections are not defined
|
---|
298 | for invalid rectangles.
|
---|
299 | <p> <tt>isValid() == !isEmpty()</tt>
|
---|
300 | <p> <p>See also <a href="#isNull">isNull</a>(), <a href="#isEmpty">isEmpty</a>(), and <a href="#normalize">normalize</a>().
|
---|
301 |
|
---|
302 | <p>Examples: <a href="themes-example.html#x299">themes/metal.cpp</a> and <a href="tooltip-example.html#x448">tooltip/tooltip.cpp</a>.
|
---|
303 | <h3 class=fn>int <a name="left"></a>QRect::left () const
|
---|
304 | </h3>
|
---|
305 |
|
---|
306 | <p> Returns the left coordinate of the rectangle. Identical to <a href="#x">x</a>().
|
---|
307 | <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>().
|
---|
308 |
|
---|
309 | <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>.
|
---|
310 | <h3 class=fn>void <a name="moveBottom"></a>QRect::moveBottom ( int pos )
|
---|
311 | </h3>
|
---|
312 | Sets the bottom position of the rectangle to <em>pos</em>, leaving the
|
---|
313 | size unchanged.
|
---|
314 | <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>().
|
---|
315 |
|
---|
316 | <h3 class=fn>void <a name="moveBottomLeft"></a>QRect::moveBottomLeft ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
317 | </h3>
|
---|
318 | Sets the bottom-left position of the rectangle to <em>p</em>, leaving
|
---|
319 | the size unchanged.
|
---|
320 | <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>().
|
---|
321 |
|
---|
322 | <p>Example: <a href="tutorial1-10.html#x2360">t10/cannon.cpp</a>.
|
---|
323 | <h3 class=fn>void <a name="moveBottomRight"></a>QRect::moveBottomRight ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
324 | </h3>
|
---|
325 | Sets the bottom-right position of the rectangle to <em>p</em>, leaving
|
---|
326 | the size unchanged.
|
---|
327 | <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>().
|
---|
328 |
|
---|
329 | <h3 class=fn>void <a name="moveBy"></a>QRect::moveBy ( int dx, int dy )
|
---|
330 | </h3>
|
---|
331 | Moves the rectangle <em>dx</em> along the x axis and <em>dy</em> along the y
|
---|
332 | axis, relative to the current position. Positive values move the
|
---|
333 | rectangle to the right and down.
|
---|
334 | <p> <p>See also <a href="#moveTopLeft">moveTopLeft</a>().
|
---|
335 |
|
---|
336 | <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>.
|
---|
337 | <h3 class=fn>void <a name="moveCenter"></a>QRect::moveCenter ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
338 | </h3>
|
---|
339 | Sets the center point of the rectangle to <em>p</em>, leaving the size
|
---|
340 | unchanged.
|
---|
341 | <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>().
|
---|
342 |
|
---|
343 | <p>Examples: <a href="tutorial1-11.html#x2371">t11/cannon.cpp</a> and <a href="tutorial1-12.html#x2394">t12/cannon.cpp</a>.
|
---|
344 | <h3 class=fn>void <a name="moveLeft"></a>QRect::moveLeft ( int pos )
|
---|
345 | </h3>
|
---|
346 | Sets the left position of the rectangle to <em>pos</em>, leaving the
|
---|
347 | size unchanged.
|
---|
348 | <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>().
|
---|
349 |
|
---|
350 | <h3 class=fn>void <a name="moveRight"></a>QRect::moveRight ( int pos )
|
---|
351 | </h3>
|
---|
352 | Sets the right position of the rectangle to <em>pos</em>, leaving the
|
---|
353 | size unchanged.
|
---|
354 | <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>().
|
---|
355 |
|
---|
356 | <h3 class=fn>void <a name="moveTop"></a>QRect::moveTop ( int pos )
|
---|
357 | </h3>
|
---|
358 | Sets the top position of the rectangle to <em>pos</em>, leaving the
|
---|
359 | size unchanged.
|
---|
360 | <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>().
|
---|
361 |
|
---|
362 | <h3 class=fn>void <a name="moveTopLeft"></a>QRect::moveTopLeft ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
363 | </h3>
|
---|
364 | Sets the top-left position of the rectangle to <em>p</em>, leaving the
|
---|
365 | size unchanged.
|
---|
366 | <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>().
|
---|
367 |
|
---|
368 | <p>Examples: <a href="helpsystem-example.html#x2681">helpsystem/tooltip.cpp</a> and <a href="xform-example.html#x1254">xform/xform.cpp</a>.
|
---|
369 | <h3 class=fn>void <a name="moveTopRight"></a>QRect::moveTopRight ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
370 | </h3>
|
---|
371 | Sets the top-right position of the rectangle to <em>p</em>, leaving the
|
---|
372 | size unchanged.
|
---|
373 | <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>().
|
---|
374 |
|
---|
375 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="normalize"></a>QRect::normalize () const
|
---|
376 | </h3>
|
---|
377 | Returns a normalized rectangle, i.e. a rectangle that has a
|
---|
378 | non-negative width and height.
|
---|
379 | <p> It swaps left and right if <a href="#left">left</a>() > <a href="#right">right</a>(), and swaps top and
|
---|
380 | bottom if <a href="#top">top</a>() > <a href="#bottom">bottom</a>().
|
---|
381 | <p> <p>See also <a href="#isValid">isValid</a>().
|
---|
382 |
|
---|
383 | <p>Example: <a href="scribble-example.html#x928">scribble/scribble.cpp</a>.
|
---|
384 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="operator-and"></a>QRect::operator& ( const <a href="qrect.html">QRect</a> & r ) const
|
---|
385 | </h3>
|
---|
386 | Returns the intersection of this rectangle and rectangle <em>r</em>.
|
---|
387 | <p> Returns an empty rectangle if there is no intersection.
|
---|
388 | <p> <p>See also <a href="#operator-and-eq">operator&=</a>(), <a href="#operator|">operator|</a>(), <a href="#isEmpty">isEmpty</a>(), <a href="#intersects">intersects</a>(), and <a href="#contains">contains</a>().
|
---|
389 |
|
---|
390 | <h3 class=fn><a href="qrect.html">QRect</a> & <a name="operator-and-eq"></a>QRect::operator&= ( const <a href="qrect.html">QRect</a> & r )
|
---|
391 | </h3>
|
---|
392 | Intersects this rectangle with rectangle <em>r</em>.
|
---|
393 |
|
---|
394 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="operator|"></a>QRect::operator| ( const <a href="qrect.html">QRect</a> & r ) const
|
---|
395 | </h3>
|
---|
396 | Returns the bounding rectangle of this rectangle and rectangle <em>r</em>.
|
---|
397 | <p> The bounding rectangle of a nonempty rectangle and an empty or
|
---|
398 | invalid rectangle is defined to be the nonempty rectangle.
|
---|
399 | <p> <p>See also <a href="#operator|-eq">operator|=</a>(), <a href="#operator-and">operator&</a>(), <a href="#intersects">intersects</a>(), and <a href="#contains">contains</a>().
|
---|
400 |
|
---|
401 | <h3 class=fn><a href="qrect.html">QRect</a> & <a name="operator|-eq"></a>QRect::operator|= ( const <a href="qrect.html">QRect</a> & r )
|
---|
402 | </h3>
|
---|
403 | Unites this rectangle with rectangle <em>r</em>.
|
---|
404 |
|
---|
405 | <h3 class=fn>QCOORD & <a name="rBottom"></a>QRect::rBottom ()
|
---|
406 | </h3>
|
---|
407 |
|
---|
408 | <p> Returns a reference to the bottom coordinate of the rectangle.
|
---|
409 | <p> <p>See also <a href="#rLeft">rLeft</a>(), <a href="#rTop">rTop</a>(), and <a href="#rRight">rRight</a>().
|
---|
410 |
|
---|
411 | <h3 class=fn>QCOORD & <a name="rLeft"></a>QRect::rLeft ()
|
---|
412 | </h3>
|
---|
413 |
|
---|
414 | <p> Returns a reference to the left coordinate of the rectangle.
|
---|
415 | <p> <p>See also <a href="#rTop">rTop</a>(), <a href="#rRight">rRight</a>(), and <a href="#rBottom">rBottom</a>().
|
---|
416 |
|
---|
417 | <h3 class=fn>QCOORD & <a name="rRight"></a>QRect::rRight ()
|
---|
418 | </h3>
|
---|
419 |
|
---|
420 | <p> Returns a reference to the right coordinate of the rectangle.
|
---|
421 | <p> <p>See also <a href="#rLeft">rLeft</a>(), <a href="#rTop">rTop</a>(), and <a href="#rBottom">rBottom</a>().
|
---|
422 |
|
---|
423 | <h3 class=fn>QCOORD & <a name="rTop"></a>QRect::rTop ()
|
---|
424 | </h3>
|
---|
425 |
|
---|
426 | <p> Returns a reference to the top coordinate of the rectangle.
|
---|
427 | <p> <p>See also <a href="#rLeft">rLeft</a>(), <a href="#rRight">rRight</a>(), and <a href="#rBottom">rBottom</a>().
|
---|
428 |
|
---|
429 | <h3 class=fn>void <a name="rect"></a>QRect::rect ( int * x, int * y, int * w, int * h ) const
|
---|
430 | </h3>
|
---|
431 | Extracts the rectangle parameters as the position <em>*x</em>, <em>*y</em> and
|
---|
432 | width <em>*w</em> and height <em>*h</em>.
|
---|
433 | <p> <p>See also <a href="#setRect">setRect</a>() and <a href="#coords">coords</a>().
|
---|
434 |
|
---|
435 | <p>Examples: <a href="themes-example.html#x300">themes/metal.cpp</a> and <a href="themes-example.html#x240">themes/wood.cpp</a>.
|
---|
436 | <h3 class=fn>int <a name="right"></a>QRect::right () const
|
---|
437 | </h3>
|
---|
438 |
|
---|
439 | <p> Returns the right coordinate of the rectangle.
|
---|
440 | <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>().
|
---|
441 |
|
---|
442 | <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>.
|
---|
443 | <h3 class=fn>void <a name="setBottom"></a>QRect::setBottom ( int pos )
|
---|
444 | </h3>
|
---|
445 |
|
---|
446 | <p> Sets the bottom edge of the rectangle to <em>pos</em>. May change the
|
---|
447 | height, but will never change the top edge of the rectangle.
|
---|
448 | <p> <p>See also <a href="#bottom">bottom</a>(), <a href="#setTop">setTop</a>(), and <a href="#setHeight">setHeight</a>().
|
---|
449 |
|
---|
450 | <p>Example: <a href="scribble-example.html#x930">scribble/scribble.cpp</a>.
|
---|
451 | <h3 class=fn>void <a name="setBottomLeft"></a>QRect::setBottomLeft ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
452 | </h3>
|
---|
453 | Set the bottom-left corner of the rectangle to <em>p</em>. May change
|
---|
454 | the size, but will the never change the top-right corner of
|
---|
455 | the rectangle.
|
---|
456 | <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>().
|
---|
457 |
|
---|
458 | <h3 class=fn>void <a name="setBottomRight"></a>QRect::setBottomRight ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
459 | </h3>
|
---|
460 | Set the bottom-right corner of the rectangle to <em>p</em>. May change
|
---|
461 | the size, but will the never change the top-left corner of
|
---|
462 | the rectangle.
|
---|
463 | <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>().
|
---|
464 |
|
---|
465 | <h3 class=fn>void <a name="setCoords"></a>QRect::setCoords ( int xp1, int yp1, int xp2, int yp2 )
|
---|
466 | </h3>
|
---|
467 | 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>.
|
---|
468 | <p> <p>See also <a href="#coords">coords</a>() and <a href="#setRect">setRect</a>().
|
---|
469 |
|
---|
470 | <h3 class=fn>void <a name="setHeight"></a>QRect::setHeight ( int h )
|
---|
471 | </h3>
|
---|
472 | Sets the height of the rectangle to <em>h</em>. The top edge is not
|
---|
473 | moved, but the bottom edge may be moved.
|
---|
474 | <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>().
|
---|
475 |
|
---|
476 | <p>Example: <a href="desktop-example.html#x1752">desktop/desktop.cpp</a>.
|
---|
477 | <h3 class=fn>void <a name="setLeft"></a>QRect::setLeft ( int pos )
|
---|
478 | </h3>
|
---|
479 |
|
---|
480 | <p> Sets the left edge of the rectangle to <em>pos</em>. May change the
|
---|
481 | width, but will never change the right edge of the rectangle.
|
---|
482 | <p> Identical to <a href="#setX">setX</a>().
|
---|
483 | <p> <p>See also <a href="#left">left</a>(), <a href="#setTop">setTop</a>(), and <a href="#setWidth">setWidth</a>().
|
---|
484 |
|
---|
485 | <p>Example: <a href="scribble-example.html#x931">scribble/scribble.cpp</a>.
|
---|
486 | <h3 class=fn>void <a name="setRect"></a>QRect::setRect ( int x, int y, int w, int h )
|
---|
487 | </h3>
|
---|
488 | Sets the coordinates of the rectangle's top-left corner to <em>(x, y)</em>, and its size to <em>(w, h)</em>.
|
---|
489 | <p> <p>See also <a href="#rect">rect</a>() and <a href="#setCoords">setCoords</a>().
|
---|
490 |
|
---|
491 | <p>Example: <a href="themes-example.html#x242">themes/wood.cpp</a>.
|
---|
492 | <h3 class=fn>void <a name="setRight"></a>QRect::setRight ( int pos )
|
---|
493 | </h3>
|
---|
494 |
|
---|
495 | <p> Sets the right edge of the rectangle to <em>pos</em>. May change the
|
---|
496 | width, but will never change the left edge of the rectangle.
|
---|
497 | <p> <p>See also <a href="#right">right</a>(), <a href="#setLeft">setLeft</a>(), and <a href="#setWidth">setWidth</a>().
|
---|
498 |
|
---|
499 | <p>Example: <a href="scribble-example.html#x932">scribble/scribble.cpp</a>.
|
---|
500 | <h3 class=fn>void <a name="setSize"></a>QRect::setSize ( const <a href="qsize.html">QSize</a> & s )
|
---|
501 | </h3>
|
---|
502 | Sets the size of the rectangle to <em>s</em>. The top-left corner is not
|
---|
503 | moved.
|
---|
504 | <p> <p>See also <a href="#size">size</a>(), <a href="#setWidth">setWidth</a>(), and <a href="#setHeight">setHeight</a>().
|
---|
505 |
|
---|
506 | <p>Example: <a href="xform-example.html#x1255">xform/xform.cpp</a>.
|
---|
507 | <h3 class=fn>void <a name="setTop"></a>QRect::setTop ( int pos )
|
---|
508 | </h3>
|
---|
509 |
|
---|
510 | <p> Sets the top edge of the rectangle to <em>pos</em>. May change the
|
---|
511 | height, but will never change the bottom edge of the rectangle.
|
---|
512 | <p> Identical to <a href="#setY">setY</a>().
|
---|
513 | <p> <p>See also <a href="#top">top</a>(), <a href="#setBottom">setBottom</a>(), and <a href="#setHeight">setHeight</a>().
|
---|
514 |
|
---|
515 | <p>Example: <a href="scribble-example.html#x933">scribble/scribble.cpp</a>.
|
---|
516 | <h3 class=fn>void <a name="setTopLeft"></a>QRect::setTopLeft ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
517 | </h3>
|
---|
518 | Set the top-left corner of the rectangle to <em>p</em>. May change
|
---|
519 | the size, but will the never change the bottom-right corner of
|
---|
520 | the rectangle.
|
---|
521 | <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>().
|
---|
522 |
|
---|
523 | <h3 class=fn>void <a name="setTopRight"></a>QRect::setTopRight ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
524 | </h3>
|
---|
525 | Set the top-right corner of the rectangle to <em>p</em>. May change
|
---|
526 | the size, but will the never change the bottom-left corner of
|
---|
527 | the rectangle.
|
---|
528 | <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>().
|
---|
529 |
|
---|
530 | <h3 class=fn>void <a name="setWidth"></a>QRect::setWidth ( int w )
|
---|
531 | </h3>
|
---|
532 | Sets the width of the rectangle to <em>w</em>. The right edge is
|
---|
533 | changed, but not the left edge.
|
---|
534 | <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>().
|
---|
535 |
|
---|
536 | <p>Example: <a href="desktop-example.html#x1753">desktop/desktop.cpp</a>.
|
---|
537 | <h3 class=fn>void <a name="setX"></a>QRect::setX ( int x )
|
---|
538 | </h3>
|
---|
539 |
|
---|
540 | <p> Sets the x position of the rectangle (its left end) to <em>x</em>. May
|
---|
541 | change the width, but will never change the right edge of the
|
---|
542 | rectangle.
|
---|
543 | <p> Identical to <a href="#setLeft">setLeft</a>().
|
---|
544 | <p> <p>See also <a href="#x">x</a>() and <a href="#setY">setY</a>().
|
---|
545 |
|
---|
546 | <h3 class=fn>void <a name="setY"></a>QRect::setY ( int y )
|
---|
547 | </h3>
|
---|
548 |
|
---|
549 | <p> Sets the y position of the rectangle (its top) to <em>y</em>. May change
|
---|
550 | the height, but will never change the bottom edge of the
|
---|
551 | rectangle.
|
---|
552 | <p> Identical to <a href="#setTop">setTop</a>().
|
---|
553 | <p> <p>See also <a href="#y">y</a>() and <a href="#setX">setX</a>().
|
---|
554 |
|
---|
555 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="size"></a>QRect::size () const
|
---|
556 | </h3>
|
---|
557 |
|
---|
558 | <p> Returns the size of the rectangle.
|
---|
559 | <p> <p>See also <a href="#width">width</a>() and <a href="#height">height</a>().
|
---|
560 |
|
---|
561 | <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>.
|
---|
562 | <h3 class=fn>int <a name="top"></a>QRect::top () const
|
---|
563 | </h3>
|
---|
564 |
|
---|
565 | <p> Returns the top coordinate of the rectangle. Identical to <a href="#y">y</a>().
|
---|
566 | <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>().
|
---|
567 |
|
---|
568 | <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>.
|
---|
569 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="topLeft"></a>QRect::topLeft () const
|
---|
570 | </h3>
|
---|
571 |
|
---|
572 | <p> Returns the top-left position of the rectangle.
|
---|
573 | <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>().
|
---|
574 |
|
---|
575 | <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>.
|
---|
576 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="topRight"></a>QRect::topRight () const
|
---|
577 | </h3>
|
---|
578 |
|
---|
579 | <p> Returns the top-right position of the rectangle.
|
---|
580 | <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>().
|
---|
581 |
|
---|
582 | <p>Example: <a href="tictac-example.html#x38">tictac/tictac.cpp</a>.
|
---|
583 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="unite"></a>QRect::unite ( const <a href="qrect.html">QRect</a> & r ) const
|
---|
584 | </h3>
|
---|
585 | Returns the bounding rectangle of this rectangle and rectangle <em>r</em>. <tt>r.unite(s)</tt> is equivalent to <tt>r|s</tt>.
|
---|
586 |
|
---|
587 | <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>.
|
---|
588 | <h3 class=fn>int <a name="width"></a>QRect::width () const
|
---|
589 | </h3>
|
---|
590 |
|
---|
591 | <p> Returns the width of the rectangle. The width includes both the
|
---|
592 | left and right edges, i.e. width = right - left + 1.
|
---|
593 | <p> <p>See also <a href="#height">height</a>(), <a href="#size">size</a>(), and <a href="#setHeight">setHeight</a>().
|
---|
594 |
|
---|
595 | <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>.
|
---|
596 | <h3 class=fn>int <a name="x"></a>QRect::x () const
|
---|
597 | </h3>
|
---|
598 |
|
---|
599 | <p> Returns the left coordinate of the rectangle. Identical to <a href="#left">left</a>().
|
---|
600 | <p> <p>See also <a href="#left">left</a>(), <a href="#y">y</a>(), and <a href="#setX">setX</a>().
|
---|
601 |
|
---|
602 | <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>.
|
---|
603 | <h3 class=fn>int <a name="y"></a>QRect::y () const
|
---|
604 | </h3>
|
---|
605 |
|
---|
606 | <p> Returns the top coordinate of the rectangle. Identical to <a href="#top">top</a>().
|
---|
607 | <p> <p>See also <a href="#top">top</a>(), <a href="#x">x</a>(), and <a href="#setY">setY</a>().
|
---|
608 |
|
---|
609 | <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>.
|
---|
610 | <hr><h2>Related Functions</h2>
|
---|
611 | <h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const <a href="qrect.html">QRect</a> & r1, const <a href="qrect.html">QRect</a> & r2 )
|
---|
612 | </h3>
|
---|
613 |
|
---|
614 | <p> Returns TRUE if <em>r1</em> and <em>r2</em> are different; otherwise returns FALSE.
|
---|
615 |
|
---|
616 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qrect.html">QRect</a> & r )
|
---|
617 | </h3>
|
---|
618 |
|
---|
619 | <p> Writes the QRect, <em>r</em>, to the stream <em>s</em>, and returns a
|
---|
620 | reference to the stream.
|
---|
621 | <p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
|
---|
622 |
|
---|
623 | <h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const <a href="qrect.html">QRect</a> & r1, const <a href="qrect.html">QRect</a> & r2 )
|
---|
624 | </h3>
|
---|
625 |
|
---|
626 | <p> Returns TRUE if <em>r1</em> and <em>r2</em> are equal; otherwise returns FALSE.
|
---|
627 |
|
---|
628 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qrect.html">QRect</a> & r )
|
---|
629 | </h3>
|
---|
630 |
|
---|
631 | <p> Reads a QRect from the stream <em>s</em> into rect <em>r</em> and returns a
|
---|
632 | reference to the stream.
|
---|
633 | <p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
|
---|
634 |
|
---|
635 | <!-- eof -->
|
---|
636 | <hr><p>
|
---|
637 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
638 | Copyright © 1995-2007
|
---|
639 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
640 | <table width=100% cellspacing=0 border=0><tr>
|
---|
641 | <td>Copyright © 2007
|
---|
642 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
643 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
644 | </table></div></address></body>
|
---|
645 | </html>
|
---|