summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/kernel/qvariant.cpp14
-rw-r--r--src/corelib/kernel/qvariant.h10
2 files changed, 20 insertions, 4 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 762a761026..d1eb463514 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -3829,6 +3829,7 @@ bool QVariant::convert(const int type, void *ptr) const
/*!
\fn bool QVariant::operator<(const QVariant &v) const
+ \obsolete
Compares this QVariant with \a v and returns \c true if this is less than \a v.
@@ -3838,10 +3839,15 @@ bool QVariant::convert(const int type, void *ptr) const
\warning To make this function work with a custom type registered with
qRegisterMetaType(), its comparison operator must be registered using
QMetaType::registerComparators().
+
+ This operator is deprecated as it cannot establish a total order required
+ for most use of this operator, which is the reason you cannot use QVariant
+ as the key of a QMap.
*/
/*!
\fn bool QVariant::operator<=(const QVariant &v) const
+ \obsolete
Compares this QVariant with \a v and returns \c true if this is less or equal than \a v.
@@ -3851,10 +3857,13 @@ bool QVariant::convert(const int type, void *ptr) const
\warning To make this function work with a custom type registered with
qRegisterMetaType(), its comparison operator must be registered using
QMetaType::registerComparators().
+
+ This operator is deprecated as it cannot establish a total order.
*/
/*!
\fn bool QVariant::operator>(const QVariant &v) const
+ \obsolete
Compares this QVariant with \a v and returns \c true if this is larger than \a v.
@@ -3864,10 +3873,13 @@ bool QVariant::convert(const int type, void *ptr) const
\warning To make this function work with a custom type registered with
qRegisterMetaType(), its comparison operator must be registered using
QMetaType::registerComparators().
+
+ This operator is deprecated as it cannot establish a total order.
*/
/*!
\fn bool QVariant::operator>=(const QVariant &v) const
+ \obsolete
Compares this QVariant with \a v and returns \c true if this is larger or equal than \a v.
@@ -3877,6 +3889,8 @@ bool QVariant::convert(const int type, void *ptr) const
\warning To make this function work with a custom type registered with
qRegisterMetaType(), its comparison operator must be registered using
QMetaType::registerComparators().
+
+ This operator is deprecated as it cannot establish a total order.
*/
static bool qIsNumericType(uint tp)
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 86c7414704..6e27c9bf1f 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -463,14 +463,16 @@ class Q_CORE_EXPORT QVariant
{ return cmp(v); }
inline bool operator!=(const QVariant &v) const
{ return !cmp(v); }
- inline bool operator<(const QVariant &v) const
+#if QT_DEPRECATED_SINCE(5, 15)
+ QT_DEPRECATED inline bool operator<(const QVariant &v) const
{ return compare(v) < 0; }
- inline bool operator<=(const QVariant &v) const
+ QT_DEPRECATED inline bool operator<=(const QVariant &v) const
{ return compare(v) <= 0; }
- inline bool operator>(const QVariant &v) const
+ QT_DEPRECATED inline bool operator>(const QVariant &v) const
{ return compare(v) > 0; }
- inline bool operator>=(const QVariant &v) const
+ QT_DEPRECATED inline bool operator>=(const QVariant &v) const
{ return compare(v) >= 0; }
+#endif
protected:
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);