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  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QPointF Class Reference
[QtCore module]

The QPointF class provides a point object that uses floating point coordinates for accuracy. More...

#include <QPointF>

Public Functions

Related Non-Members

  • bool operator!= ( const QPointF & point1, const QPointF & point2 )
  • const QPointF operator* ( const QPointF & point, qreal factor )
  • const QPointF operator* ( qreal factor, const QPointF & point )
  • const QPointF operator+ ( const QPointF & point, const QPointF & other )
  • const QPointF operator- ( const QPointF & point, const QPointF & other )
  • const QPointF operator- ( const QPointF & point )
  • const QPointF operator/ ( const QPointF & point, qreal factor )
  • QDataStream & operator<< ( QDataStream & s, const QPointF & p )
  • bool operator== ( const QPointF & point1, const QPointF & point2 )
  • QDataStream & operator>> ( QDataStream & s, QPointF & p )

Detailed Description

The QPointF class provides a point object that uses floating point coordinates for accuracy.

A QPointF describes a point on a two-dimensional surface. The coordinates of the point are specified using floating point numbers for accuracy. QPoint provides points with integer accuracy.

Convenience functions are provided for reading and writing the individual coordinates used to define the point: x(), y(), setX(), and setY(). QPointF also provides support for the standard arithmetic operators, treating each point as a vector from the origin.

See also QPolygonF, QSizeF, QRectF, and QPoint.


Member Function Documentation

QPointF::QPointF ()

Constructs a null point.

See also isNull().

QPointF::QPointF ( const QPoint & point )

Copy constructor. Constructs a point using the values of the point specified.

QPointF::QPointF ( qreal x, qreal y )

Constructs a point with coordinates specified by x and y.

bool QPointF::isNull () const

Returns true if the point is null; otherwise returns false.

A point is considered to be null if both the x- and y-coordinates are equal to zero.

qreal & QPointF::rx ()

Returns a reference to the x-coordinate of the point.

See also ry() and setX().

qreal & QPointF::ry ()

Returns a reference to the y-coordinate of the point.

See also rx() and setY().

void QPointF::setX ( qreal x )

Sets the x-coordinate of the point to the value specified by x.

See also setY(), x(), and rx().

void QPointF::setY ( qreal y )

Sets the y-coordinate of the point to the value specified by y.

See also setX(), y(), and ry().

QPoint QPointF::toPoint () const

Rounds the coordinates of this point to the nearest integer and returns a QPoint with these rounded coordinates.

qreal QPointF::x () const

Returns the x-coordinate of the point.

See also setX() and y().

qreal QPointF::y () const

Returns the y-coordinate of the point.

See also setY() and x().

QPointF & QPointF::operator*= ( qreal factor )

Multiplies the coordinates of this point by the given scale factor, and returns a reference to this point with the new coordinates. This is equivalent to scalar multiplication of a vector.

See also operator*() and operator/=().

QPointF & QPointF::operator+= ( const QPointF & other )

Adds the coordinates of this point to the corresponding coordinates of the other point, and returns a reference to this point with the new coordinates. This is equivalent to vector addition.

See also operator+() and operator-=().

QPointF & QPointF::operator-= ( const QPointF & other )

Subtracts the coordinates of the other point from the corresponding coordinates of this point, and returns a reference to this point with the new coordinates. This is equivalent to vector subtraction.

See also operator-() and operator+=().

QPointF & QPointF::operator/= ( qreal factor )

Divides the coordinates of this point by the given scale factor, and returns a references to this point with the new coordinates. This is equivalent to scalar division of a vector.

See also operator*().


Related Non-Members

bool operator!= ( const QPointF & point1, const QPointF & point2 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns true if point1 is not equal to point2; otherwise returns false.

const QPointF operator* ( const QPointF & point, qreal factor )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Multiplies the coordinates of the point by the given scale factor, and returns a point with the new coordinates. (Scalar multiplication of a vector.)

See also operator/().

const QPointF operator* ( qreal factor, const QPointF & point )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Multiplies the coordinates of the point by the given scale factor, and returns a point with the new coordinates. (Scalar multiplication of a vector.)

See also operator/().

const QPointF operator+ ( const QPointF & point, const QPointF & other )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Adds the coordinates of the point to the corresponding coordinates of the other point, and returns a point with the new coordinates. (Vector addition.)

See also operator-().

const QPointF operator- ( const QPointF & point, const QPointF & other )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Subtracts the coordinates of the other point from the corresponding coordinates of the given point, and returns a point with the new coordinates. (Vector subtraction.)

See also operator+().

const QPointF operator- ( const QPointF & point )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Negates the coordinates of the point, and returns a point with the new coordinates. (Inversion).

const QPointF operator/ ( const QPointF & point, qreal factor )

Divides the coordinates of the point by the given scale factor, and returns a point with the new coordinates. (Scalar division of a vector.)

See also operator*().

QDataStream & operator<< ( QDataStream & s, const QPointF & p )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Writes point p to the stream s and returns a reference to the stream.

See also Format of the QDataStream operators.

bool operator== ( const QPointF & point1, const QPointF & point2 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns true if point1 is equal to point2; otherwise returns false.

Two points are equal to each other if both x-coordinates and both y-coordinates are the same.

QDataStream & operator>> ( QDataStream & s, QPointF & p )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Reads a QPoint from the stream s into point p and returns a reference to the stream.

See also Format of the QDataStream operators.

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 94
  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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 45
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 6
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le Qt Labs au hasard

Logo

La folie est de mettre en forme le même texte

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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 4.0
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