QVariantHash/Map can't hold multiple entries for the same key in Qt 6
This is a consequence of QHash being separated from QMultiHash. Change-Id: Id3bb585c9882ecbaa02691c8ba6553748dd21a24 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
0b325602b1
commit
91b12a1add
@ -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 QVariantMap *map = v_cast<QVariantMap>(d);
|
||||||
const auto end = map->end();
|
const auto end = map->end();
|
||||||
for (auto it = map->begin(); it != end; ++it)
|
for (auto it = map->begin(); it != end; ++it)
|
||||||
static_cast<QMultiHash<QString, QVariant> *>(hash)->insert(it.key(), it.value());
|
hash->insert(it.key(), it.value());
|
||||||
#ifndef QT_BOOTSTRAPPED
|
#ifndef QT_BOOTSTRAPPED
|
||||||
} else if (d->type == QMetaType::QCborValue) {
|
} else if (d->type == QMetaType::QCborValue) {
|
||||||
if (!v_cast<QCborValue>(d)->isMap())
|
if (!v_cast<QCborValue>(d)->isMap())
|
||||||
|
@ -818,7 +818,7 @@ namespace QtPrivate {
|
|||||||
QVariantHash l;
|
QVariantHash l;
|
||||||
l.reserve(iter.size());
|
l.reserve(iter.size());
|
||||||
for (QAssociativeIterable::const_iterator it = iter.begin(), end = iter.end(); it != end; ++it)
|
for (QAssociativeIterable::const_iterator it = iter.begin(), end = iter.end(); it != end; ++it)
|
||||||
static_cast<QMultiHash<QString, QVariant> &>(l).insert(it.key().toString(), it.value());
|
l.insert(it.key().toString(), it.value());
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
return QVariantValueHelper<QVariantHash>::invoke(v);
|
return QVariantValueHelper<QVariantHash>::invoke(v);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user