7#include <QtCore/qpoint.h>
20 constexpr inline QLine();
24 constexpr inline bool isNull()
const;
29 constexpr inline int x1()
const;
30 constexpr inline int y1()
const;
32 constexpr inline int x2()
const;
33 constexpr inline int y2()
const;
35 constexpr inline int dx()
const;
36 constexpr inline int dy()
const;
41 [[nodiscard]]
constexpr inline QLine translated(
const QPoint &
p)
const;
42 [[nodiscard]]
constexpr inline QLine translated(
int dx,
int dy)
const;
44 [[nodiscard]]
constexpr inline QPoint center()
const;
49 inline void setLine(
int x1,
int y1,
int x2,
int y2);
54 [[nodiscard]]
constexpr inline QLineF toLineF() const noexcept;
69constexpr inline QLine::QLine(
int x1pos,
int y1pos,
int x2pos,
int y2pos) : pt1(
QPoint(x1pos, y1pos)), pt2(
QPoint(x2pos, y2pos)) { }
108 return pt2.
x() - pt1.
x();
113 return pt2.
y() - pt1.
y();
129 return QLine(pt1 +
p, pt2 +
p);
166 return pt1 ==
d.pt1 && pt2 ==
d.pt2;
169#ifndef QT_NO_DEBUG_STREAM
173#ifndef QT_NO_DATASTREAM
188 constexpr inline QLineF();
195 constexpr bool isNull()
const;
200 constexpr inline qreal x1()
const;
201 constexpr inline qreal y1()
const;
203 constexpr inline qreal x2()
const;
204 constexpr inline qreal y2()
const;
206 constexpr inline qreal dx()
const;
207 constexpr inline qreal dy()
const;
217 [[nodiscard]]
QLineF unitVector()
const;
218 [[nodiscard]]
constexpr inline QLineF normalVector()
const;
220 IntersectionType intersects(
const QLineF &l,
QPointF *intersectionPoint =
nullptr)
const;
226 [[nodiscard]]
constexpr inline QLineF translated(
const QPointF &
p)
const;
229 [[nodiscard]]
constexpr inline QPointF center()
const;
239 constexpr QLine toLine()
const;
255 : pt1(apt1), pt2(apt2)
260 : pt1(x1pos, y1pos), pt2(x2pos, y2pos)
301 return pt2.
x() - pt1.
x();
306 return pt2.
y() - pt1.
y();
337 return QPointF(0.5 * pt1.
x() + 0.5 * pt2.
x(), 0.5 * pt1.
y() + 0.5 * pt2.
y());
353 return QPointF(pt1.
x() + (pt2.
x() - pt1.
x()) *
t, pt1.
y() + (pt2.
y() - pt1.
y()) *
t);
360 return QLine(pt1.toPoint(), pt2.toPoint());
389 return pt1 ==
d.pt1 && pt2 ==
d.pt2;
394#ifndef QT_NO_DEBUG_STREAM
398#ifndef QT_NO_DATASTREAM
\inmodule QtCore\reentrant
constexpr QPointF p1() const
Returns the line's start point.
constexpr qreal x1() const
Returns the x-coordinate of the line's start point.
constexpr QLine toLine() const
Returns an integer-based copy of this line.
void setP2(const QPointF &p2)
constexpr bool isNull() const
Returns true if the line does not have distinct start and end points; otherwise returns false.
constexpr qreal y2() const
Returns the y-coordinate of the line's end point.
void translate(const QPointF &p)
Translates this line by the given offset.
constexpr qreal dx() const
Returns the horizontal component of the line's vector.
void setPoints(const QPointF &p1, const QPointF &p2)
constexpr QLineF translated(const QPointF &p) const
constexpr qreal dy() const
Returns the vertical component of the line's vector.
constexpr QLineF()
Constructs a null line.
qreal length() const
Returns the length of the line.
IntersectionType
\typealias QLineF::IntersectType
constexpr QLineF(const QLine &line)
Construct a QLineF object from the given integer-based line.
constexpr bool operator==(const QLineF &d) const
Returns true if the given line is the same as this line.
constexpr QLineF normalVector() const
Returns a line that is perpendicular to this line with the same starting point and length.
constexpr bool operator!=(const QLineF &d) const
Returns true if the given line is not the same as this line.
constexpr QPointF center() const
void setP1(const QPointF &p1)
constexpr qreal x2() const
Returns the x-coordinate of the line's end point.
constexpr QPointF p2() const
Returns the line's end point.
constexpr QPointF pointAt(qreal t) const
Returns the point at the position specified by finite parameter t.
void setLine(qreal x1, qreal y1, qreal x2, qreal y2)
void setLength(qreal len)
Sets the length of the line to the given finite length.
constexpr qreal y1() const
Returns the y-coordinate of the line's start point.
constexpr bool operator==(const QLine &d) const noexcept
Returns true if the given line is the same as this line.
constexpr int x2() const
Returns the x-coordinate of the line's end point.
void setPoints(const QPoint &p1, const QPoint &p2)
constexpr int y2() const
Returns the y-coordinate of the line's end point.
constexpr int y1() const
Returns the y-coordinate of the line's start point.
constexpr int dx() const
Returns the horizontal component of the line's vector.
constexpr QLine()
Constructs a null line.
void setP2(const QPoint &p2)
void setLine(int x1, int y1, int x2, int y2)
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 dy() const
Returns the vertical component of the line's vector.
constexpr bool isNull() const
Returns true if the line does not have distinct start and end points; otherwise returns false.
constexpr QLine translated(const QPoint &p) const
void setP1(const QPoint &p1)
constexpr bool operator!=(const QLine &d) const noexcept
Returns true if the given line is not the same as this line.
constexpr QLineF toLineF() const noexcept
void translate(const QPoint &p)
Translates this line by the given offset.
constexpr QPoint center() const
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
Combined button and popup list for selecting options.
bool qIsFinite(qfloat16 f) noexcept
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Q_CORE_EXPORT QDebug operator<<(QDebug d, const QLine &p)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QLine &)
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLenum GLuint GLenum GLsizei length
GLfixed GLfixed GLfixed y2
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
static bool translate(xcb_connection_t *connection, xcb_window_t child, xcb_window_t parent, int *x, int *y)