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
|
<!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/tqsize.cpp:42 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQSize 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 Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped 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>TQSize Class Reference</h1>
<p>The TQSize class defines the size of a two-dimensional object.
<a href="#details">More...</a>
<p><tt>#include <<a href="tqsize-h.html">tqsize.h</a>></tt>
<p><a href="tqsize-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#ScaleMode-enum"><b>ScaleMode</b></a> { ScaleFree, ScaleMin, ScaleMax }</li>
<li class=fn><a href="#TQSize"><b>TQSize</b></a> ()</li>
<li class=fn><a href="#TQSize-2"><b>TQSize</b></a> ( int w, int h )</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>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 w )</li>
<li class=fn>void <a href="#setHeight"><b>setHeight</b></a> ( int h )</li>
<li class=fn>void <a href="#transpose"><b>transpose</b></a> ()</li>
<li class=fn>void <a href="#scale"><b>scale</b></a> ( int w, int h, ScaleMode mode )</li>
<li class=fn>void <a href="#scale-2"><b>scale</b></a> ( const TQSize & s, ScaleMode mode )</li>
<li class=fn>TQSize <a href="#expandedTo"><b>expandedTo</b></a> ( const TQSize & otherSize ) const</li>
<li class=fn>TQSize <a href="#boundedTo"><b>boundedTo</b></a> ( const TQSize & otherSize ) const</li>
<li class=fn>TQCOORD & <a href="#rwidth"><b>rwidth</b></a> ()</li>
<li class=fn>TQCOORD & <a href="#rheight"><b>rheight</b></a> ()</li>
<li class=fn>TQSize & <a href="#operator+-eq"><b>operator+=</b></a> ( const TQSize & s )</li>
<li class=fn>TQSize & <a href="#operator--eq"><b>operator-=</b></a> ( const TQSize & s )</li>
<li class=fn>TQSize & <a href="#operator*-eq"><b>operator*=</b></a> ( int c )</li>
<li class=fn>TQSize & <a href="#operator*-eq-2"><b>operator*=</b></a> ( double c )</li>
<li class=fn>TQSize & <a href="#operator/-eq"><b>operator/=</b></a> ( int c )</li>
<li class=fn>TQSize & <a href="#operator/-eq-2"><b>operator/=</b></a> ( double c )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQSize & s1, const TQSize & s2 )</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQSize & s1, const TQSize & s2 )</li>
<li class=fn>const TQSize <a href="#operator+"><b>operator+</b></a> ( const TQSize & s1, const TQSize & s2 )</li>
<li class=fn>const TQSize <a href="#operator-"><b>operator-</b></a> ( const TQSize & s1, const TQSize & s2 )</li>
<li class=fn>const TQSize <a href="#operator*"><b>operator*</b></a> ( const TQSize & s, int c )</li>
<li class=fn>const TQSize <a href="#operator*-2"><b>operator*</b></a> ( int c, const TQSize & s )</li>
<li class=fn>const TQSize <a href="#operator*-3"><b>operator*</b></a> ( const TQSize & s, double c )</li>
<li class=fn>const TQSize <a href="#operator*-4"><b>operator*</b></a> ( double c, const TQSize & s )</li>
<li class=fn>const TQSize <a href="#operator/"><b>operator/</b></a> ( const TQSize & s, int c )</li>
<li class=fn>const TQSize <a href="#operator/-2"><b>operator/</b></a> ( const TQSize & s, double c )</li>
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQSize & sz )</li>
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQSize & sz )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQSize class defines the size of a two-dimensional object.
<p>
<p> A size is specified by a width and a height.
<p> The coordinate type is TQCOORD (defined in <tt><tqwindowdefs.h></tt> as <tt>int</tt>).
The minimum value of TQCOORD is TQCOORD_MIN (-2147483648) and the maximum
value is TQCOORD_MAX (2147483647).
<p> The size can be set in the constructor and changed with <a href="#setWidth">setWidth</a>()
and <a href="#setHeight">setHeight</a>(), or using <a href="#operator+-eq">operator+=</a>(), <a href="#operator--eq">operator-=</a>(), <a href="#operator*-eq">operator*=</a>()
and <a href="#operator/-eq">operator/=</a>(), etc. You can swap the width and height with
<a href="#transpose">transpose</a>(). You can get a size which holds the maximum height and
width of two sizes using <a href="#expandedTo">expandedTo</a>(), and the minimum height and
width of two sizes using <a href="#boundedTo">boundedTo</a>().
<p> <p>See also <a href="tqpoint.html">TQPoint</a>, <a href="tqrect.html">TQRect</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ScaleMode-enum"></a>TQSize::ScaleMode</h3>
<p> This enum type defines the different ways of scaling a size.
<p> <center><img src="scaling.png"></center>
<ul>
<li><tt>TQSize::ScaleFree</tt> - The size is scaled freely. The ratio is not preserved.
<li><tt>TQSize::ScaleMin</tt> - The size is scaled to a rectangle as large as possible
inside a given rectangle, preserving the aspect ratio.
<li><tt>TQSize::ScaleMax</tt> - The size is scaled to a rectangle as small as possible
outside a given rectangle, preserving the aspect ratio.
</ul><p> <p>See also <a href="#scale">TQSize::scale</a>(), <a href="tqimage.html#scale">TQImage::scale</a>(), and <a href="tqimage.html#smoothScale">TQImage::smoothScale</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQSize"></a>TQSize::TQSize ()
</h3>
Constructs a size with invalid (negative) width and height.
<h3 class=fn><a name="TQSize-2"></a>TQSize::TQSize ( int w, int h )
</h3>
Constructs a size with width <em>w</em> and height <em>h</em>.
<h3 class=fn><a href="tqsize.html">TQSize</a> <a name="boundedTo"></a>TQSize::boundedTo ( const <a href="tqsize.html">TQSize</a> & otherSize ) const
</h3>
<p> Returns a size with the minimum width and height of this size and
<em>otherSize</em>.
<h3 class=fn><a href="tqsize.html">TQSize</a> <a name="expandedTo"></a>TQSize::expandedTo ( const <a href="tqsize.html">TQSize</a> & otherSize ) const
</h3>
<p> Returns a size with the maximum width and height of this size and
<em>otherSize</em>.
<p>Examples: <a href="customlayout-example.html#x1528">customlayout/card.cpp</a> and <a href="customlayout-example.html#x1485">customlayout/flow.cpp</a>.
<h3 class=fn>int <a name="height"></a>TQSize::height () const
</h3>
Returns the height.
<p>See also <a href="#width">width</a>().
<p>Examples: <a href="movies-example.html#x520">movies/main.cpp</a>, <a href="qfd-example.html#x2007">qfd/fontdisplayer.cpp</a>, and <a href="qfd-example.html#x2016">qfd/qfd.cpp</a>.
<h3 class=fn>bool <a name="isEmpty"></a>TQSize::isEmpty () const
</h3>
Returns TRUE if the width is less than or equal to 0, or the height is
less than or equal to 0; otherwise returns FALSE.
<h3 class=fn>bool <a name="isNull"></a>TQSize::isNull () const
</h3>
Returns TRUE if the width is 0 and the height is 0; otherwise
returns FALSE.
<h3 class=fn>bool <a name="isValid"></a>TQSize::isValid () const
</h3>
Returns TRUE if the width is equal to or greater than 0 and the height is
equal to or greater than 0; otherwise returns FALSE.
<h3 class=fn><a href="tqsize.html">TQSize</a> & <a name="operator*-eq"></a>TQSize::operator*= ( int c )
</h3>
Multiplies both the width and height by <em>c</em> and returns a reference to
the size.
<h3 class=fn><a href="tqsize.html">TQSize</a> & <a name="operator*-eq-2"></a>TQSize::operator*= ( double c )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Multiplies both the width and height by <em>c</em> and returns a reference to
the size.
<p> Note that the result is truncated.
<h3 class=fn><a href="tqsize.html">TQSize</a> & <a name="operator+-eq"></a>TQSize::operator+= ( const <a href="tqsize.html">TQSize</a> & s )
</h3>
<p> Adds <em>s</em> to the size and returns a reference to this size.
<p> Example:
<pre>
TQSize s( 3, 7 );
TQSize r( -1, 4 );
s += r; // s becomes (2,11)
</pre>
<h3 class=fn><a href="tqsize.html">TQSize</a> & <a name="operator--eq"></a>TQSize::operator-= ( const <a href="tqsize.html">TQSize</a> & s )
</h3>
<p> Subtracts <em>s</em> from the size and returns a reference to this size.
<p> Example:
<pre>
TQSize s( 3, 7 );
TQSize r( -1, 4 );
s -= r; // s becomes (4,3)
</pre>
<h3 class=fn><a href="tqsize.html">TQSize</a> & <a name="operator/-eq"></a>TQSize::operator/= ( int c )
</h3>
Divides both the width and height by <em>c</em> and returns a reference to the
size.
<h3 class=fn><a href="tqsize.html">TQSize</a> & <a name="operator/-eq-2"></a>TQSize::operator/= ( double c )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Divides both the width and height by <em>c</em> and returns a reference to the
size.
<p> Note that the result is truncated.
<h3 class=fn>TQCOORD & <a name="rheight"></a>TQSize::rheight ()
</h3>
Returns a reference to the height.
<p> Using a reference makes it possible to directly manipulate the height.
<p> Example:
<pre>
TQSize s( 100, 10 );
s.<a href="#rheight">rheight</a>() += 5; // s becomes (100,15)
</pre>
<p> <p>See also <a href="#rwidth">rwidth</a>().
<h3 class=fn>TQCOORD & <a name="rwidth"></a>TQSize::rwidth ()
</h3>
Returns a reference to the width.
<p> Using a reference makes it possible to directly manipulate the width.
<p> Example:
<pre>
TQSize s( 100, 10 );
s.<a href="#rwidth">rwidth</a>() += 20; // s becomes (120,10)
</pre>
<p> <p>See also <a href="#rheight">rheight</a>().
<h3 class=fn>void <a name="scale"></a>TQSize::scale ( int w, int h, <a href="tqsize.html#ScaleMode-enum">ScaleMode</a> mode )
</h3>
Scales the size to a rectangle of width <em>w</em> and height <em>h</em> according
to the ScaleMode <em>mode</em>.
<p> <ul>
<li> If <em>mode</em> is <a href="#ScaleMode-enum">ScaleFree</a>, the size is set to (<em>w</em>, <em>h</em>).
<li> If <em>mode</em> is <a href="#ScaleMode-enum">ScaleMin</a>, the current size is scaled to a rectangle
as large as possible inside (<em>w</em>, <em>h</em>), preserving the aspect ratio.
<li> If <em>mode</em> is <a href="#ScaleMode-enum">ScaleMax</a>, the current size is scaled to a rectangle
as small as possible outside (<em>w</em>, <em>h</em>), preserving the aspect ratio.
</ul>
<p> Example:
<pre>
TQSize t1( 10, 12 );
t1.<a href="#scale">scale</a>( 60, 60, TQSize::<a href="#ScaleMode-enum">ScaleFree</a> );
// t1 is (60, 60)
TQSize t2( 10, 12 );
t2.<a href="#scale">scale</a>( 60, 60, TQSize::<a href="#ScaleMode-enum">ScaleMin</a> );
// t2 is (50, 60)
TQSize t3( 10, 12 );
t3.<a href="#scale">scale</a>( 60, 60, TQSize::<a href="#ScaleMode-enum">ScaleMax</a> );
// t3 is (60, 72)
</pre>
<h3 class=fn>void <a name="scale-2"></a>TQSize::scale ( const <a href="tqsize.html">TQSize</a> & s, <a href="tqsize.html#ScaleMode-enum">ScaleMode</a> mode )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Equivalent to <a href="#scale">scale</a>(<em>s</em>.<a href="#width">width</a>(), <em>s</em>.<a href="#height">height</a>(), <em>mode</em>).
<h3 class=fn>void <a name="setHeight"></a>TQSize::setHeight ( int h )
</h3>
Sets the height to <em>h</em>.
<p>See also <a href="#height">height</a>() and <a href="#setWidth">setWidth</a>().
<h3 class=fn>void <a name="setWidth"></a>TQSize::setWidth ( int w )
</h3>
Sets the width to <em>w</em>.
<p>See also <a href="#width">width</a>() and <a href="#setHeight">setHeight</a>().
<h3 class=fn>void <a name="transpose"></a>TQSize::transpose ()
</h3>
Swaps the values of width and height.
<h3 class=fn>int <a name="width"></a>TQSize::width () const
</h3>
Returns the width.
<p>See also <a href="#height">height</a>().
<p>Examples: <a href="movies-example.html#x521">movies/main.cpp</a>, <a href="qfd-example.html#x2008">qfd/fontdisplayer.cpp</a>, and <a href="qfd-example.html#x2017">qfd/qfd.cpp</a>.
<hr><h2>Related Functions</h2>
<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const <a href="tqsize.html">TQSize</a> & s1, const <a href="tqsize.html">TQSize</a> & s2 )
</h3>
Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator*"></a>operator* ( const <a href="tqsize.html">TQSize</a> & s, int c )
</h3>
Multiplies <em>s</em> by <em>c</em> and returns the result.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator*-2"></a>operator* ( int c, const <a href="tqsize.html">TQSize</a> & s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
Multiplies <em>s</em> by <em>c</em> and returns the result.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator*-3"></a>operator* ( const <a href="tqsize.html">TQSize</a> & s, double c )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
Multiplies <em>s</em> by <em>c</em> and returns the result.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator*-4"></a>operator* ( double c, const <a href="tqsize.html">TQSize</a> & s )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p>
Multiplies <em>s</em> by <em>c</em> and returns the result.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator+"></a>operator+ ( const <a href="tqsize.html">TQSize</a> & s1, const <a href="tqsize.html">TQSize</a> & s2 )
</h3>
Returns the sum of <em>s1</em> and <em>s2</em>; each component is added separately.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator-"></a>operator- ( const <a href="tqsize.html">TQSize</a> & s1, const <a href="tqsize.html">TQSize</a> & s2 )
</h3>
Returns <em>s2</em> subtracted from <em>s1</em>; each component is
subtracted separately.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator/"></a>operator/ ( const <a href="tqsize.html">TQSize</a> & s, int c )
</h3>
Divides <em>s</em> by <em>c</em> and returns the result.
<h3 class=fn>const <a href="tqsize.html">TQSize</a> <a name="operator/-2"></a>operator/ ( const <a href="tqsize.html">TQSize</a> & s, double c )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Divides <em>s</em> by <em>c</em> and returns the result.
<p> Note that the result is truncated.
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="tqdatastream.html">TQDataStream</a> & s, const <a href="tqsize.html">TQSize</a> & sz )
</h3>
Writes the size <em>sz</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 TQDataStream operators</a>.
<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const <a href="tqsize.html">TQSize</a> & s1, const <a href="tqsize.html">TQSize</a> & s2 )
</h3>
Returns TRUE if <em>s1</em> and <em>s2</em> are equal; otherwise returns FALSE.
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="tqdatastream.html">TQDataStream</a> & s, <a href="tqsize.html">TQSize</a> & sz )
</h3>
Reads the size from the stream <em>s</em> into size <em>sz</em> and returns a
reference to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 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 © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|