|
constexpr | QLine () |
| Constructs a null line.
|
constexpr | QLine (const QPoint &pt1, const QPoint &pt2) |
| Constructs a line object that represents the line between p1 and p2.
|
constexpr | QLine (int x1, int y1, int x2, int y2) |
| Constructs a line object that represents the line between (x1, y1) and (x2, y2).
|
constexpr bool | isNull () const |
| Returns true if the line does not have distinct start and end points; otherwise returns false .
|
constexpr QPoint | p1 () const |
| Returns the line's start point.
|
constexpr QPoint | p2 () const |
| Returns the line's end point.
|
constexpr int | x1 () const |
| Returns the x-coordinate of the line's start point.
|
constexpr int | y1 () const |
| Returns the y-coordinate of the line's start point.
|
constexpr int | x2 () const |
| Returns the x-coordinate of the line's end point.
|
constexpr int | y2 () const |
| Returns the y-coordinate of the line's end point.
|
constexpr int | dx () const |
| Returns the horizontal component of the line's vector.
|
constexpr int | dy () const |
| Returns the vertical component of the line's vector.
|
constexpr void | translate (const QPoint &p) |
| Translates this line by the given offset.
|
constexpr void | translate (int dx, int dy) |
| 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.
|
constexpr QLine | translated (const QPoint &p) const |
constexpr QLine | translated (int dx, int dy) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
constexpr QPoint | center () const |
void | setP1 (const QPoint &p1) |
void | setP2 (const QPoint &p2) |
void | setPoints (const QPoint &p1, const QPoint &p2) |
void | setLine (int x1, int y1, int x2, int y2) |
constexpr QLineF | toLineF () const noexcept |
\inmodule QtCore
\compares equality \compareswith equality QLineF \endcompareswith
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.
\table \row
- \inlineimage qline-point.png
- \inlineimage qline-coordinates.png \endtable
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, QRect
Definition at line 18 of file qline.h.