Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Classes  ·  Annotées  ·  Hiérarchie  ·  Fonctions  ·  Structure  · 

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

  • QSize () 
  • QSize ( int w, int h ) 
  • bool isNull () const
  • bool isEmpty () const
  • bool isValid () const
  • int width () const
  • int height () const
  • void setWidth ( int w ) 
  • void setHeight ( int h ) 
  • void transpose () 
  • QSize expandedTo ( const QSize & ) const
  • QSize boundedTo ( const QSize & ) const
  • QCOORD& rwidth () 
  • QCOORD& rheight () 
  • QSize& operator+= ( const QSize & ) 
  • QSize& operator-= ( const QSize & ) 
  • QSize& operator*= ( int c ) 
  • QSize& operator*= ( double c ) 
  • QSize& operator/= ( int c ) 
  • QSize& operator/= ( double c ) 

Related Functions

(Note that these are not member functions.)
  • QSize operator* (const QSize & s, int c)
  • QDataStream & operator<< (QDataStream & s, const QSize & sz)
  • QSize operator/ (const QSize & s, int c)
  • QSize operator* (const QSize & s, double c)
  • bool operator!= (const QSize & s1, const QSize & s2)
  • QSize operator- (const QSize & s1, const QSize & s2)
  • QSize operator+ (const QSize & s1, const QSize & s2)
  • QDataStream & operator>> (QDataStream & s, QSize & sz)
  • QSize operator* (int c, const QSize & s)
  • bool operator== (const QSize & s1, const QSize & s2)
  • QSize operator* (double c, const QSize & s)
  • QSize operator/ (const QSize & s, double c)

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: progress/progress.cpp qfd/qfd.cpp xform/xform.cpp menu/menu.cpp


Member Function Documentation

QSize::QSize ()

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

QSize::QSize ( int w, int h )

Constructs a size with width w and height h.

QSize QSize::boundedTo ( const QSize & otherSize ) const

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

QSize QSize::expandedTo ( const QSize & otherSize ) const

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

int QSize::height () const

Returns the height.

See also width().

Examples: qfd/qfd.cpp

bool QSize::isEmpty () const

Returns TRUE if the width is <= 0 or the height is <= 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*= ( double c )

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

Note that the result is truncated.

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

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

QSize & QSize::operator+= ( const QSize & 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-= ( const QSize & 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/= ( double c )

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

Note 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.

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().

void QSize::setHeight ( int h )

Sets the height to h.

See also height() and setWidth().

void QSize::setWidth ( int w )

Sets the width to w.

See also width() and setHeight().

void QSize::transpose ()

Swaps the values of width and height.

int QSize::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.

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

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

See also Format of the QDataStream operators

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

Divides s by c and returns the result.

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

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 & s1, const QSize & s2)

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

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

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

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

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

See also Format of the QDataStream operators

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 equal, or FALSE if they are different.

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

Multiplies s by c and returns the result.

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

Divides s by c and returns the result.

Note that the result is truncated.


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


This file is part of the Qt toolkit, copyright © 1995-2005 Trolltech, all rights reserved.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 79
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Developer Network au hasard

Logo

Les bases

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 2.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web