summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qvariant.cpp')
-rw-r--r--src/corelib/kernel/qvariant.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index a1e1c71d12..f3ac3fcdba 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -944,7 +944,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
const QVariantHash *hash = v_cast<QVariantHash>(d);
const auto end = hash->end();
for (auto it = hash->begin(); it != end; ++it)
- map->insertMulti(it.key(), it.value());
+ static_cast<QMultiMap<QString, QVariant> *>(map)->insert(it.key(), it.value());
#ifndef QT_BOOTSTRAPPED
} else if (d->type == QMetaType::QCborValue) {
if (!v_cast<QCborValue>(d)->isMap())
@@ -972,7 +972,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
const QVariantMap *map = v_cast<QVariantMap>(d);
const auto end = map->end();
for (auto it = map->begin(); it != end; ++it)
- hash->insertMulti(it.key(), it.value());
+ static_cast<QMultiHash<QString, QVariant> *>(hash)->insert(it.key(), it.value());
#ifndef QT_BOOTSTRAPPED
} else if (d->type == QMetaType::QCborValue) {
if (!v_cast<QCborValue>(d)->isMap())
@@ -1544,7 +1544,7 @@ static void customStreamDebug(QDebug dbg, const QVariant &variant) {
#ifndef QT_BOOTSTRAPPED
QMetaType::TypeFlags flags = QMetaType::typeFlags(variant.userType());
if (flags & QMetaType::PointerToQObject)
- dbg.nospace() << variant.value<QObject*>();
+ dbg.nospace() << qvariant_cast<QObject*>(variant);
#else
Q_UNUSED(dbg);
Q_UNUSED(variant);
@@ -2254,10 +2254,10 @@ QVariant::QVariant(const QRegularExpression &re)
: d(RegularExpression)
{ v_construct<QRegularExpression>(&d, re); }
#endif // QT_CONFIG(regularexpression)
-#ifndef QT_BOOTSTRAPPED
QVariant::QVariant(const QUuid &uuid)
: d(Uuid)
{ v_construct<QUuid>(&d, uuid); }
+#ifndef QT_BOOTSTRAPPED
QVariant::QVariant(const QJsonValue &jsonValue)
: d(QMetaType::QJsonValue)
{ v_construct<QJsonValue>(&d, jsonValue); }
@@ -2523,7 +2523,7 @@ void QVariant::load(QDataStream &s)
return;
}
}
- create(typeId, 0);
+ create(typeId, nullptr);
d.is_null = is_null;
if (!isValid()) {
@@ -3011,7 +3011,6 @@ QPersistentModelIndex QVariant::toPersistentModelIndex() const
}
#endif // QT_CONFIG(itemmodel)
-#ifndef QT_BOOTSTRAPPED
/*!
\since 5.0
@@ -3026,6 +3025,7 @@ QUuid QVariant::toUuid() const
return qVariantToHelper<QUuid>(d, handlerManager);
}
+#ifndef QT_BOOTSTRAPPED
/*!
\since 5.0
@@ -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)