Qt logo

QSize Class Reference


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

#include <qsize.h>

List of all member functions.

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 coordinate type is QCOORD (defined in qwindowdefs.h as int). The minimum value of QCOORD is QCOORD_MIN (-2147483648) and the maximum value is QCOORD_MAX (2147483647).

See also: QPoint and QRect.

Examples: xform/xform.cpp progress/progress.cpp qfd/qfd.cpp


Member Function Documentation

QSize::QSize()

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

QSize::QSize(intw, inth)

Constructs a size with width w and height h.

QSizeQSize::boundedTo(constQSize&otherSize)const

Returns a size with the minimum width and height of this size and otherSize.

QSizeQSize::expandedTo(constQSize&otherSize)const

Returns a size with the maximum width and height of this size and otherSize.

intQSize::height()const

Returns the height.

See also: width().

Examples: qfd/qfd.cpp

boolQSize::isEmpty()const

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

boolQSize::isNull()const

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

boolQSize::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*=(doublec)

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

Note that the result is truncated.

QSize&QSize::operator*=(intc)

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

QSize&QSize::operator+=(constQSize&s)

Adds s to the size and returns a reference to this size.

Example:

    QSize s(  3, 7 );
    QSize r( -1, 4 );
    s += r;                     // s becomes (2,11)

QSize&QSize::operator-=(constQSize&s)

Subtracts s from the size and returns a reference to this size.

Example:

    QSize s(  3, 7 );
    QSize r( -1, 4 );
    s -= r;                     // s becomes (4,3)

QSize&QSize::operator/=(doublec)

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

Note that the result is truncated.

QSize&QSize::operator/=(intc)

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

QCOORD&QSize::rheight()

Returns a reference to the height.

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

Example:

    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.

Example:

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

See also: rheight().

voidQSize::setHeight(inth)

Sets the height to h.

See also: height() and setWidth().

voidQSize::setWidth(intw)

Sets the width to w.

See also: width() and setHeight().

voidQSize::transpose()

Swaps the values of width and height.

intQSize::width()const

Returns the width.

See also: height().

Examples: qfd/qfd.cpp


Related Functions

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

Multiplies s by c and returns the result.

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

Multiplies s by c and returns the result.

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

Multiplies s by c and returns the result.

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)

Divides s by c and returns the result.

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

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

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

Divides s by c and returns the result.

Note that the result is truncated.

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

Writes the size to the stream and returns a reference to the stream.

Serialization format: [width (Q_INT32), height (Q_INT32)].

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

Reads the size from the stream and returns a reference to the stream.

QSize operator- (const QSize & s1, const QSize & s2)

Returns s2 subtracted from s1; each component is subtracted separately.

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

Multiplies s by c and returns the result.

QSize operator+ (const QSize & s1, const QSize & s2)

Returns the sum of s1 and s2; each component is added separately.


Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):


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


Copyright 1999 Troll TechTrademarks
Qt version 2.0.2