<!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 > < ntqwindowdefs.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 = "ntqpoint.html" > TQPoint< / a > , < a href = "ntqrect.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 >