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  · 

QLineF Class Reference
[QtCore module]

The QLineF class provides a two-dimensional vector that uses floating point accuracy for coordinates. More...

#include <QLineF>

Public Types

  • enum IntersectType { NoIntersection, UnboundedIntersection, BoundedIntersection }

Public Functions

  • QLineF ( const QPointF & pt1, const QPointF & pt2 )
  • QLineF ( qreal x1, qreal y1, qreal x2, qreal y2 )
  • QLineF ( const QLine & line )
  • QPointF p1 () const
  • QPointF p2 () const
  • qreal x1 () const
  • qreal x2 () const
  • qreal y1 () const
  • qreal y2 () const
  • qreal angle ( const QLineF & line ) const
  • qreal dx () const
  • qreal dy () const
  • IntersectType intersect ( const QLineF & other, QPointF * intersectionPoint ) const
  • bool isNull () const
  • qreal length () const
  • QLineF normalVector () const
  • QPointF pointAt ( qreal t ) const
  • void setLength ( qreal length )
  • QLine toLine () const
  • void translate ( const QPointF & point )
  • void translate ( qreal dx, qreal dy )
  • QLineF unitVector () const
  • bool operator!= ( const QLineF & other ) const
  • bool operator== ( const QLineF & other ) const

Related Non-Members

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

Detailed Description

The QLineF class provides a two-dimensional vector that uses floating point accuracy for coordinates.

A QLineF describes a finite length line (or line segment) on a two-dimensional surface. QLineF provides a variant of the QLine class that defines the start and end points of the line using floating point coordinates.

Use isNull() to determine whether the QLineF represents a valid line or a null line.

[Missing image qline-point.png][Missing image qline-coordinates.png]

The positions of the line's end points can be found with the p1(), x1(), y1(), p2(), x2(), and y2() functions. The horizontal and vertical components of the line are returned by the dx() and dy() functions.

Convenience functions are provided for finding the lines's length(), the unitVector() along the line, whether two lines intersect(), and the angle() between two lines. The line's length can be changed using setLength().

The line can be translated along the length of another line with the moveBy() function, and can be traversed using a parameter with the pointAt() function.

See also QPointF, QSizeF, QRectF, and QLine.


Member Type Documentation

enum QLineF::IntersectType

ConstantValueDescription
QLineF::NoIntersection0Indicates that the lines do not intersect; i.e. they are parallel.
QLineF::UnboundedIntersection2The two lines intersect, but not within the range defined by their lengths. This will be the case if the lines are not parallel.
ConstantValueDescription
QLineF::BoundedIntersection1The two lines intersect with each other within the start and end points of each line.

Member Function Documentation

QLineF::QLineF ()

Constructs a null line.

QLineF::QLineF ( const QPointF & pt1, const QPointF & pt2 )

Constructs a line object that represents the line between pt1 and pt2.

QLineF::QLineF ( qreal x1, qreal y1, qreal x2, qreal y2 )

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

QLineF::QLineF ( const QLine & line )

Construct a QLineF from a integer-based QLine line.

QPointF QLineF::p1 () const

Returns the line's start point.

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

QPointF QLineF::p2 () const

Returns the line's end point.

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

qreal QLineF::x1 () const

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

See also y1(), p1(), and x2().

qreal QLineF::x2 () const

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

See also y2(), p2(), and x1().

qreal QLineF::y1 () const

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

See also x1(), p1(), and x2().

qreal QLineF::y2 () const

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

See also x2(), p2(), and y1().

qreal QLineF::angle ( const QLineF & line ) const

Returns the smallest angle between the given line and this line, not taking into account whether the lines intersect or not. The angle is specified in degrees.

See also intersect().

qreal QLineF::dx () const

Returns the horizontal component of the line's vector.

See also dy() and pointAt().

qreal QLineF::dy () const

Returns the vertical component of the line's vector.

See also dx() and pointAt().

IntersectType QLineF::intersect ( const QLineF & other, QPointF * intersectionPoint ) const

Returns a value indicating whether or not this line intersects the other line. By passing a valid pointer as intersectionPoint, it is possible to get the actual intersection point. The intersection point is undefined if the lines are parallel.

bool QLineF::isNull () const

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

qreal QLineF::length () const

Returns the length of the line.

See also setLength().

QLineF QLineF::normalVector () const

Returns a line that is perpendicular to this line with the same starting point and length.

See also unitVector().

QPointF QLineF::pointAt ( qreal t ) const

Returns the point at the parameterized position t, where the start and end point are defined to be at positions t=0 and t=1.

See also dx() and dy().

void QLineF::setLength ( qreal length )

Sets the length of the line.

See also length().

QLine QLineF::toLine () const

Returns a QLine. The returned QLine's starting and end points are rounded to the nearest integer.

void QLineF::translate ( const QPointF & point )

Translates this line with the point given.

void QLineF::translate ( qreal dx, qreal dy )

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

Translates this line the distance dx and dy.

QLineF QLineF::unitVector () const

Returns a normalized version of this line, starting at the same point as this line. A normalized line is a line of unit length (length() is equal to 1.0).

See also normalVector().

bool QLineF::operator!= ( const QLineF & other ) const

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

A line is different from another line if any of their points are different or their order is different.

bool QLineF::operator== ( const QLineF & other ) const

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

A line is identical if the two points are the same and their order is the same.


Related Non-Members

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

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

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

See also Format of the QDataStream operators.

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

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

Reads a QLineF from the stream into the line and returns a reference to the stream.

See also Format of the QDataStream operators.

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