aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/testtypes.h
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-07-03 08:23:32 +0200
committerAndy Shaw <andy.shaw@qt.io>2020-07-03 14:30:45 +0200
commita056cb9595ea4a41c93f4c912719f9523b943d3b (patch)
treedfdd371f5a59cb5e93cdaab040689d55ff0d406a /tests/auto/qml/qqmlecmascript/testtypes.h
parent256503fadf5a925933fc03980d7c878643b1fdca (diff)
Give a better score for methods with a convertable type when matching
When it is looking for a matching method based on the argument types, then if a QVariant can be converted to that type then it should give a better score for that method. This is so that it can see it as being more viable a choice when calling the method instead of potentially not being able to find a matching one. Pick-to: 5.15 Change-Id: Ief7e11feacd1d0b0959330af2576c2d01affbc54 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.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 0a0fb98eb5..514dfb6f8f 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -48,6 +48,9 @@
#include <QtQml/qjsvalue.h>
#include <QtQml/qqmlscriptstring.h>
#include <QtQml/qqmlcomponent.h>
+#include <QtCore/QModelIndex>
+#include <QtCore/QPersistentModelIndex>
+#include <QtCore/QItemSelection>
#include <private/qqmlengine_p.h>
#include <private/qv4qobjectwrapper_p.h>
@@ -1732,6 +1735,17 @@ public:
QProperty<float> value;
};
+class VariantConvertObject : public QObject
+{
+ Q_OBJECT
+public:
+ QString funcCalled;
+public slots:
+ QPersistentModelIndex getIndex() const { return QPersistentModelIndex(QModelIndex()); }
+ void selection(const QModelIndex &mi, int n = 0) { funcCalled = QLatin1String("QModelIndex"); }
+ void selection(const QItemSelection &is, int n = 0) { funcCalled = QLatin1String("QItemSelection"); }
+};
+
void registerTypes();
#endif // TESTTYPES_H