Qt 4.8
|
The QLine class provides a two-dimensional vector using integer precision. More...
#include <qline.h>
Public Functions | |
int | dx () const |
Returns the horizontal component of the line's vector. More... | |
int | dy () const |
Returns the vertical component of the line's vector. More... | |
bool | isNull () const |
Returns true if the line is not set up with valid start and end point; otherwise returns false. More... | |
bool | operator!= (const QLine &d) const |
Returns true if the given line is not the same as this line. More... | |
bool | operator== (const QLine &d) const |
Returns true if the given line is the same as this line. More... | |
QPoint | p1 () const |
Returns the line's start point. More... | |
QPoint | p2 () const |
Returns the line's end point. More... | |
QLine () | |
Constructs a null line. More... | |
QLine (const QPoint &pt1, const QPoint &pt2) | |
Constructs a line object that represents the line between p1 and p2. More... | |
QLine (int x1, int y1, int x2, int y2) | |
Constructs a line object that represents the line between (x1, y1) and (x2, y2). More... | |
void | setLine (int x1, int y1, int x2, int y2) |
Sets this line to the start in x1, y1 and end in x2, y2. More... | |
void | setP1 (const QPoint &p1) |
Sets the starting point of this line to p1. More... | |
void | setP2 (const QPoint &p2) |
Sets the end point of this line to p2. More... | |
void | 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. More... | |
void | translate (const QPoint &p) |
Translates this line by the given offset. More... | |
void | translate (int dx, int dy) |
Translates this line the distance specified by dx and dy. More... | |
QLine | translated (const QPoint &p) const |
Returns this line translated by the given offset. More... | |
QLine | translated (int dx, int dy) const |
Returns this line translated the distance specified by dx and dy. More... | |
int | x1 () const |
Returns the x-coordinate of the line's start point. More... | |
int | x2 () const |
Returns the x-coordinate of the line's end point. More... | |
int | y1 () const |
Returns the y-coordinate of the line's start point. More... | |
int | y2 () const |
Returns the y-coordinate of the line's end point. More... | |
Properties | |
QPoint | pt1 |
QPoint | pt2 |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QLine &line) |
Writes the given line to the given stream and returns a reference to the stream. More... | |
QDataStream & | operator>> (QDataStream &stream, QLine &line) |
Reads a line from the given stream into the given line and returns a reference to the stream. More... | |
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.
|
inline |
|
inline |
Constructs a line object that represents the line between (x1, y1) and (x2, y2).
Definition at line 105 of file qline.h.
|
inline |
Returns the horizontal component of the line's vector.
Definition at line 142 of file qline.h.
Referenced by QLineF::QLineF().
|
inline |
Returns the vertical component of the line's vector.
Definition at line 147 of file qline.h.
Referenced by QLineF::QLineF().
|
inline |
Returns true if the line is not set up with valid start and end point; otherwise returns false.
Definition at line 107 of file qline.h.
Referenced by QLineF::QLineF().
|
inline |
|
inline |
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.
Definition at line 195 of file qline.h.
Referenced by QLineF::QLineF().
|
inline |
Returns the line's start point.
Definition at line 132 of file qline.h.
Referenced by _q_interpolate(), clipStraightLine(), QPlastiqueStyle::drawControl(), QRasterPaintEngine::drawLines(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QMatrix::map(), operator<<(), operator<<(), and QLineF::QLineF().
|
inline |
Returns the line's end point.
Definition at line 137 of file qline.h.
Referenced by _q_interpolate(), clipStraightLine(), QPlastiqueStyle::drawControl(), QRasterPaintEngine::drawLines(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QMatrix::map(), operator<<(), operator<<(), and QLineF::QLineF().
|
inline |
Sets this line to the start in x1, y1 and end in x2, y2.
Definition at line 189 of file qline.h.
Referenced by QLineF::QLineF().
|
inline |
Sets the starting point of this line to p1.
Definition at line 173 of file qline.h.
Referenced by QLineF::QLineF().
|
inline |
Sets the end point of this line to p2.
Definition at line 178 of file qline.h.
Referenced by QLineF::QLineF().
Sets the start point of this line to p1 and the end point of this line to p2.
Definition at line 183 of file qline.h.
Referenced by QLineF::QLineF().
|
inline |
Translates this line by the given offset.
Definition at line 152 of file qline.h.
Referenced by QLineF::QLineF(), and translate().
|
inline |
Translates this line the distance specified by dx and dy.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 158 of file qline.h.
Returns this line translated by the given offset.
Definition at line 163 of file qline.h.
Referenced by QLineF::QLineF(), and translated().
|
inline |
Returns this line translated the distance specified by dx and dy.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 168 of file qline.h.
|
inline |
Returns the x-coordinate of the line's start point.
Definition at line 112 of file qline.h.
Referenced by QVGPaintEngine::drawLines(), QOpenGLPaintEngine::drawLines(), QPaintEngine::drawLines(), drawLines(), QTransform::map(), and QLineF::QLineF().
|
inline |
Returns the x-coordinate of the line's end point.
Definition at line 122 of file qline.h.
Referenced by QVGPaintEngine::drawLines(), QOpenGLPaintEngine::drawLines(), QPaintEngine::drawLines(), drawLines(), QTransform::map(), and QLineF::QLineF().
|
inline |
Returns the y-coordinate of the line's start point.
Definition at line 117 of file qline.h.
Referenced by QVGPaintEngine::drawLines(), QOpenGLPaintEngine::drawLines(), QPaintEngine::drawLines(), drawLines(), QTransform::map(), and QLineF::QLineF().
|
inline |
Returns the y-coordinate of the line's end point.
Definition at line 127 of file qline.h.
Referenced by QVGPaintEngine::drawLines(), QOpenGLPaintEngine::drawLines(), QPaintEngine::drawLines(), drawLines(), QTransform::map(), and QLineF::QLineF().
|
related |
Writes the given line to the given stream and returns a reference to the stream.
Definition at line 350 of file qline.cpp.
Referenced by operator==().
|
related |
Reads a line from the given stream into the given line and returns a reference to the stream.
Definition at line 368 of file qline.cpp.
Referenced by operator==().
|
private |
Definition at line 93 of file qline.h.
Referenced by dx(), dy(), isNull(), operator==(), p1(), setLine(), setP1(), setPoints(), translate(), translated(), x1(), and y1().
|
private |
Definition at line 93 of file qline.h.
Referenced by dx(), dy(), isNull(), operator==(), p2(), setLine(), setP2(), setPoints(), translate(), translated(), x2(), and y2().