Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1755

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qsize.cpp:42 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QSize Class</title>
<style type="text/css"><!--
h3.fn,span.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>QSize Class Reference</h1>

<p>The QSize class defines the size of a two-dimensional object.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qsize-h.html">qsize.h</a>&gt;</tt>
<p><a href="qsize-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QSize"><b>QSize</b></a> ()</div></li>
<li><div class=fn><a href="#QSize-2"><b>QSize</b></a> ( int&nbsp;w, int&nbsp;h )</div></li>
<li><div class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isEmpty"><b>isEmpty</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</div></li>
<li><div class=fn>int <a href="#width"><b>width</b></a> () const</div></li>
<li><div class=fn>int <a href="#height"><b>height</b></a> () const</div></li>
<li><div class=fn>void <a href="#setWidth"><b>setWidth</b></a> ( int&nbsp;w )</div></li>
<li><div class=fn>void <a href="#setHeight"><b>setHeight</b></a> ( int&nbsp;h )</div></li>
<li><div class=fn>void <a href="#transpose"><b>transpose</b></a> ()</div></li>
<li><div class=fn>QSize <a href="#expandedTo"><b>expandedTo</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;otherSize ) const</div></li>
<li><div class=fn>QSize <a href="#boundedTo"><b>boundedTo</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;otherSize ) const</div></li>
<li><div class=fn>QCOORD &amp; <a href="#rwidth"><b>rwidth</b></a> ()</div></li>
<li><div class=fn>QCOORD &amp; <a href="#rheight"><b>rheight</b></a> ()</div></li>
<li><div class=fn>QSize &amp; <a href="#operator+-eq"><b>operator+=</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s )</div></li>
<li><div class=fn>QSize &amp; <a href="#operator--eq"><b>operator-=</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s )</div></li>
<li><div class=fn>QSize &amp; <a href="#operator*-eq"><b>operator*=</b></a> ( int&nbsp;c )</div></li>
<li><div class=fn>QSize &amp; <a href="#operator*-eq-2"><b>operator*=</b></a> ( double&nbsp;c )</div></li>
<li><div class=fn>QSize &amp; <a href="#operator/-eq"><b>operator/=</b></a> ( int&nbsp;c )</div></li>
<li><div class=fn>QSize &amp; <a href="#operator/-eq-2"><b>operator/=</b></a> ( double&nbsp;c )</div></li>
</ul>
<h2>Related Functions</h2>
<ul>
<li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s1, const&nbsp;QSize&nbsp;&amp;&nbsp;s2 )</div></li>
<li><div class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s1, const&nbsp;QSize&nbsp;&amp;&nbsp;s2 )</div></li>
<li><div class=fn>const QSize <a href="#operator+"><b>operator+</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s1, const&nbsp;QSize&nbsp;&amp;&nbsp;s2 )</div></li>
<li><div class=fn>const QSize <a href="#operator-"><b>operator-</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s1, const&nbsp;QSize&nbsp;&amp;&nbsp;s2 )</div></li>
<li><div class=fn>const QSize <a href="#operator*"><b>operator*</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s, int&nbsp;c )</div></li>
<li><div class=fn>const QSize <a href="#operator*-2"><b>operator*</b></a> ( int&nbsp;c, const&nbsp;QSize&nbsp;&amp;&nbsp;s )</div></li>
<li><div class=fn>const QSize <a href="#operator*-3"><b>operator*</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s, double&nbsp;c )</div></li>
<li><div class=fn>const QSize <a href="#operator*-4"><b>operator*</b></a> ( double&nbsp;c, const&nbsp;QSize&nbsp;&amp;&nbsp;s )</div></li>
<li><div class=fn>const QSize <a href="#operator/"><b>operator/</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s, int&nbsp;c )</div></li>
<li><div class=fn>const QSize <a href="#operator/-2"><b>operator/</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;s, double&nbsp;c )</div></li>
<li><div class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QSize&nbsp;&amp;&nbsp;sz )</div></li>
<li><div class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QSize&nbsp;&amp;&nbsp;sz )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QSize 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 QCOORD (defined in qwindowdefs.h as <tt>int</tt>).
The minimum value of QCOORD is QCOORD_MIN (-2147483648) and the maximum
value is  QCOORD_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="qpoint.html">QPoint</a>, <a href="qrect.html">QRect</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="QSize"></a>QSize::QSize ()
</h3>

Constructs a size with invalid (negative) width and height.

<h3 class=fn><a name="QSize-2"></a>QSize::QSize ( int&nbsp;w, int&nbsp;h )
</h3>

Constructs a size with width <em>w</em> and height <em>h</em>.

<h3 class=fn><a href="qsize.html">QSize</a> <a name="boundedTo"></a>QSize::boundedTo ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;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="qsize.html">QSize</a> <a name="expandedTo"></a>QSize::expandedTo ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;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#x1838">customlayout/card.cpp</a> and <a href="customlayout-example.html#x1795">customlayout/flow.cpp</a>.
<h3 class=fn>int <a name="height"></a>QSize::height () const
</h3>

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

<p>Examples: <a href="movies-example.html#x1107">movies/main.cpp</a>, <a href="qfd-example.html#x752">qfd/fontdisplayer.cpp</a> and <a href="qfd-example.html#x763">qfd/qfd.cpp</a>.
<h3 class=fn>bool <a name="isEmpty"></a>QSize::isEmpty () const
</h3>

Returns TRUE if the width is <= 0 or the height is <= 0,
otherwise FALSE.

<h3 class=fn>bool <a name="isNull"></a>QSize::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>QSize::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="qsize.html">QSize</a>&nbsp;&amp; <a name="operator*-eq"></a>QSize::operator*= ( int&nbsp;c )
</h3>

Multiplies both the width and height by <em>c</em> and returns a reference to
the size.

<h3 class=fn><a href="qsize.html">QSize</a>&nbsp;&amp; <a name="operator*-eq-2"></a>QSize::operator*= ( double&nbsp;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="qsize.html">QSize</a>&nbsp;&amp; <a name="operator+-eq"></a>QSize::operator+= ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s )
</h3>

<p> Adds <em>s</em> to the size and returns a reference to this size.
<p> Example:
<pre>
    QSize s(  3, 7 );
    QSize r( -1, 4 );
    s += r;                     // s becomes (2,11)
</pre>
 

<h3 class=fn><a href="qsize.html">QSize</a>&nbsp;&amp; <a name="operator--eq"></a>QSize::operator-= ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s )
</h3>

<p> Subtracts <em>s</em> from the size and returns a reference to this size.
<p> Example:
<pre>
    QSize s(  3, 7 );
    QSize r( -1, 4 );
    s -= r;                     // s becomes (4,3)
  </pre>
 

<h3 class=fn><a href="qsize.html">QSize</a>&nbsp;&amp; <a name="operator/-eq"></a>QSize::operator/= ( int&nbsp;c )
</h3>

Divides both the width and height by <em>c</em> and returns a reference to the
size.

<h3 class=fn><a href="qsize.html">QSize</a>&nbsp;&amp; <a name="operator/-eq-2"></a>QSize::operator/= ( double&nbsp;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>QCOORD &amp; <a name="rheight"></a>QSize::rheight ()
</h3>

Returns a reference to the height.
<p> Using a reference makes it possible to directly manipulate the height.
<p> Example:
<pre>
    QSize 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>QCOORD &amp; <a name="rwidth"></a>QSize::rwidth ()
</h3>

Returns a reference to the width.
<p> Using a reference makes it possible to directly manipulate the width.
<p> Example:
<pre>
    QSize 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="setHeight"></a>QSize::setHeight ( int&nbsp;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>QSize::setWidth ( int&nbsp;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>QSize::transpose ()
</h3>
Swaps the values of width and height.

<h3 class=fn>int <a name="width"></a>QSize::width () const
</h3>

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

<p>Examples: <a href="movies-example.html#x1108">movies/main.cpp</a>, <a href="qfd-example.html#x753">qfd/fontdisplayer.cpp</a> and <a href="qfd-example.html#x764">qfd/qfd.cpp</a>.
<hr><h2>Related Functions</h2>
<h3 class=fn>bool <a name="operator!-eq"></a>operator!= ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s2 )
</h3>


Returns TRUE if <em>s1</em> and <em>s2</em> are different; otherwise returns FALSE.

<h3 class=fn>const&nbsp;<a href="qsize.html">QSize</a> <a name="operator*"></a>operator* ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s, int&nbsp;c )
</h3>


Multiplies <em>s</em> by <em>c</em> and returns the result.

<h3 class=fn>const&nbsp;<a href="qsize.html">QSize</a> <a name="operator*-2"></a>operator* ( int&nbsp;c, const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qsize.html">QSize</a> <a name="operator*-3"></a>operator* ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s, double&nbsp;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&nbsp;<a href="qsize.html">QSize</a> <a name="operator*-4"></a>operator* ( double&nbsp;c, const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qsize.html">QSize</a> <a name="operator+"></a>operator+ ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s2 )
</h3>


Returns the sum of <em>s1</em> and <em>s2</em>; each component is added separately.

<h3 class=fn>const&nbsp;<a href="qsize.html">QSize</a> <a name="operator-"></a>operator- ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s2 )
</h3>


Returns <em>s2</em> subtracted from <em>s1</em>; each component is
subtracted separately.

<h3 class=fn>const&nbsp;<a href="qsize.html">QSize</a> <a name="operator/"></a>operator/ ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s, int&nbsp;c )
</h3>


Divides <em>s</em> by <em>c</em> and returns the result.

<h3 class=fn>const&nbsp;<a href="qsize.html">QSize</a> <a name="operator/-2"></a>operator/ ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s, double&nbsp;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="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="qsize.html">QSize</a>&nbsp;&amp;&nbsp;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 QDataStream operators</a>.

<h3 class=fn>bool <a name="operator-eq-eq"></a>operator== ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s1, const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;s2 )
</h3>


Returns TRUE if <em>s1</em> and <em>s2</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="qsize.html">QSize</a>&nbsp;&amp;&nbsp;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 QDataStream operators</a>.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<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; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>