diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qatomicscopedvaluerollback.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qbitarray.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qbitarray.h | 13 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 33 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.h | 8 | ||||
-rw-r--r-- | src/corelib/tools/qline.cpp | 41 | ||||
-rw-r--r-- | src/corelib/tools/qline.h | 42 | ||||
-rw-r--r-- | src/corelib/tools/qmargins.cpp | 32 | ||||
-rw-r--r-- | src/corelib/tools/qmargins.h | 49 | ||||
-rw-r--r-- | src/corelib/tools/qpoint.cpp | 47 | ||||
-rw-r--r-- | src/corelib/tools/qpoint.h | 26 | ||||
-rw-r--r-- | src/corelib/tools/qrect.cpp | 44 | ||||
-rw-r--r-- | src/corelib/tools/qrect.h | 28 | ||||
-rw-r--r-- | src/corelib/tools/qsize.cpp | 33 | ||||
-rw-r--r-- | src/corelib/tools/qsize.h | 23 | ||||
-rw-r--r-- | src/corelib/tools/qspan.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 7 | ||||
-rw-r--r-- | src/corelib/tools/qversionnumber.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qversionnumber.h | 44 |
19 files changed, 357 insertions, 140 deletions
diff --git a/src/corelib/tools/qatomicscopedvaluerollback.h b/src/corelib/tools/qatomicscopedvaluerollback.h index 41e919a3c6..8f653acba5 100644 --- a/src/corelib/tools/qatomicscopedvaluerollback.h +++ b/src/corelib/tools/qatomicscopedvaluerollback.h @@ -104,15 +104,12 @@ public: std::memory_order mo = std::memory_order_seq_cst) : QAtomicScopedValueRollback(var._q_value, value, mo) {} -#if __cpp_constexpr >= 201907L - constexpr -#endif ~QAtomicScopedValueRollback() { m_atomic.store(m_value, store_part(m_mo)); } - constexpr void commit() + void commit() { m_value = m_atomic.load(load_part(m_mo)); } diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index e311fee51f..e4276d383d 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -23,6 +23,8 @@ QT_BEGIN_NAMESPACE \ingroup shared \reentrant + \compares equality + A QBitArray is an array that gives access to individual bits and provides operators (\l{operator&()}{AND}, \l{operator|()}{OR}, \l{operator^()}{XOR}, and \l{operator~()}{NOT}) that work on @@ -499,17 +501,17 @@ quint32 QBitArray::toUInt32(QSysInfo::Endian endianness, bool *ok) const noexcep fast and never fails. */ -/*! \fn bool QBitArray::operator==(const QBitArray &other) const +/*! \fn bool QBitArray::operator==(const QBitArray &lhs, const QBitArray &rhs) - Returns \c true if \a other is equal to this bit array; otherwise + Returns \c true if \a lhs is equal to \a rhs bit array; otherwise returns \c false. \sa operator!=() */ -/*! \fn bool QBitArray::operator!=(const QBitArray &other) const +/*! \fn bool QBitArray::operator!=(const QBitArray &lhs, const QBitArray &rhs) - Returns \c true if \a other is not equal to this bit array; + Returns \c true if \a lhs is not equal to \a rhs bit array; otherwise returns \c false. \sa operator==() diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h index 4f99e693eb..b9c36b5320 100644 --- a/src/corelib/tools/qbitarray.h +++ b/src/corelib/tools/qbitarray.h @@ -116,8 +116,10 @@ public: QBitArray operator~() const; #endif - inline bool operator==(const QBitArray &other) const { return d == other.d; } - inline bool operator!=(const QBitArray &other) const { return d != other.d; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QBitArray &other) const { return comparesEqual(d, other.d); } + inline bool operator!=(const QBitArray &other) const { return !operator==(other); } +#endif bool fill(bool aval, qsizetype asize = -1) { *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; } @@ -134,6 +136,13 @@ public: typedef QByteArray::DataPointer DataPtr; inline DataPtr &data_ptr() { return d.data_ptr(); } inline const DataPtr &data_ptr() const { return d.data_ptr(); } + +private: + friend bool comparesEqual(const QBitArray &lhs, const QBitArray &rhs) noexcept + { + return lhs.d == rhs.d; + } + Q_DECLARE_EQUALITY_COMPARABLE(QBitArray) }; class QT6_ONLY(Q_CORE_EXPORT) QBitRef diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index d8b3367de3..52602a0256 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1153,32 +1153,37 @@ QEasingCurve::~QEasingCurve() */ /*! - Compare this easing curve with \a other and returns \c true if they are - equal. It will also compare the properties of a curve. + \fn bool QEasingCurve::operator==(const QEasingCurve &lhs, const QEasingCurve &rhs) + + Compares easing curve \a lhs with \a rhs and returns \c true if they are + equal; otherwise returns \c false. + It will also compare the properties of the curves. */ -bool QEasingCurve::operator==(const QEasingCurve &other) const +bool comparesEqual(const QEasingCurve &lhs, const QEasingCurve &rhs) noexcept { - bool res = d_ptr->func == other.d_ptr->func - && d_ptr->type == other.d_ptr->type; + bool res = lhs.d_ptr->func == rhs.d_ptr->func + && lhs.d_ptr->type == rhs.d_ptr->type; if (res) { - if (d_ptr->config && other.d_ptr->config) { + if (lhs.d_ptr->config && rhs.d_ptr->config) { // catch the config content - res = d_ptr->config->operator==(*(other.d_ptr->config)); + res = lhs.d_ptr->config->operator==(*(rhs.d_ptr->config)); - } else if (d_ptr->config || other.d_ptr->config) { + } else if (lhs.d_ptr->config || rhs.d_ptr->config) { // one one has a config object, which could contain default values - res = qFuzzyCompare(amplitude(), other.amplitude()) - && qFuzzyCompare(period(), other.period()) - && qFuzzyCompare(overshoot(), other.overshoot()); + res = qFuzzyCompare(lhs.amplitude(), rhs.amplitude()) + && qFuzzyCompare(lhs.period(), rhs.period()) + && qFuzzyCompare(lhs.overshoot(), rhs.overshoot()); } } return res; } /*! - \fn bool QEasingCurve::operator!=(const QEasingCurve &other) const - Compare this easing curve with \a other and returns \c true if they are not equal. - It will also compare the properties of a curve. + \fn bool QEasingCurve::operator!=(const QEasingCurve &lhs, const QEasingCurve &rhs) + + Compares easing curve \a lhs with \a rhs and returns \c true if they are + not equal; otherwise returns \c false. + It will also compare the properties of the curves. \sa operator==() */ diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index 5b112d7d7d..61e9aa247d 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -8,6 +8,7 @@ QT_REQUIRE_CONFIG(easingcurve); +#include <QtCore/qcompare.h> #include <QtCore/qlist.h> #include <QtCore/qobjectdefs.h> @@ -47,9 +48,11 @@ public: void swap(QEasingCurve &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); } +#if QT_CORE_REMOVED_SINCE(6, 8) bool operator==(const QEasingCurve &other) const; inline bool operator!=(const QEasingCurve &other) const { return !(this->operator==(other)); } +#endif qreal amplitude() const; void setAmplitude(qreal amplitude); @@ -81,6 +84,11 @@ private: friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); #endif + friend Q_CORE_EXPORT bool + comparesEqual(const QEasingCurve &lhs, const QEasingCurve &rhs) noexcept; +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_DECLARE_EQUALITY_COMPARABLE(QEasingCurve) +#endif }; Q_DECLARE_SHARED(QEasingCurve) diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index 9216b8875b..e313b06aa9 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -14,6 +14,9 @@ QT_BEGIN_NAMESPACE \class QLine \inmodule QtCore \ingroup painting + \compares equality + \compareswith equality QLineF + \endcompareswith \brief The QLine class provides a two-dimensional vector using integer precision. @@ -133,18 +136,18 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QLine::operator!=(const QLine &line) const + \fn bool QLine::operator!=(const QLine &lhs, const QLine &rhs) - Returns \c true if the given \a line is not the same as \e this line. + Returns \c true if the line \a lhs is not the same as line \a rhs. A line is different from another line if any of their start or end points differ, or the internal order of the points is different. */ /*! - \fn bool QLine::operator==(const QLine &line) const + \fn bool QLine::operator==(const QLine &lhs, const QLine &rhs) - Returns \c true if the given \a line is the same as \e this line. + Returns \c true if the line \a lhs is the same as line \a rhs. A line is identical to another line if the start and end points are identical, and the internal order of the points is the same. @@ -288,6 +291,9 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) \class QLineF \inmodule QtCore \ingroup painting + \compares equality + \compareswith equality QLine + \endcompareswith \brief The QLineF class provides a two-dimensional vector using floating point precision. @@ -508,18 +514,18 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) */ /*! - \fn bool QLineF::operator!=(const QLineF &line) const + \fn bool QLineF::operator!=(const QLineF &lhs, const QLineF &rhs) - Returns \c true if the given \a line is not the same as \e this line. + Returns \c true if the line \a lhs is not the same as line \a rhs. A line is different from another line if their start or end points differ, or the internal order of the points is different. */ /*! - \fn bool QLineF::operator==(const QLineF &line) const + \fn bool QLineF::operator==(const QLineF &lhs, const QLineF &rhs) - Returns \c true if the given \a line is the same as this line. + Returns \c true if the line \a lhs is the same as line \a rhs. A line is identical to another line if the start and end points are identical, and the internal order of the points is the same. @@ -781,6 +787,25 @@ qreal QLineF::angleTo(const QLineF &l) const return delta_normalized; } +/*! + \fn bool QLineF::qFuzzyCompare(const QLineF &lhs, const QLineF &rhs) + \since 6.8 + + Returns \c true if line \a lhs is approximately equal to line \a rhs; + otherwise returns \c false. + + The lines are considered approximately equal if their start and end + points are approximately equal. +*/ + +/*! + \fn bool QLineF::qFuzzyIsNull(const QLineF &line) + \since 6.8 + + Returns \c true if the start point of line \a line is approximately + equal to its end point; otherwise returns \c false. +*/ + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QLineF &p) { diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h index e23ffbe9d5..03dac30e16 100644 --- a/src/corelib/tools/qline.h +++ b/src/corelib/tools/qline.h @@ -48,12 +48,20 @@ public: inline void setPoints(const QPoint &p1, const QPoint &p2); inline void setLine(int x1, int y1, int x2, int y2); +#if QT_CORE_REMOVED_SINCE(6, 8) constexpr inline bool operator==(const QLine &d) const noexcept; - constexpr inline bool operator!=(const QLine &d) const noexcept { return !(*this == d); } + constexpr inline bool operator!=(const QLine &d) const noexcept { return !operator==(d); } +#endif [[nodiscard]] constexpr inline QLineF toLineF() const noexcept; private: + friend constexpr bool comparesEqual(const QLine &lhs, const QLine &rhs) noexcept + { return lhs.pt1 == rhs.pt1 && lhs.pt2 == rhs.pt2; } +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLine) +#endif + QPoint pt1, pt2; }; Q_DECLARE_TYPEINFO(QLine, Q_PRIMITIVE_TYPE); @@ -161,10 +169,12 @@ inline void QLine::setLine(int aX1, int aY1, int aX2, int aY2) pt2 = QPoint(aX2, aY2); } +#if QT_CORE_REMOVED_SINCE(6, 8) constexpr inline bool QLine::operator==(const QLine &d) const noexcept { - return pt1 == d.pt1 && pt2 == d.pt2; + return comparesEqual(*this, d); } +#endif #ifndef QT_NO_DEBUG_STREAM Q_CORE_EXPORT QDebug operator<<(QDebug d, const QLine &p); @@ -233,12 +243,30 @@ public: inline void setPoints(const QPointF &p1, const QPointF &p2); inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2); +#if QT_CORE_REMOVED_SINCE(6, 8) constexpr inline bool operator==(const QLineF &d) const; - constexpr inline bool operator!=(const QLineF &d) const { return !(*this == d); } + constexpr inline bool operator!=(const QLineF &d) const { return !operator==(d); } +#endif constexpr QLine toLine() const; private: + friend constexpr bool comparesEqual(const QLineF &lhs, const QLineF &rhs) noexcept + { return lhs.pt1 == rhs.pt1 && lhs.pt2 == rhs.pt2; } +#if !QT_CORE_REMOVED_SINCE(6, 8) + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLineF) +#endif + + friend constexpr bool comparesEqual(const QLineF &lhs, const QLine &rhs) noexcept + { return comparesEqual(lhs, rhs.toLineF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QLineF, QLine) + + friend constexpr bool qFuzzyCompare(const QLineF &lhs, const QLineF &rhs) noexcept + { return qFuzzyCompare(lhs.pt1, rhs.pt1) && qFuzzyCompare(lhs.pt2, rhs.pt2); } + + friend constexpr bool qFuzzyIsNull(const QLineF &line) noexcept + { return qFuzzyCompare(line.pt1, line.pt2); } + QPointF pt1, pt2; }; Q_DECLARE_TYPEINFO(QLineF, Q_PRIMITIVE_TYPE); @@ -283,7 +311,7 @@ constexpr inline qreal QLineF::y2() const constexpr inline bool QLineF::isNull() const { - return qFuzzyCompare(pt1.x(), pt2.x()) && qFuzzyCompare(pt1.y(), pt2.y()); + return qFuzzyCompare(pt1, pt2); } constexpr inline QPointF QLineF::p1() const @@ -383,12 +411,12 @@ inline void QLineF::setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2) pt2 = QPointF(aX2, aY2); } - +#if QT_CORE_REMOVED_SINCE(6, 8) constexpr inline bool QLineF::operator==(const QLineF &d) const { - return pt1 == d.pt1 && pt2 == d.pt2; + return comparesEqual(*this, d); } - +#endif #ifndef QT_NO_DEBUG_STREAM diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 1d2cb7d6e5..c4cd0da30d 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -14,6 +14,10 @@ QT_BEGIN_NAMESPACE \ingroup painting \since 4.6 + \compares equality + \compareswith equality QMarginsF + \endcompareswith + \brief The QMargins class defines the four margins of a rectangle. QMargin defines a set of four margins; left, top, right, and bottom, @@ -107,15 +111,15 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QMargins::operator==(const QMargins &m1, const QMargins &m2) + \fn bool QMargins::operator==(const QMargins &lhs, const QMargins &rhs) - Returns \c true if \a m1 and \a m2 are equal; otherwise returns \c false. + Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false. */ /*! - \fn bool QMargins::operator!=(const QMargins &m1, const QMargins &m2) + \fn bool QMargins::operator!=(const QMargins &lhs, const QMargins &rhs) - Returns \c true if \a m1 and \a m2 are different; otherwise returns \c false. + Returns \c true if \a lhs and \a rhs are different; otherwise returns \c false. */ /*! @@ -438,6 +442,10 @@ QDebug operator<<(QDebug dbg, const QMargins &m) \ingroup painting \since 5.3 + \compares equality + \compareswith equality QMargins + \endcompareswith + \brief The QMarginsF class defines the four margins of a rectangle. QMarginsF defines a set of four margins; left, top, right, and bottom, @@ -746,6 +754,22 @@ QDebug operator<<(QDebug dbg, const QMargins &m) \sa QMarginsF(), QMargins::toMarginsF() */ +/*! + \fn bool QMarginsF::qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs) + \since 6.8 + + Returns \c true if \a lhs is approximately equal to \a rhs; + otherwise returns \c false. +*/ + +/*! + \fn bool QMarginsF::qFuzzyIsNull(const QMarginsF &margins) + \since 6.8 + + Returns \c true if all components of margsins \a margins are + approximately equal to zero; otherwise returns \c false. +*/ + /***************************************************************************** QMarginsF stream functions *****************************************************************************/ diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h index f8d7150dfd..3b29860d66 100644 --- a/src/corelib/tools/qmargins.h +++ b/src/corelib/tools/qmargins.h @@ -4,6 +4,7 @@ #ifndef QMARGINS_H #define QMARGINS_H +#include <QtCore/qcompare.h> #include <QtCore/qnamespace.h> #include <QtCore/q20type_traits.h> @@ -54,19 +55,14 @@ private: int m_right; int m_bottom; - friend constexpr inline bool operator==(const QMargins &m1, const QMargins &m2) noexcept + friend constexpr bool comparesEqual(const QMargins &lhs, const QMargins &rhs) noexcept { - return - m1.m_left == m2.m_left && - m1.m_top == m2.m_top && - m1.m_right == m2.m_right && - m1.m_bottom == m2.m_bottom; - } - - friend constexpr inline bool operator!=(const QMargins &m1, const QMargins &m2) noexcept - { - return !(m1 == m2); + return lhs.m_left == rhs.m_left + && lhs.m_top == rhs.m_top + && lhs.m_right == rhs.m_right + && lhs.m_bottom == rhs.m_bottom; } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMargins) template <std::size_t I, typename M, @@ -304,18 +300,35 @@ private: qreal m_right; qreal m_bottom; - friend constexpr inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) noexcept + QT_WARNING_PUSH + QT_WARNING_DISABLE_FLOAT_COMPARE + friend constexpr bool qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs) noexcept { - return qFuzzyCompare(lhs.left(), rhs.left()) - && qFuzzyCompare(lhs.top(), rhs.top()) - && qFuzzyCompare(lhs.right(), rhs.right()) - && qFuzzyCompare(lhs.bottom(), rhs.bottom()); + return ((!lhs.m_left || !rhs.m_left) ? qFuzzyIsNull(lhs.m_left - rhs.m_left) + : qFuzzyCompare(lhs.m_left, rhs.m_left)) + && ((!lhs.m_top || !rhs.m_top) ? qFuzzyIsNull(lhs.m_top - rhs.m_top) + : qFuzzyCompare(lhs.m_top, rhs.m_top)) + && ((!lhs.m_right || !rhs.m_right) ? qFuzzyIsNull(lhs.m_right - rhs.m_right) + : qFuzzyCompare(lhs.m_right, rhs.m_right)) + && ((!lhs.m_bottom || !rhs.m_bottom) ? qFuzzyIsNull(lhs.m_bottom - rhs.m_bottom) + : qFuzzyCompare(lhs.m_bottom, rhs.m_bottom)); + } + QT_WARNING_POP + friend constexpr bool qFuzzyIsNull(const QMarginsF &m) noexcept + { + return qFuzzyIsNull(m.m_left) && qFuzzyIsNull(m.m_top) + && qFuzzyIsNull(m.m_right) && qFuzzyIsNull(m.m_bottom); } - friend constexpr inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) noexcept + friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMarginsF &rhs) noexcept { - return !(lhs == rhs); + return qFuzzyCompare(lhs, rhs); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMarginsF) + + friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMargins &rhs) noexcept + { return comparesEqual(lhs, rhs.toMarginsF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QMarginsF, QMargins) template <std::size_t I, typename M, diff --git a/src/corelib/tools/qpoint.cpp b/src/corelib/tools/qpoint.cpp index d1f3b12a68..775a354469 100644 --- a/src/corelib/tools/qpoint.cpp +++ b/src/corelib/tools/qpoint.cpp @@ -15,6 +15,10 @@ QT_BEGIN_NAMESPACE \ingroup painting \reentrant + \compares equality + \compareswith equality QPointF + \endcompareswith + \brief The QPoint class defines a point in the plane using integer precision. @@ -208,16 +212,17 @@ QT_BEGIN_NAMESPACE */ /*! - \fn bool QPoint::operator==(const QPoint &p1, const QPoint &p2) + \fn bool QPoint::operator==(const QPoint &lhs, const QPoint &rhs) - Returns \c true if \a p1 and \a p2 are equal; otherwise returns - false. + Returns \c true if \a lhs and \a rhs are equal; otherwise returns + \c false. */ /*! - \fn bool QPoint::operator!=(const QPoint &p1, const QPoint &p2) + \fn bool QPoint::operator!=(const QPoint &lhs, const QPoint &rhs) - Returns \c true if \a p1 and \a p2 are not equal; otherwise returns \c false. + Returns \c true if \a lhs and \a rhs are not equal; otherwise returns + \c false. */ /*! @@ -463,6 +468,10 @@ size_t qHash(QPoint key, size_t seed) noexcept \ingroup painting \reentrant + \compares equality + \compareswith equality QPoint + \endcompareswith + \brief The QPointF class defines a point in the plane using floating point precision. @@ -730,9 +739,9 @@ size_t qHash(QPoint key, size_t seed) noexcept */ /*! - \fn bool QPointF::operator==(const QPointF &p1, const QPointF &p2) + \fn bool QPointF::operator==(const QPointF &lhs, const QPointF &rhs) - Returns \c true if \a p1 is approximately equal to \a p2; otherwise + Returns \c true if \a lhs is approximately equal to \a rhs; otherwise returns \c false. \warning This function does not check for strict equality; instead, @@ -742,9 +751,9 @@ size_t qHash(QPoint key, size_t seed) noexcept */ /*! - \fn bool QPointF::operator!=(const QPointF &p1, const QPointF &p2); + \fn bool QPointF::operator!=(const QPointF &lhs, const QPointF &rhs) - Returns \c true if \a p1 is sufficiently different from \a p2; + Returns \c true if \a lhs is sufficiently different from \a rhs; otherwise returns \c false. \warning This function does not check for strict inequality; instead, @@ -753,6 +762,26 @@ size_t qHash(QPoint key, size_t seed) noexcept \sa qFuzzyCompare */ +/*! + \fn bool QPointF::qFuzzyCompare(const QPointF &p1, const QPointF &p2) + \since 6.8 + + Returns \c true if \a p1 is approximately equal to \a p2; otherwise + returns \c false. + + \sa qFuzzyIsNull +*/ + +/*! + \fn bool QPointF::qFuzzyIsNull(const QPointF &point) + \since 6.8 + + Returns \c true if \a point is approximately equal to a point + \c {(0.0, 0.0)}. + + \sa qFuzzyCompare +*/ + #ifndef QT_NO_DATASTREAM /*! \fn QDataStream &operator<<(QDataStream &stream, const QPointF &point) diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index 7df4d49005..50b4c864be 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -4,7 +4,9 @@ #ifndef QPOINT_H #define QPOINT_H +#include <QtCore/qcompare.h> #include <QtCore/qnamespace.h> +#include <QtCore/qnumeric.h> #include <QtCore/q20type_traits.h> #include <QtCore/q23utility.h> @@ -51,10 +53,10 @@ public: constexpr static inline int dotProduct(const QPoint &p1, const QPoint &p2) { return p1.xp * p2.xp + p1.yp * p2.yp; } - friend constexpr inline bool operator==(const QPoint &p1, const QPoint &p2) noexcept +private: + friend constexpr bool comparesEqual(const QPoint &p1, const QPoint &p2) noexcept { return p1.xp == p2.xp && p1.yp == p2.yp; } - friend constexpr inline bool operator!=(const QPoint &p1, const QPoint &p2) noexcept - { return p1.xp != p2.xp || p1.yp != p2.yp; } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPoint) friend constexpr inline QPoint operator+(const QPoint &p1, const QPoint &p2) noexcept { return QPoint(p1.xp + p2.xp, p1.yp + p2.yp); } friend constexpr inline QPoint operator-(const QPoint &p1, const QPoint &p2) noexcept @@ -78,6 +80,7 @@ public: friend constexpr inline QPoint operator/(const QPoint &p, qreal c) { return QPoint(qRound(p.xp / c), qRound(p.yp / c)); } +public: #if defined(Q_OS_DARWIN) || defined(Q_QDOC) [[nodiscard]] Q_CORE_EXPORT CGPoint toCGPoint() const noexcept; #endif @@ -241,19 +244,25 @@ public: return p1.xp * p2.xp + p1.yp * p2.yp; } +private: QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE - friend constexpr inline bool operator==(const QPointF &p1, const QPointF &p2) + friend constexpr bool qFuzzyCompare(const QPointF &p1, const QPointF &p2) noexcept { return ((!p1.xp || !p2.xp) ? qFuzzyIsNull(p1.xp - p2.xp) : qFuzzyCompare(p1.xp, p2.xp)) && ((!p1.yp || !p2.yp) ? qFuzzyIsNull(p1.yp - p2.yp) : qFuzzyCompare(p1.yp, p2.yp)); } - friend constexpr inline bool operator!=(const QPointF &p1, const QPointF &p2) + QT_WARNING_POP + friend constexpr bool qFuzzyIsNull(const QPointF &point) noexcept { - return !(p1 == p2); + return qFuzzyIsNull(point.xp) && qFuzzyIsNull(point.yp); } - QT_WARNING_POP - + friend constexpr bool comparesEqual(const QPointF &p1, const QPointF &p2) noexcept + { return qFuzzyCompare(p1, p2); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPointF) + friend constexpr bool comparesEqual(const QPointF &p1, const QPoint &p2) noexcept + { return comparesEqual(p1, p2.toPointF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QPointF, QPoint) friend constexpr inline QPointF operator+(const QPointF &p1, const QPointF &p2) { return QPointF(p1.xp + p2.xp, p1.yp + p2.yp); } friend constexpr inline QPointF operator-(const QPointF &p1, const QPointF &p2) @@ -272,6 +281,7 @@ public: return QPointF(p.xp / divisor, p.yp / divisor); } +public: constexpr QPoint toPoint() const; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 6d345ce543..ce28a6d887 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -15,6 +15,10 @@ QT_BEGIN_NAMESPACE \ingroup painting \reentrant + \compares equality + \compareswith equality QRectF + \endcompareswith + \brief The QRect class defines a rectangle in the plane using integer precision. @@ -1105,18 +1109,18 @@ bool QRect::intersects(const QRect &r) const noexcept } /*! - \fn bool QRect::operator==(const QRect &r1, const QRect &r2) + \fn bool QRect::operator==(const QRect &lhs, const QRect &rhs) - Returns \c true if the rectangles \a r1 and \a r2 are equal, + Returns \c true if the rectangles \a lhs and \a rhs are equal, otherwise returns \c false. */ /*! - \fn bool QRect::operator!=(const QRect &r1, const QRect &r2) + \fn bool QRect::operator!=(const QRect &lhs, const QRect &rhs) - Returns \c true if the rectangles \a r1 and \a r2 are different, otherwise - returns \c false. + Returns \c true if the rectangles \a lhs and \a rhs are different, + otherwise returns \c false. */ /*! @@ -1279,6 +1283,10 @@ QDebug operator<<(QDebug dbg, const QRect &r) \ingroup painting \reentrant + \compares equality + \compareswith equality QRect + \endcompareswith + \brief The QRectF class defines a finite rectangle in the plane using floating point precision. @@ -2346,10 +2354,10 @@ QRect QRectF::toAlignedRect() const noexcept */ /*! - \fn bool QRectF::operator==(const QRectF &r1, const QRectF &r2) + \fn bool QRectF::operator==(const QRectF &lhs, const QRectF &rhs) - Returns \c true if the rectangles \a r1 and \a r2 are \b approximately equal, - otherwise returns \c false. + Returns \c true if the rectangles \a lhs and \a rhs are \b approximately + equal, otherwise returns \c false. \warning This function does not check for strict equality; instead, it uses a fuzzy comparison to compare the rectangles' coordinates. @@ -2359,9 +2367,9 @@ QRect QRectF::toAlignedRect() const noexcept /*! - \fn bool QRectF::operator!=(const QRectF &r1, const QRectF &r2) + \fn bool QRectF::operator!=(const QRectF &lhs, const QRectF &rhs) - Returns \c true if the rectangles \a r1 and \a r2 are sufficiently + Returns \c true if the rectangles \a lhs and \a rhs are sufficiently different, otherwise returns \c false. \warning This function does not check for strict inequality; instead, @@ -2429,6 +2437,22 @@ QRect QRectF::toAlignedRect() const noexcept \sa marginsRemoved(), operator+=(), marginsAdded() */ +/*! + \fn bool QRectF::qFuzzyCompare(const QRectF &lhs, const QRectF &rhs) + \since 6.8 + + Returns \c true if the rectangle \a lhs is approximately equal to the + rectangle \a rhs; otherwise returns \c false. +*/ + +/*! + \fn bool QRectF::qFuzzyIsNull(const QRectF &rect) + \since 6.8 + + Returns \c true if both width and height of the rectangle \a rect are + approximately equal to zero; otherwise returns \c false. +*/ + /***************************************************************************** QRectF stream functions *****************************************************************************/ diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index e69a217f48..fb938b0056 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -119,12 +119,13 @@ public: [[nodiscard]] static constexpr inline QRect span(const QPoint &p1, const QPoint &p2) noexcept; - friend constexpr inline bool operator==(const QRect &r1, const QRect &r2) noexcept +private: + friend constexpr bool comparesEqual(const QRect &r1, const QRect &r2) noexcept { return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; } - friend constexpr inline bool operator!=(const QRect &r1, const QRect &r2) noexcept - { return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2; } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRect) friend constexpr inline size_t qHash(const QRect &, size_t) noexcept; +public: #if defined(Q_OS_DARWIN) || defined(Q_QDOC) [[nodiscard]] CGRect toCGRect() const noexcept; #endif @@ -572,17 +573,30 @@ public: constexpr inline QRectF &operator+=(const QMarginsF &margins) noexcept; constexpr inline QRectF &operator-=(const QMarginsF &margins) noexcept; - friend constexpr inline bool operator==(const QRectF &r1, const QRectF &r2) noexcept +private: + friend constexpr bool comparesEqual(const QRectF &r1, const QRectF &r2) noexcept { return r1.topLeft() == r2.topLeft() && r1.size() == r2.size(); } - friend constexpr inline bool operator!=(const QRectF &r1, const QRectF &r2) noexcept + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF) + + friend constexpr bool comparesEqual(const QRectF &r1, const QRect &r2) noexcept + { return r1.topLeft() == r2.topLeft() && r1.size() == r2.size(); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF, QRect) + + friend constexpr bool qFuzzyCompare(const QRectF &lhs, const QRectF &rhs) noexcept { - return r1.topLeft() != r2.topLeft() - || r1.size() != r2.size(); + return qFuzzyCompare(lhs.topLeft(), rhs.topLeft()) + && qFuzzyCompare(lhs.bottomRight(), rhs.bottomRight()); } + friend constexpr bool qFuzzyIsNull(const QRectF &rect) noexcept + { + return qFuzzyIsNull(rect.w) && qFuzzyIsNull(rect.h); + } + +public: [[nodiscard]] constexpr inline QRect toRect() const noexcept; [[nodiscard]] QRect toAlignedRect() const noexcept; diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp index d5e8e4c71b..27ff1d164d 100644 --- a/src/corelib/tools/qsize.cpp +++ b/src/corelib/tools/qsize.cpp @@ -266,15 +266,15 @@ QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept */ /*! - \fn bool QSize::operator==(const QSize &s1, const QSize &s2) + \fn bool QSize::operator==(const QSize &lhs, const QSize &rhs) - Returns \c true if \a s1 and \a s2 are equal; otherwise returns \c false. + Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false. */ /*! - \fn bool QSize::operator!=(const QSize &s1, const QSize &s2) + \fn bool QSize::operator!=(const QSize &lhs, const QSize &rhs) - Returns \c true if \a s1 and \a s2 are different; otherwise returns \c false. + Returns \c true if \a lhs and \a rhs are different; otherwise returns \c false. */ /*! @@ -714,9 +714,9 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept */ /*! - \fn bool QSizeF::operator==(const QSizeF &s1, const QSizeF &s2) + \fn bool QSizeF::operator==(const QSizeF &lhs, const QSizeF &rhs) - Returns \c true if \a s1 and \a s2 are approximately equal; otherwise + Returns \c true if \a lhs and \a rhs are approximately equal; otherwise returns false. \warning This function does not check for strict equality; instead, @@ -726,9 +726,9 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept */ /*! - \fn bool QSizeF::operator!=(const QSizeF &s1, const QSizeF &s2) + \fn bool QSizeF::operator!=(const QSizeF &lhs, const QSizeF &rhs) - Returns \c true if \a s1 and \a s2 are sufficiently different; otherwise + Returns \c true if \a lhs and \a rhs are sufficiently different; otherwise returns \c false. \warning This function does not check for strict inequality; instead, @@ -808,7 +808,24 @@ QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept \sa expandedTo(), scale() */ +/*! + \fn bool QSizeF::qFuzzyCompare(const QSizeF &lhs, const QSizeF &rhs) + \since 6.8 + + Returns \c true if the size \a lhs is approximately equal to the + size \a rhs; otherwise returns \c false. + + The sizes are considered approximately equal if their width and + height are approximately equal. +*/ +/*! + \fn bool QSizeF::qFuzzyIsNull(const QSizeF &size) + \since 6.8 + + Returns \c true if both width and height of the size \a size + are approximately equal to zero. +*/ /***************************************************************************** QSizeF stream functions diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h index a5eaf34afe..67f7146201 100644 --- a/src/corelib/tools/qsize.h +++ b/src/corelib/tools/qsize.h @@ -59,10 +59,10 @@ public: constexpr inline QSize &operator*=(qreal c) noexcept; inline QSize &operator/=(qreal c); - friend inline constexpr bool operator==(const QSize &s1, const QSize &s2) noexcept +private: + friend constexpr bool comparesEqual(const QSize &s1, const QSize &s2) noexcept { return s1.wd == s2.wd && s1.ht == s2.ht; } - friend inline constexpr bool operator!=(const QSize &s1, const QSize &s2) noexcept - { return s1.wd != s2.wd || s1.ht != s2.ht; } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSize) friend inline constexpr QSize operator+(const QSize &s1, const QSize &s2) noexcept { return QSize(s1.wd + s2.wd, s1.ht + s2.ht); } friend inline constexpr QSize operator-(const QSize &s1, const QSize &s2) noexcept @@ -75,6 +75,7 @@ public: { Q_ASSERT(!qFuzzyIsNull(c)); return QSize(qRound(s.wd / c), qRound(s.ht / c)); } friend inline constexpr size_t qHash(const QSize &, size_t) noexcept; +public: #if defined(Q_OS_DARWIN) || defined(Q_QDOC) [[nodiscard]] CGSize toCGSize() const noexcept; #endif @@ -242,16 +243,25 @@ public: constexpr inline QSizeF &operator*=(qreal c) noexcept; inline QSizeF &operator/=(qreal c); +private: QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE - friend constexpr inline bool operator==(const QSizeF &s1, const QSizeF &s2) + friend constexpr bool qFuzzyCompare(const QSizeF &s1, const QSizeF &s2) noexcept { + // Cannot use qFuzzyCompare(), because it will give incorrect results + // if one of the arguments is 0.0. return ((!s1.wd || !s2.wd) ? qFuzzyIsNull(s1.wd - s2.wd) : qFuzzyCompare(s1.wd, s2.wd)) && ((!s1.ht || !s2.ht) ? qFuzzyIsNull(s1.ht - s2.ht) : qFuzzyCompare(s1.ht, s2.ht)); } QT_WARNING_POP - friend constexpr inline bool operator!=(const QSizeF &s1, const QSizeF &s2) - { return !(s1 == s2); } + friend constexpr bool qFuzzyIsNull(const QSizeF &size) noexcept + { return qFuzzyIsNull(size.wd) && qFuzzyIsNull(size.ht); } + friend constexpr bool comparesEqual(const QSizeF &lhs, const QSizeF &rhs) noexcept + { return qFuzzyCompare(lhs, rhs); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSizeF) + friend constexpr bool comparesEqual(const QSizeF &lhs, const QSize &rhs) noexcept + { return comparesEqual(lhs, rhs.toSizeF()); } + Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QSizeF, QSize) friend constexpr inline QSizeF operator+(const QSizeF &s1, const QSizeF &s2) noexcept { return QSizeF(s1.wd + s2.wd, s1.ht + s2.ht); } friend constexpr inline QSizeF operator-(const QSizeF &s1, const QSizeF &s2) noexcept @@ -263,6 +273,7 @@ public: friend inline QSizeF operator/(const QSizeF &s, qreal c) { Q_ASSERT(!qFuzzyIsNull(c)); return QSizeF(s.wd / c, s.ht / c); } +public: constexpr inline QSize toSize() const noexcept; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) diff --git a/src/corelib/tools/qspan.qdoc b/src/corelib/tools/qspan.qdoc index 472f122877..6aaa386caf 100644 --- a/src/corelib/tools/qspan.qdoc +++ b/src/corelib/tools/qspan.qdoc @@ -556,7 +556,6 @@ \sa subspan(QSpan<T,E>::size_type), subspan(), first(), last() */ -#if 0 // needs fix for QTBUG-118080 integrated into qt5.git /*! \fn template <typename T, size_t E> template <std::size_t Offset, std::size_t Count> auto QSpan<T, E>::subspan() const \keyword subspan-t2 @@ -573,7 +572,6 @@ \sa subspan(QSpan<T,E>::size_type, QSpan<T,E>::size_type), subspan(), first(), last() */ -#endif // // runtime subspans: diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index afc345d3be..0a579bf487 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -956,8 +956,8 @@ Q_OUTOFLINE_TEMPLATE auto QVLABase<T>::insert_impl(qsizetype prealloc, void *arr template <class T> Q_OUTOFLINE_TEMPLATE auto QVLABase<T>::erase(const_iterator abegin, const_iterator aend) -> iterator { - Q_ASSERT_X(isValidIterator(abegin), "QVarLengthArray::insert", "The specified const_iterator argument 'abegin' is invalid"); - Q_ASSERT_X(isValidIterator(aend), "QVarLengthArray::insert", "The specified const_iterator argument 'aend' is invalid"); + Q_ASSERT_X(isValidIterator(abegin), "QVarLengthArray::erase", "The specified const_iterator argument 'abegin' is invalid"); + Q_ASSERT_X(isValidIterator(aend), "QVarLengthArray::erase", "The specified const_iterator argument 'aend' is invalid"); qsizetype f = qsizetype(abegin - cbegin()); qsizetype l = qsizetype(aend - cbegin()); @@ -968,10 +968,11 @@ Q_OUTOFLINE_TEMPLATE auto QVLABase<T>::erase(const_iterator abegin, const_iterat Q_ASSERT(n > 0); // aend must be reachable from abegin - if constexpr (QTypeInfo<T>::isComplex) { + if constexpr (!QTypeInfo<T>::isRelocatable) { std::move(begin() + l, end(), QT_MAKE_CHECKED_ARRAY_ITERATOR(begin() + f, size() - f)); std::destroy(end() - n, end()); } else { + std::destroy(abegin, aend); memmove(static_cast<void *>(data() + f), static_cast<const void *>(data() + l), (size() - l) * sizeof(T)); } this->s -= n; diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp index 84bce0cfd4..af95875b44 100644 --- a/src/corelib/tools/qversionnumber.cpp +++ b/src/corelib/tools/qversionnumber.cpp @@ -30,6 +30,7 @@ QT_IMPL_METATYPE_EXTERN(QVersionNumber) \brief The QVersionNumber class contains a version number with an arbitrary number of segments. + \compares strong \snippet qversionnumber/main.cpp 0 */ @@ -81,10 +82,13 @@ QT_IMPL_METATYPE_EXTERN(QVersionNumber) */ /*! - \fn template <qsizetype N> QVersionNumber::QVersionNumber(const QVarLengthArray<int, N> &seg) - \since 6.4 + \fn QVersionNumber::QVersionNumber(QSpan<const int> args) + \since 6.8 - Constructs a version number from the list of numbers contained in \a seg. + Constructs a version number from the span specified by \a args. + + \note In Qt versions prior to 6.8, QVersionNumber could only be constructed + from QList, QVarLenthArray or std::initializer_list. */ /*! diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index 80cf7428c9..e7ae107226 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -6,10 +6,12 @@ #ifndef QVERSIONNUMBER_H #define QVERSIONNUMBER_H +#include <QtCore/qcompare.h> #include <QtCore/qcontainertools_impl.h> #include <QtCore/qlist.h> #include <QtCore/qmetatype.h> #include <QtCore/qnamespace.h> +#include <QtCore/qspan.h> #include <QtCore/qstring.h> #include <QtCore/qtypeinfo.h> #if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 2 @@ -113,7 +115,7 @@ class QVersionNumber Q_CORE_EXPORT void setListData(QList<int> &&seg); - explicit SegmentStorage(std::initializer_list<int> args) + explicit SegmentStorage(QSpan<const int> args) : SegmentStorage(args.begin(), args.end()) {} explicit SegmentStorage(const int *first, const int *last) @@ -256,19 +258,20 @@ public: inline QVersionNumber() noexcept : m_segments() {} + Q_WEAK_OVERLOAD inline explicit QVersionNumber(const QList<int> &seg) : m_segments(seg) { } // compiler-generated copy/move ctor/assignment operators and the destructor are ok + Q_WEAK_OVERLOAD explicit QVersionNumber(QList<int> &&seg) : m_segments(std::move(seg)) { } inline QVersionNumber(std::initializer_list<int> args) - : m_segments(args) + : m_segments(QSpan{args}) {} - template <qsizetype N> - explicit QVersionNumber(const QVarLengthArray<int, N> &sec) - : m_segments(sec.begin(), sec.end()) + explicit QVersionNumber(QSpan<const int> args) + : m_segments(args) {} inline explicit QVersionNumber(int maj) @@ -353,25 +356,20 @@ public: [[nodiscard]] Q_CORE_EXPORT static QVersionNumber fromString(QStringView string, int *suffixIndex); #endif - [[nodiscard]] friend bool operator> (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept - { return compare(lhs, rhs) > 0; } - - [[nodiscard]] friend bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept - { return compare(lhs, rhs) >= 0; } - - [[nodiscard]] friend bool operator< (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept - { return compare(lhs, rhs) < 0; } - - [[nodiscard]] friend bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept - { return compare(lhs, rhs) <= 0; } - - [[nodiscard]] friend bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept - { return compare(lhs, rhs) == 0; } - - [[nodiscard]] friend bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept - { return compare(lhs, rhs) != 0; } - private: + [[nodiscard]] friend bool comparesEqual(const QVersionNumber &lhs, + const QVersionNumber &rhs) noexcept + { + return compare(lhs, rhs) == 0; + } + [[nodiscard]] friend Qt::strong_ordering compareThreeWay(const QVersionNumber &lhs, + const QVersionNumber &rhs) noexcept + { + int c = compare(lhs, rhs); + return Qt::compareThreeWay(c, 0); + } + Q_DECLARE_STRONGLY_ORDERED(QVersionNumber) + #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QVersionNumber &version); #endif |