Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
\inmodule QtCore\compares equality \compareswith equality QLineF \endcompareswith More...
#include <qline.h>
Public Member Functions | |
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. | |
void | translate (const QPoint &p) |
Translates this line by the given offset. | |
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 |
Friends | |
constexpr bool | comparesEqual (const QLine &lhs, const QLine &rhs) noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
QDataStream & | operator<< (QDataStream &stream, const QLine &line) |
Writes the given line to the given stream and returns a reference to the stream. | |
QDataStream & | operator>> (QDataStream &stream, QLine &line) |
Reads a line from the given stream into the given line and returns a reference to the stream. | |
\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
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.
|
inlineconstexpr |
Constructs a null line.
Definition at line 73 of file qline.h.
Referenced by translated().
|
inlineconstexpr |
|
inlineconstexpr |
Returns the center point of this line. This is equivalent to (p1() + p2()) / 2, except it will never overflow.
Definition at line 145 of file qline.h.
References QPoint::x(), and QPoint::y().
|
inlineconstexpr |
Returns the horizontal component of the line's vector.
Definition at line 114 of file qline.h.
References QPoint::x().
|
inlineconstexpr |
Returns the vertical component of the line's vector.
Definition at line 119 of file qline.h.
References QPoint::y().
|
inlineconstexpr |
|
inlineconstexpr |
Returns the line's start point.
Definition at line 104 of file qline.h.
Referenced by clipStraightLine(), QRasterPaintEngine::drawLines(), and QX11PaintEngine::drawRects().
|
inlineconstexpr |
Returns the line's end point.
Definition at line 109 of file qline.h.
Referenced by clipStraightLine(), QRasterPaintEngine::drawLines(), and QX11PaintEngine::drawRects().
|
inline |
|
inlineconstexprnoexcept |
Translates this line by the given offset.
Definition at line 124 of file qline.h.
Referenced by translate().
|
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().
Returns this line translated by the given offset.
Definition at line 135 of file qline.h.
References QLine().
Referenced by translated().
|
inlineconstexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns this line translated the distance specified by dx and dy.
Definition at line 140 of file qline.h.
References translated().
|
inlineconstexpr |
Returns the x-coordinate of the line's start point.
Definition at line 84 of file qline.h.
References QPoint::x().
Referenced by QPaintEngine::drawLines(), and QTransform::map().
|
inlineconstexpr |
Returns the x-coordinate of the line's end point.
Definition at line 94 of file qline.h.
References QPoint::x().
Referenced by QPaintEngine::drawLines(), and QTransform::map().
|
inlineconstexpr |
Returns the y-coordinate of the line's start point.
Definition at line 89 of file qline.h.
References QPoint::y().
Referenced by QPaintEngine::drawLines(), and QTransform::map().
|
inlineconstexpr |
Returns the y-coordinate of the line's end point.
Definition at line 99 of file qline.h.
References QPoint::y().
Referenced by QPaintEngine::drawLines(), and QTransform::map().
|
related |
|
related |