diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-04 10:19:19 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-04 19:03:09 +0100 |
commit | 43d0eae81e30ae8c8502e68d56c6c8b7e2c30215 (patch) | |
tree | 9939e66970f5af4192a0d41c50aa73588a587adf /src | |
parent | 35c2974f69fa28c96701e102ae36fc4d7f4053cf (diff) |
QML engine: fix conversion scores for sequences in CallOverloaded
A QV4Sequence can be converted back to its underlying container; we
therefore should give the conversion of QV4Sequence to container a high
score if metaTypeForSequence and the target metatype agree.
This has a larger effect in Qt 6 than in Qt 5, as we now can have new
sequence types for any (QMeta)Container.
Fixes: QTBUG-87616
Change-Id: I2bf02ebadbf9b707719d09edaf14b112eb2caf4f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index ee3be6fcdc..cabe48dbef 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1467,6 +1467,13 @@ static int MatchScore(const QV4::Value &actual, int conversionType) } } + if (auto sequenceMetaType = SequencePrototype::metaTypeForSequence(obj); sequenceMetaType != -1) { + if (sequenceMetaType == conversionType) + return 1; + else + return 10; + } + if (obj->as<QV4::QQmlValueTypeWrapper>()) { const QVariant v = obj->engine()->toVariant(actual, -1); if (v.userType() == conversionType) |