CopperSpice API
1.9.2
|
The QLine class provides a two-dimensional vector using integer precision. More...
Public Methods | |
QLine () = default | |
QLine (const QPoint &point1, const QPoint &point2) | |
QLine (int x1, int y1, int x2, int y2) | |
int | dx () const |
int | dy () const |
bool | isNull () const |
bool | operator!= (const QLine &line) const |
bool | operator== (const QLine &line) const |
QPoint | p1 () const |
QPoint | p2 () const |
void | setLine (int x1, int y1, int x2, int y2) |
void | setP1 (const QPoint &point) |
void | setP2 (const QPoint &point) |
void | setPoints (const QPoint &point1, const QPoint &point2) |
void | translate (const QPoint &offset) |
void | translate (int dx, int dy) |
QLine | translated (const QPoint &offset) const |
QLine | translated (int dx, int dy) const |
int | x1 () const |
int | x2 () const |
int | y1 () const |
int | y2 () const |
Related Functions | |
These are not member functions | |
QDataStream & | operator<< (QDataStream &stream, const QLine &line) |
QDataStream & | operator>> (QDataStream &stream, QLine &line) |
The QLine class provides a two-dimensional vector using integer precision. This class 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() methods. 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.
|
default |
Constructs a null QLine.
Constructs a line object that represents the line between point1 and point2.
|
inline |
|
inline |
Returns the horizontal component of the line's vector.
|
inline |
Returns the vertical component of the line's vector.
|
inline |
Returns true if the line is not set up with valid start and end point, otherwise returns false.
|
inline |
Returns true if the given line is not the same as the current QLine. 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.
|
inline |
Returns true if the given line is the same as the current QLine. 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.
|
inline |
|
inline |
|
inline |
|
inline |
Translates this line by the given offset.
|
inline |
Translates this line the distance specified by dx and dy.
|
inline |
Returns this line translated by the given offset.
|
inline |
Returns this line translated the distance specified by dx and dy.
|
inline |
Returns the x-coordinate of the line's start point.
|
inline |
Returns the x-coordinate of the line's end point.
|
inline |
Returns the y-coordinate of the line's start point.
|
inline |
Returns the y-coordinate of the line's end point.
|
related |
Writes the given line to the stream. Returns a reference to the stream.
Refer to Serializing Data Types for additional information.
|
related |
Reads from the stream into the given line. Returns a reference to the stream.
Refer to Serializing Data Types for additional information.