QSize Class Reference


The QSize class defines the size of a two-dimensional object. (details) (complete member list)

#include <qsize.h>

Public Members

Related Functions

(Note that these are not member functions.)

Detailed Description

The QSize class defines the size of a two-dimensional object.

A size is specified by a width and a height.

The width/height type is QCOORD (defined as short). The minimum value of QCOORD is -32768 and the maximum value is 32767.

See also: QPoint and QRect.


Member Function Documentation

QSize::QSize ()

Constructs a size with undefined width and height.

QSize::QSize (QCOORD w, QCOORD h)

Constructs a size with width w and height h.

QCOORD QSize::height () const

Returns the height.

See also: width().

bool QSize::isEmpty () const

Returns TRUE if the width is less than 0 or the height is less than 0, otherwise FALSE.

bool QSize::isNull () const

Returns TRUE if the width is 0 and the height is 0, otherwise FALSE.

bool QSize::isValid () const

Returns TRUE if the width is equal to or greater than 0 and the height is equal to or greater than 0, otherwise FALSE.

QSize & QSize::operator*= (int c)

Multiplies both the width and height with c and returns a reference to the size.

QSize & QSize::operator*= (float c)

Multiplies both the width and height with c and returns a reference to the size.

Notice that the result is truncated.

QSize & QSize::operator/= (int c)

Divides both the width and height by c and returns a reference to the size.

The division will not be performed if c is 0.

QSize & QSize::operator/= (float c)

Divides both the width and height by c and returns a reference to the size.

The division will not be performed if c is 0.

Notice that the result is truncated.

QCOORD & QSize::rheight ()

Returns a reference to the height.

Using a reference makes it possible to directly manipulate the height:

  QSize s( 100, 10 );
  s.rheight() += 5;             // s becomes (100,15)

See also: rwidth().

QCOORD & QSize::rwidth ()

Returns a reference to the width.

Using a reference makes it possible to directly manipulate the width:

  QSize s( 100, 10 );
  s.rwidth() += 20;             // s becomes (120,10)

See also: rheight().

void QSize::setHeight (QCOORD h)

Sets the height to h.

See also: setWidth().

void QSize::setWidth (QCOORD w)

Sets the width to w.

See also: setHeight().

QCOORD QSize::width () const

Returns the width.

See also: height().


Related Functions

bool operator== (const QSize &s1, const QSize &s2)

Returns TRUE if s1 and s2 are equal, or FALSE if they are different.

bool operator!= (const QSize &s1, const QSize &s2)

Returns TRUE if s1 and s2 are different, or FALSE if they are equal.

QSize operator* (const QSize &s, int c)

Multiplies s by c and returns the result.

QSize operator* (int c, const QSize &s)

Multiplies s by c and returns the result.

QSize operator* (const QSize &s, float c)

Multiplies s by c and returns the result.

QSize operator* (float c, const QSize &s)

Multiplies s by c and returns the result.

QSize operator/ (const QSize &s, int c)

Divides s by c and returns the result.

This function returns s if c is 0.

QSize operator/ (const QSize &s, float c)

Divides s by c and returns the result.

This function returns s if c is 0.

Notice that the result is truncated.

QDataStream & operator<< (QDataStream &s, const QSize &sz)

Writes the size to the stream.

The output format is two INT16 (first teh width, then the height).

QDataStream & operator>> (QDataStream &s, QSize &sz)

Reads the size from the stream.


This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.

It was generated from the following files:


Generated at 04:27, 1995/05/20 by the webmaster at Troll Tech