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 /tests/auto/qml/qqmlecmascript/testtypes.h | |
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 'tests/auto/qml/qqmlecmascript/testtypes.h')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index dead289b15..878dd79466 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -1748,6 +1748,27 @@ public slots: void selection(const QItemSelection &, int = 0) { funcCalled = QLatin1String("QItemSelection"); } }; +class SequenceConvertObject : public QObject +{ + Q_OBJECT + +public: + QString funcCalled; +public slots: + + Q_INVOKABLE QStringList getValues() const { + return QStringList() << QStringLiteral("one") << QStringLiteral("two"); + } + + Q_INVOKABLE void call(const QStringList &) { + funcCalled = QLatin1String("stringlist"); + } + + Q_INVOKABLE void call(const QList<int> &) { + funcCalled = QLatin1String("intlist"); + } +}; + struct ClassWithQProperty2 : public QObject { Q_OBJECT |