summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qcompare.cpp52
-rw-r--r--src/corelib/global/qcompare.h10
-rw-r--r--tests/auto/corelib/global/qcompare/tst_qcompare.cpp5
3 files changed, 55 insertions, 12 deletions
diff --git a/src/corelib/global/qcompare.cpp b/src/corelib/global/qcompare.cpp
index 91124c3d7d..87595eb1d1 100644
--- a/src/corelib/global/qcompare.cpp
+++ b/src/corelib/global/qcompare.cpp
@@ -652,10 +652,10 @@ CHECK(strong, equivalent);
represented by the following four symbolic constants:
\list
- \li \c Less represents that the left operand is less than the right;
- \li \c Equivalent represents that left operand is equivalent to the right;
- \li \c Greater represents that the left operand is greater than the right;
- \li \c Unordered represents that the left operand is \e {not ordered} with
+ \li \c less represents that the left operand is less than the right;
+ \li \c equivalent represents that left operand is equivalent to the right;
+ \li \c greater represents that the left operand is greater than the right;
+ \li \c unordered represents that the left operand is \e {not ordered} with
respect to the right operand.
\endlist
@@ -692,10 +692,10 @@ CHECK(strong, equivalent);
rules:
\list
- \li std::partial_ordering::less converts to \l Less.
- \li std::partial_ordering::equivalent converts to \l Equivalent.
- \li std::partial_ordering::greater converts to \l Greater.
- \li std::partial_ordering::unordered converts to \l Unordered
+ \li std::partial_ordering::less converts to \l less.
+ \li std::partial_ordering::equivalent converts to \l equivalent.
+ \li std::partial_ordering::greater converts to \l greater.
+ \li std::partial_ordering::unordered converts to \l unordered
\endlist
*/
@@ -706,10 +706,10 @@ CHECK(strong, equivalent);
the following rules:
\list
- \li \l Less converts to std::partial_ordering::less.
- \li \l Equivalent converts to std::partial_ordering::equivalent.
- \li \l Greater converts to std::partial_ordering::greater.
- \li \l Unordered converts to std::partial_ordering::unordered.
+ \li \l less converts to std::partial_ordering::less.
+ \li \l equivalent converts to std::partial_ordering::equivalent.
+ \li \l greater converts to std::partial_ordering::greater.
+ \li \l unordered converts to std::partial_ordering::unordered.
\endlist
*/
@@ -760,6 +760,34 @@ CHECK(strong, equivalent);
*/
/*!
+ \variable QPartialOrdering::less
+
+ Represents the result of a comparison where the left operand is less than
+ the right operand.
+*/
+
+/*!
+ \variable QPartialOrdering::equivalent
+
+ Represents the result of a comparison where the left operand is equivalent
+ to the right operand.
+*/
+
+/*!
+ \variable QPartialOrdering::greater
+
+ Represents the result of a comparison where the left operand is greater
+ than the right operand.
+*/
+
+/*!
+ \variable QPartialOrdering::unordered
+
+ Represents the result of a comparison where the left operand is not ordered
+ with respect to the right operand.
+*/
+
+/*!
\variable QPartialOrdering::Less
Represents the result of a comparison where the left operand is less than
diff --git a/src/corelib/global/qcompare.h b/src/corelib/global/qcompare.h
index f7fa7c65a7..35123dcb36 100644
--- a/src/corelib/global/qcompare.h
+++ b/src/corelib/global/qcompare.h
@@ -644,6 +644,11 @@ public:
static const QPartialOrdering Greater;
static const QPartialOrdering Unordered;
+ static const QPartialOrdering less;
+ static const QPartialOrdering equivalent;
+ static const QPartialOrdering greater;
+ static const QPartialOrdering unordered;
+
friend constexpr bool operator==(QPartialOrdering lhs,
QtPrivate::CompareAgainstLiteralZero) noexcept
{ return lhs.isOrdered() && lhs.m_order == 0; }
@@ -826,6 +831,11 @@ inline constexpr QPartialOrdering QPartialOrdering::Equivalent(QtPrivate::Orderi
inline constexpr QPartialOrdering QPartialOrdering::Greater(QtPrivate::Ordering::Greater);
inline constexpr QPartialOrdering QPartialOrdering::Unordered(QtPrivate::LegacyUncomparable::Unordered);
+inline constexpr QPartialOrdering QPartialOrdering::less(QtPrivate::Ordering::Less);
+inline constexpr QPartialOrdering QPartialOrdering::equivalent(QtPrivate::Ordering::Equivalent);
+inline constexpr QPartialOrdering QPartialOrdering::greater(QtPrivate::Ordering::Greater);
+inline constexpr QPartialOrdering QPartialOrdering::unordered(QtPrivate::LegacyUncomparable::Unordered);
+
QT_END_NAMESPACE
#endif // QCOMPARE_H
diff --git a/tests/auto/corelib/global/qcompare/tst_qcompare.cpp b/tests/auto/corelib/global/qcompare/tst_qcompare.cpp
index e02eb61fde..8dc3cf5a37 100644
--- a/tests/auto/corelib/global/qcompare/tst_qcompare.cpp
+++ b/tests/auto/corelib/global/qcompare/tst_qcompare.cpp
@@ -25,6 +25,11 @@ private slots:
void tst_QCompare::legacyPartialOrdering()
{
+ static_assert(QPartialOrdering::Unordered == QPartialOrdering::unordered);
+ static_assert(QPartialOrdering::Less == QPartialOrdering::less);
+ static_assert(QPartialOrdering::Equivalent == QPartialOrdering::equivalent);
+ static_assert(QPartialOrdering::Greater == QPartialOrdering::greater);
+
static_assert(QPartialOrdering::Unordered == QPartialOrdering::Unordered);
static_assert(QPartialOrdering::Unordered != QPartialOrdering::Less);
static_assert(QPartialOrdering::Unordered != QPartialOrdering::Equivalent);