7#include <QtCore/qcompare.h>
8#include <QtCore/qnamespace.h>
9#include <QtCore/qnumeric.h>
11#include <QtCore/q20type_traits.h>
12#include <QtCore/q23utility.h>
14#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
20QT_ENABLE_P0846_SEMANTICS_FOR(
get)
27 constexpr QPoint()
noexcept;
28 constexpr QPoint(
int xpos,
int ypos)
noexcept;
30 constexpr inline bool isNull()
const noexcept;
32 constexpr inline int x()
const noexcept;
33 constexpr inline int y()
const noexcept;
34 constexpr inline void setX(
int x)
noexcept;
35 constexpr inline void setY(
int y)
noexcept;
41 constexpr inline int &
rx() noexcept;
42 constexpr inline
int &
ry() noexcept;
47 constexpr inline
QPoint &operator*=(
float factor);
48 constexpr inline
QPoint &operator*=(
double factor);
49 constexpr inline
QPoint &operator*=(
int factor);
54 {
return p1.xp *
p2.xp +
p1.yp *
p2.yp; }
58 {
return p1.xp ==
p2.xp &&
p1.yp ==
p2.yp; }
69 {
return QPoint(
p.xp * factor,
p.yp * factor); }
75 {
return QPoint(
p.xp * factor,
p.yp * factor); }
84#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
85 [[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept;
94 template <
std::
size_t I,
96 std::enable_if_t<(I < 2),
bool> = true,
97 std::enable_if_t<
std::is_same_v<
q20::remove_cvref_t<P>,
QPoint>,
bool> = true>
98 friend constexpr decltype(auto)
get(P &&
p) noexcept
100 if constexpr (I == 0)
101 return q23::forward_like<P>(
p.xp);
102 else if constexpr (I == 1)
103 return q23::forward_like<P>(
p.yp);
112#ifndef QT_NO_DATASTREAM
123constexpr inline QPoint::QPoint(
int xpos,
int ypos) noexcept : xp(xpos), yp(ypos) {}
127 return xp == 0 && yp == 0;
207#ifndef QT_NO_DEBUG_STREAM
223 constexpr inline qreal manhattanLength()
const;
225 inline bool isNull()
const noexcept;
227 constexpr inline qreal x()
const noexcept;
228 constexpr inline qreal y()
const noexcept;
230 constexpr inline void setY(
qreal y)
noexcept;
234 constexpr inline qreal &
rx() noexcept;
235 constexpr inline
qreal &
ry() noexcept;
244 return p1.xp *
p2.xp +
p1.yp *
p2.yp;
280 Q_ASSERT(divisor < 0 || divisor > 0);
285 constexpr QPoint toPoint()
const;
287#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
288 [[nodiscard]] Q_CORE_EXPORT
static QPointF fromCGPoint(CGPoint point)
noexcept;
289 [[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept;
298 template <std::size_t I,
300 std::enable_if_t<(I < 2), bool> =
true,
301 std::enable_if_t<std::is_same_v<q20::remove_cvref_t<P>,
QPointF>,
bool> =
true>
302 friend constexpr decltype(
auto)
get(P &&
p)
noexcept
304 if constexpr (I == 0)
305 return q23::forward_like<P>(
p.xp);
306 else if constexpr (I == 1)
307 return q23::forward_like<P>(
p.yp);
318#ifndef QT_NO_DATASTREAM
409#ifndef QT_NO_DEBUG_STREAM
421 class tuple_size<QT_PREPEND_NAMESPACE(
QPoint)> :
public integral_constant<size_t, 2> {};
423 class tuple_element<0, QT_PREPEND_NAMESPACE(
QPoint)> {
public:
using type = int; };
425 class tuple_element<1, QT_PREPEND_NAMESPACE(
QPoint)> {
public:
using type = int; };
428 class tuple_size<QT_PREPEND_NAMESPACE(
QPointF)> :
public integral_constant<size_t, 2> {};
430 class tuple_element<0, QT_PREPEND_NAMESPACE(
QPointF)> {
public:
using type = QT_PREPEND_NAMESPACE(
qreal); };
432 class tuple_element<1, QT_PREPEND_NAMESPACE(
QPointF)> {
public:
using type = QT_PREPEND_NAMESPACE(
qreal); };
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE friend constexpr bool qFuzzyCompare(const QPointF &p1, const QPointF &p2) noexcept
friend constexpr QPointF operator+(const QPointF &p)
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
friend constexpr bool comparesEqual(const QPointF &p1, const QPointF &p2) noexcept
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...
QT_WARNING_POP friend constexpr bool qFuzzyIsNull(const QPointF &point) noexcept
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...
\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.
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 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...
constexpr QPoint() noexcept
Constructs a null point, i.e.
friend constexpr bool comparesEqual(const QPoint &p1, const QPoint &p2) noexcept
QT_PREPEND_NAMESPACE(qreal) type
QT_PREPEND_NAMESPACE(qreal) type
Combined button and popup list for selecting options.
#define Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(...)
#define QT_WARNING_DISABLE_FLOAT_COMPARE
static QDBusError::ErrorType get(const char *name)
bool comparesEqual(const QDir &lhs, const QDir &rhs)
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)