#include <qline.h>
Collaboration diagram for QLine:

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.
qline-point.png qline-coordinates.png
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.
Definition at line 37 of file qline.h.
Public Member Functions | |
| QLine () | |
| QLine (const QPoint &pt1, const QPoint &pt2) | |
| QLine (int x1, int y1, int x2, int y2) | |
| bool | isNull () const |
| QPoint | p1 () const |
| QPoint | p2 () const |
| int | x1 () const |
| int | y1 () const |
| int | x2 () const |
| int | y2 () const |
| int | dx () const |
| int | dy () const |
| void | translate (const QPoint &p) |
| void | translate (int dx, int dy) |
| bool | operator== (const QLine &d) const |
| bool | operator!= (const QLine &d) const |
Private Attributes | |
| QPoint | pt1 |
| QPoint | pt2 |
Related Functions | |
| (Note that these are not member functions.) | |
| QDataStream & | operator<< (QDataStream &stream, const QLine &line) |
| QDataStream & | operator>> (QDataStream &stream, QLine &line) |
| QLine::QLine | ( | int | x1, | |
| int | y1, | |||
| int | x2, | |||
| int | y2 | |||
| ) | [inline] |
| bool QLine::isNull | ( | ) | const [inline] |
| QPoint QLine::p1 | ( | ) | const [inline] |
Returns the line's start point.
Definition at line 104 of file qline.h.
References pt1.
Referenced by QPlastiqueStyle::drawControl(), QX11PaintEngine::drawLines(), QPainter::drawLines(), QCleanlooksStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QMatrix::map(), operator<<(), and operator<<().
00105 { 00106 return pt1; 00107 }
| QPoint QLine::p2 | ( | ) | const [inline] |
Returns the line's end point.
Definition at line 109 of file qline.h.
References pt2.
Referenced by QPlastiqueStyle::drawControl(), QX11PaintEngine::drawLines(), QCleanlooksStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QMatrix::map(), operator<<(), and operator<<().
00110 { 00111 return pt2; 00112 }
| int QLine::x1 | ( | ) | const [inline] |
Returns the x-coordinate of the line's start point.
Definition at line 84 of file qline.h.
References pt1, and QPoint::x().
Referenced by QPaintEngine::drawLines().
Here is the call graph for this function:

| int QLine::y1 | ( | ) | const [inline] |
Returns the y-coordinate of the line's start point.
Definition at line 89 of file qline.h.
References pt1, and QPoint::y().
Referenced by QPaintEngine::drawLines().
Here is the call graph for this function:

| int QLine::x2 | ( | ) | const [inline] |
Returns the x-coordinate of the line's end point.
Definition at line 94 of file qline.h.
References pt2, and QPoint::x().
Referenced by QPaintEngine::drawLines().
Here is the call graph for this function:

| int QLine::y2 | ( | ) | const [inline] |
Returns the y-coordinate of the line's end point.
Definition at line 99 of file qline.h.
References pt2, and QPoint::y().
Referenced by QPaintEngine::drawLines().
Here is the call graph for this function:

| int QLine::dx | ( | ) | const [inline] |
| int QLine::dy | ( | ) | const [inline] |
| void QLine::translate | ( | const QPoint & | offset | ) | [inline] |
Translates this line by the given offset.
Definition at line 124 of file qline.h.
Referenced by QPainter::drawLines(), and translate().
| void QLine::translate | ( | int | dx, | |
| int | dy | |||
| ) | [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Translates this line the distance specified by dx and dy.
Definition at line 130 of file qline.h.
References translate().
Here is the call graph for this function:

| bool QLine::operator== | ( | const QLine & | line | ) | const [inline] |
| bool QLine::operator!= | ( | const QLine & | line | ) | const [inline] |
| QDataStream & operator<< | ( | QDataStream & | stream, | |
| const QLine & | line | |||
| ) | [related] |
Writes the given line to the given stream and returns a reference to the stream.
Definition at line 201 of file qline.cpp.
References p1(), p2(), and QTest::stream.
Here is the call graph for this function:

| QDataStream & operator>> | ( | QDataStream & | stream, | |
| QLine & | line | |||
| ) | [related] |
Reads a line from the given stream into the given line and returns a reference to the stream.
Definition at line 216 of file qline.cpp.
References QTest::stream.
00217 { 00218 QPoint p1, p2; 00219 stream >> p1; 00220 stream >> p2; 00221 line = QLine(p1, p2); 00222 00223 return stream; 00224 }
QPoint QLine::pt1 [private] |
Definition at line 65 of file qline.h.
Referenced by dx(), dy(), isNull(), operator==(), p1(), translate(), x1(), and y1().
QPoint QLine::pt2 [private] |
Definition at line 65 of file qline.h.
Referenced by dx(), dy(), isNull(), operator==(), p2(), translate(), x2(), and y2().
1.5.1