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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QLine Class Reference
[QtCore module]

The QLine class provides a two-dimensional vector using integer precision. More...

 #include <QLine>

Public Functions

  • QLine ()
  • QLine ( const QPoint & p1, const QPoint & p2 )
  • QLine ( int x1, int y1, int x2, int y2 )
  • QPoint p1 () const
  • QPoint p2 () const
  • int x1 () const
  • int x2 () const
  • int y1 () const
  • int y2 () const
  • int dx () const
  • int dy () const
  • bool isNull () const
  • void setP1 ( const QPoint & p1 )
  • void setP2 ( const QPoint & p2 )
  • void setLine ( int x1, int y1, int x2, int y2 )
  • void setPoints ( const QPoint & p1, const QPoint & p2 )
  • void translate ( const QPoint & offset )
  • void translate ( int dx, int dy )
  • QLine translated ( const QPoint & offset ) const
  • QLine translated ( int dx, int dy ) const
  • bool operator!= ( const QLine & line ) const
  • bool operator== ( const QLine & line ) const

Related Non-Members

  • QDataStream & operator<< ( QDataStream & stream, const QLine & line )
  • QDataStream & operator>> ( QDataStream & stream, QLine & line )

Detailed Description

The QLine class provides a two-dimensional vector using integer precision.

A QLine describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use the QLineF constructor to retrieve a floating point copy.

The positions of the line's start and end points can be retrieved using the p1(), x1(), y1(), p2(), x2(), and y2() functions. The dx() and dy() functions return the horizontal and vertical components of the line. Use isNull() to determine whether the QLine represents a valid line or a null line.

Finally, the line can be translated a given offset using the translate() function.

See also QLineF, QPolygon, and QRect.


Member Function Documentation

QLine::QLine ()

Constructs a null line.

QLine::QLine ( const QPoint & p1, const QPoint & p2 )

Constructs a line object that represents the line between p1 and p2.

QLine::QLine ( int x1, int y1, int x2, int y2 )

Constructs a line object that represents the line between (x1, y1) and (x2, y2).

QPoint QLine::p1 () const

Returns the line's start point.

See also setP1(), x1(), y1(), and p2().

QPoint QLine::p2 () const

Returns the line's end point.

See also setP2(), x2(), y2(), and p1().

int QLine::x1 () const

Returns the x-coordinate of the line's start point.

See also p1().

int QLine::x2 () const

Returns the x-coordinate of the line's end point.

See also p2().

int QLine::y1 () const

Returns the y-coordinate of the line's start point.

See also p1().

int QLine::y2 () const

Returns the y-coordinate of the line's end point.

See also p2().

int QLine::dx () const

Returns the horizontal component of the line's vector.

See also dy().

int QLine::dy () const

Returns the vertical component of the line's vector.

See also dx().

bool QLine::isNull () const

Returns true if the line is not set up with valid start and end point; otherwise returns false.

void QLine::setP1 ( const QPoint & p1 )

Sets the starting point of this line to p1.

This function was introduced in Qt 4.4.

See also setP2() and p1().

void QLine::setP2 ( const QPoint & p2 )

Sets the end point of this line to p2.

This function was introduced in Qt 4.4.

See also setP1() and p2().

void QLine::setLine ( int x1, int y1, int x2, int y2 )

Sets this line to the start in x1, y1 and end in x2, y2.

This function was introduced in Qt 4.4.

See also setP1(), setP2(), p1(), and p2().

void QLine::setPoints ( const QPoint & p1, const QPoint & p2 )

Sets the start point of this line to p1 and the end point of this line to p2.

This function was introduced in Qt 4.4.

See also setP1(), setP2(), p1(), and p2().

void QLine::translate ( const QPoint & offset )

Translates this line by the given offset.

void QLine::translate ( int dx, int dy )

This is an overloaded function.

Translates this line the distance specified by dx and dy.

QLine QLine::translated ( const QPoint & offset ) const

Returns this line translated by the given offset.

This function was introduced in Qt 4.4.

QLine QLine::translated ( int dx, int dy ) const

This is an overloaded function.

Returns this line translated the distance specified by dx and dy.

This function was introduced in Qt 4.4.

bool QLine::operator!= ( const QLine & line ) const

Returns true if the given line is not the same as this line.

A line is different from another line if any of their start or end points differ, or the internal order of the points is different.

bool QLine::operator== ( const QLine & line ) const

Returns true if the given line is the same as this line.

A line is identical to another line if the start and end points are identical, and the internal order of the points is the same.


Related Non-Members

QDataStream & operator<< ( QDataStream & stream, const QLine & line )

Writes the given line to the given stream and returns a reference to the stream.

See also Format of the QDataStream Operators.

QDataStream & operator>> ( QDataStream & stream, QLine & line )

Reads a line from the given stream into the given line 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. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 23
  2. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 38
  3. Une nouvelle ère d'IHM 3D pour les automobiles, un concept proposé par Digia et implémenté avec Qt 3
  4. PySide devient un add-on Qt et rejoint le Qt Project et le modèle d'open gouvernance 1
  5. Qt Creator 2.5 est sorti en beta, l'EDI supporte maintenant plus de fonctionnalités de C++11 2
  6. Vingt sociétés montrent leurs décodeurs basés sur Qt au IPTV World Forum, en en exploitant diverses facettes (déclaratif, Web, widgets) 0
  7. Thread travailleur avec Qt en utilisant les signaux et les slots, un article de Christophe Dumez traduit par Thibaut Cuvelier 1
  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 ? 49
  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é 23
  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

QLocale : à propos du temps (et des dates, et des langues, et des...)

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