7#include <QtCore/qnamespace.h>
9#include <QtCore/q20type_traits.h>
10#include <QtCore/q23utility.h>
12#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
18QT_ENABLE_P0846_SEMANTICS_FOR(
get)
25 constexpr QPoint()
noexcept;
26 constexpr QPoint(
int xpos,
int ypos)
noexcept;
28 constexpr inline bool isNull()
const noexcept;
30 constexpr inline int x()
const noexcept;
31 constexpr inline int y()
const noexcept;
32 constexpr inline void setX(
int x)
noexcept;
33 constexpr inline void setY(
int y)
noexcept;
39 constexpr inline int &
rx() noexcept;
40 constexpr inline
int &
ry() noexcept;
45 constexpr inline
QPoint &operator*=(
float factor);
46 constexpr inline
QPoint &operator*=(
double factor);
47 constexpr inline
QPoint &operator*=(
int factor);
52 {
return p1.xp *
p2.xp +
p1.yp *
p2.yp; }
55 {
return p1.xp ==
p2.xp &&
p1.yp ==
p2.yp; }
57 {
return p1.xp !=
p2.xp ||
p1.yp !=
p2.yp; }
67 {
return QPoint(
p.xp * factor,
p.yp * factor); }
73 {
return QPoint(
p.xp * factor,
p.yp * factor); }
81#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
82 [[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept;
91 template <
std::
size_t I,
93 std::enable_if_t<(I < 2),
bool> = true,
94 std::enable_if_t<
std::is_same_v<
q20::remove_cvref_t<P>,
QPoint>,
bool> = true>
95 friend constexpr decltype(auto)
get(P &&
p) noexcept
98 return q23::forward_like<P>(
p.xp);
99 else if constexpr (I == 1)
100 return q23::forward_like<P>(
p.yp);
109#ifndef QT_NO_DATASTREAM
120constexpr inline QPoint::QPoint(
int xpos,
int ypos) noexcept : xp(xpos), yp(ypos) {}
124 return xp == 0 && yp == 0;
204#ifndef QT_NO_DEBUG_STREAM
220 constexpr inline qreal manhattanLength()
const;
222 inline bool isNull()
const noexcept;
224 constexpr inline qreal x()
const noexcept;
225 constexpr inline qreal y()
const noexcept;
227 constexpr inline void setY(
qreal y)
noexcept;
231 constexpr inline qreal &
rx() noexcept;
232 constexpr inline
qreal &
ry() noexcept;
241 return p1.xp *
p2.xp +
p1.yp *
p2.yp;
271 Q_ASSERT(divisor < 0 || divisor > 0);
275 constexpr QPoint toPoint()
const;
277#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
278 [[nodiscard]] Q_CORE_EXPORT
static QPointF fromCGPoint(CGPoint point)
noexcept;
279 [[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept;
288 template <std::size_t I,
290 std::enable_if_t<(I < 2), bool> =
true,
291 std::enable_if_t<std::is_same_v<q20::remove_cvref_t<P>,
QPointF>,
bool> =
true>
292 friend constexpr decltype(
auto)
get(P &&
p)
noexcept
294 if constexpr (I == 0)
295 return q23::forward_like<P>(
p.xp);
296 else if constexpr (I == 1)
297 return q23::forward_like<P>(
p.yp);
308#ifndef QT_NO_DATASTREAM
399#ifndef QT_NO_DEBUG_STREAM
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
friend constexpr QPointF operator+(const QPointF &p)
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE friend constexpr bool operator==(const QPointF &p1, const QPointF &p2)
Returns true if p1 is approximately equal to p2; otherwise returns false.
constexpr qreal & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal manhattanLength() const
QT_WARNING_POP friend constexpr QPointF operator+(const QPointF &p1, const QPointF &p2)
Returns a QPointF object that is the sum of the given points, p1 and p2; each component is added sepa...
friend constexpr QPointF operator/(const QPointF &p, qreal divisor)
Returns the QPointF object formed by dividing each component of the given point by the given divisor.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
friend constexpr QPointF operator-(const QPointF &p1, const QPointF &p2)
Returns a QPointF object that is formed by subtracting p2 from p1; each component is subtracted separ...
constexpr QPointF & operator+=(const QPointF &p)
Adds the given point to this point and returns a reference to this point.
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr QPointF & operator*=(qreal c)
Multiplies this point's coordinates by the given finite factor, and returns a reference to this point...
friend constexpr QPointF operator-(const QPointF &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr QPointF operator*(const QPointF &p, qreal c)
Returns a copy of the given point, multiplied by the given finite factor.
friend constexpr QPointF operator*(qreal c, const QPointF &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr QPointF & operator-=(const QPointF &p)
Subtracts the given point from this point and returns a reference to this point.
constexpr QPointF() noexcept
Constructs a null point, i.e.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
friend constexpr decltype(auto) get(P &&p) noexcept
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
constexpr QPointF & operator/=(qreal c)
Divides both x and y by the given divisor, and returns a reference to this point.
constexpr QPointF transposed() const noexcept
bool isNull() const noexcept
Returns true if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns fa...
friend constexpr bool operator!=(const QPointF &p1, const QPointF &p2)
Returns true if p1 is sufficiently different from p2; otherwise returns false.
\inmodule QtCore\reentrant
friend constexpr QPoint operator+(const QPoint &p) noexcept
constexpr bool isNull() const noexcept
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
friend constexpr QPoint operator+(const QPoint &p1, const QPoint &p2) noexcept
Returns a QPoint object that is the sum of the given points, p1 and p2; each component is added separ...
constexpr int & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr QPoint transposed() const noexcept
constexpr QPointF toPointF() const noexcept
friend constexpr QPoint operator*(const QPoint &p, double factor)
Returns a copy of the given point multiplied by the given factor.
friend constexpr QPoint operator*(double factor, const QPoint &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr QPoint operator/(const QPoint &p, qreal c)
Returns the QPoint formed by dividing both components of the given point by the given divisor.
constexpr int & rx() noexcept
Returns a reference to the x coordinate of this point.
friend constexpr QPoint operator*(const QPoint &p, int factor) noexcept
Returns a copy of the given point multiplied by the given factor.
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr void setY(int y) noexcept
Sets the y coordinate of this point to the given y coordinate.
constexpr QPoint & operator+=(const QPoint &p)
Adds the given point to this point and returns a reference to this point.
constexpr int manhattanLength() const
Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" ...
friend constexpr QPoint operator*(const QPoint &p, float factor)
Returns a copy of the given point multiplied by the given factor.
constexpr int y() const noexcept
Returns the y coordinate of this point.
friend constexpr QPoint operator-(const QPoint &p1, const QPoint &p2) noexcept
Returns a QPoint object that is formed by subtracting p2 from p1; each component is subtracted separa...
friend constexpr bool operator!=(const QPoint &p1, const QPoint &p2) noexcept
Returns true if p1 and p2 are not equal; otherwise returns false.
friend constexpr QPoint operator*(float factor, const QPoint &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr QPoint operator-(const QPoint &p) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr QPoint operator*(int factor, const QPoint &p) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr void setX(int x) noexcept
Sets the x coordinate of this point to the given x coordinate.
friend constexpr decltype(auto) get(P &&p) noexcept
constexpr QPoint & operator*=(float factor)
Multiplies this point's coordinates by the given factor, and returns a reference to this point.
constexpr QPoint & operator-=(const QPoint &p)
Subtracts the given point from this point and returns a reference to this point.
constexpr QPoint & operator/=(qreal divisor)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr bool operator==(const QPoint &p1, const QPoint &p2) noexcept
Returns true if p1 and p2 are equal; otherwise returns false.
constexpr QPoint() noexcept
Constructs a null point, i.e.
QT_PREPEND_NAMESPACE(qreal) type
QT_PREPEND_NAMESPACE(qreal) type
Combined button and popup list for selecting options.
#define QT_WARNING_DISABLE_FLOAT_COMPARE
static QDBusError::ErrorType get(const char *name)
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
bool qIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr T qAbs(const T &t)
GLint GLint GLint GLint GLint x
[0]
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, const QPoint &)
Q_CORE_EXPORT size_t qHash(QPoint key, size_t seed=0) noexcept
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QPoint &)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId