aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Skoland <david.skoland@qt.io>2020-11-02 11:09:38 +0100
committerDavid Skoland <david.skoland@qt.io>2020-11-02 14:56:00 +0100
commite47edfe7a75eb9240604e66fc6a400ebef83b6a0 (patch)
treedfb655d9c2872bb2dbe3575a3a1d74aa1a8f47c8
parent50ba4ffdf48461d38f4dd2137a0fbbc916c9eb0a (diff)
Update tests to use new metaType system
Change from the QVariant enum to the QMetaType enum and prefer typeId over userType where possible Change-Id: Ic89c55978d46cc23d23b8e9c82c475c0c220fae3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.cpp9
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp43
-rw-r--r--tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp2
-rw-r--r--tests/auto/qml/qqmlinstantiator/stringmodel.h2
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp135
-rw-r--r--tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp12
-rw-r--r--tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp6
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp22
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp28
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp2
-rw-r--r--tests/auto/quick/qquickapplication/tst_qquickapplication.cpp2
-rw-r--r--tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp2
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp4
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp4
16 files changed, 138 insertions, 139 deletions
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
index 903d372cfb..cdf04ceb00 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
@@ -976,8 +976,9 @@ void tst_QJSValue::toVariant()
QCOMPARE(qjsvalue_cast<QVariant>(number), QVariant(123.0));
QJSValue intNumber = eng.toScriptValue((qint32)123);
- QCOMPARE(intNumber.toVariant().type(), QVariant((qint32)123).type());
- QCOMPARE((qjsvalue_cast<QVariant>(number)).type(), QVariant((qint32)123).type());
+ QCOMPARE(intNumber.toVariant().typeId(), QVariant((qint32)123).typeId());
+ QCOMPARE((qjsvalue_cast<QVariant>(number)).typeId(),
+ QVariant((qint32)123).typeId());
QJSValue falskt = eng.toScriptValue(false);
QCOMPARE(falskt.toVariant(), QVariant(false));
@@ -998,7 +999,7 @@ void tst_QJSValue::toVariant()
QJSValue qobject = eng.newQObject(&temp);
{
QVariant var = qobject.toVariant();
- QCOMPARE(var.userType(), int(QMetaType::QObjectStar));
+ QCOMPARE(var.typeId(), int(QMetaType::QObjectStar));
QCOMPARE(qvariant_cast<QObject*>(var), (QObject *)&temp);
}
@@ -1060,7 +1061,7 @@ void tst_QJSValue::toVariant()
QVERIFY(array.isArray());
QCOMPARE(array.property("length").toInt(), 2);
QVariant ret = array.toVariant();
- QCOMPARE(ret.userType(), QVariant::List);
+ QCOMPARE(ret.typeId(), QMetaType::QVariantList);
QVariantList listOut = ret.toList();
QCOMPARE(listOut.size(), listIn.size());
for (int i = 0; i < listIn.size(); ++i)
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index 71d5ff48c5..31f000fab6 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -472,7 +472,7 @@ void tst_qqmlconnections::noAcceleratedGlobalLookup()
QVERIFY(c.isReady());
QScopedPointer<QObject> object(c.create());
const QVariant val = object->property("testEnum");
- QCOMPARE(val.type(), QVariant::Int);
+ QCOMPARE(val.typeId(), QMetaType::Int);
QCOMPARE(val.toInt(), int(Proxy::EnumValue));
}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 3ab7b45b2a..dd662ef6d3 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -405,9 +405,8 @@ private:
// a specific userType.
static bool isJSNumberType(int userType)
{
- return userType == (int) QVariant::Int
- || userType == (int) QVariant::UInt
- || userType == (int) QVariant::Double;
+ return userType == QMetaType::Int || userType == QMetaType::UInt
+ || userType == QMetaType::Double;
}
};
@@ -942,7 +941,7 @@ void tst_qqmlecmascript::arrayExpressions()
MyExpression expr(&context, "[a, b, c, 10]");
QVariant result = expr.evaluate();
- QCOMPARE(result.userType(), qMetaTypeId<QJSValue>());
+ QCOMPARE(result.typeId(), qMetaTypeId<QJSValue>());
QJSValue list = qvariant_cast<QJSValue>(result);
QCOMPARE(list.property("length").toInt(), 4);
QCOMPARE(list.property(0).toQObject(), &obj1);
@@ -3316,7 +3315,7 @@ void tst_qqmlecmascript::listToVariant()
QVERIFY(object != nullptr);
QVariant v = object->property("test");
- QCOMPARE(v.userType(), qMetaTypeId<QQmlListReference>());
+ QCOMPARE(v.typeId(), qMetaTypeId<QQmlListReference>());
QCOMPARE(qvariant_cast<QQmlListReference>(v).object(), &container);
delete object;
@@ -4917,9 +4916,9 @@ void tst_qqmlecmascript::scarceResources()
QVariant value = expectedValues.at(i);
QCOMPARE(object->property(prop.toLatin1().constData()).isValid(), validity);
- if (value.type() == QVariant::Int) {
+ if (value.typeId() == QMetaType::Int) {
QCOMPARE(object->property(prop.toLatin1().constData()).toInt(), value.toInt());
- } else if (value.type() == QVariant::Pixmap) {
+ } else if (value.typeId() == QMetaType::QPixmap) {
QCOMPARE(object->property(prop.toLatin1().constData()).value<QPixmap>(), value.value<QPixmap>());
}
}
@@ -5069,15 +5068,15 @@ void tst_qqmlecmascript::propertyVarCpp()
QVERIFY(object->setProperty("varProperty", QVariant::fromValue(10)));
QCOMPARE(object->property("varBound"), QVariant(15));
QCOMPARE(object->property("intBound"), QVariant(15));
- QVERIFY(isJSNumberType(object->property("varProperty").userType()));
- QVERIFY(isJSNumberType(object->property("varBound").userType()));
+ QVERIFY(isJSNumberType(object->property("varProperty").typeId()));
+ QVERIFY(isJSNumberType(object->property("varBound").typeId()));
// assign string to property var that current has bool assigned
- QCOMPARE(object->property("varProperty2").userType(), (int)QVariant::Bool);
+ QCOMPARE(object->property("varProperty2").typeId(), QMetaType::Bool);
QVERIFY(object->setProperty("varProperty2", QVariant(QLatin1String("randomString"))));
QCOMPARE(object->property("varProperty2"), QVariant(QLatin1String("randomString")));
- QCOMPARE(object->property("varProperty2").userType(), (int)QVariant::String);
+ QCOMPARE(object->property("varProperty2").typeId(), QMetaType::QString);
// now enforce behaviour when accessing JavaScript objects from cpp.
- QCOMPARE(object->property("jsobject").userType(), qMetaTypeId<QJSValue>());
+ QCOMPARE(object->property("jsobject").typeId(), qMetaTypeId<QJSValue>());
delete object;
}
@@ -5948,7 +5947,7 @@ void tst_qqmlecmascript::assignSequenceTypes()
QVERIFY(object != nullptr);
QVariant result;
QMetaObject::invokeMethod(object.data(), "tryWritingReadOnlySequence", Q_RETURN_ARG(QVariant, result));
- QVERIFY(result.type() == QVariant::Bool);
+ QVERIFY(result.typeId() == QMetaType::Bool);
QVERIFY(result.toBool());
}
}
@@ -5986,7 +5985,7 @@ void tst_qqmlecmascript::nullObjectInitializer()
}
QVariant value = obj->property("testProperty");
- QVERIFY(value.userType() == qMetaTypeId<QObject*>());
+ QVERIFY(value.typeId() == qMetaTypeId<QObject*>());
QVERIFY(!value.value<QObject*>());
}
@@ -6007,7 +6006,7 @@ void tst_qqmlecmascript::nullObjectInitializer()
QVERIFY(obj->property("success").toBool());
QVariant value = obj->property("testProperty");
- QVERIFY(value.userType() == qMetaTypeId<QObject*>());
+ QVERIFY(value.typeId() == qMetaTypeId<QObject*>());
QVERIFY(!value.value<QObject*>());
}
@@ -6080,10 +6079,10 @@ void tst_qqmlecmascript::variants()
QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
- QCOMPARE(object->property("undefinedVariant").type(), QVariant::Invalid);
- QCOMPARE(int(object->property("nullVariant").type()), int(QMetaType::Nullptr));
- QCOMPARE(object->property("intVariant").type(), QVariant::Int);
- QCOMPARE(object->property("doubleVariant").type(), QVariant::Double);
+ QCOMPARE(object->property("undefinedVariant").typeId(), QMetaType::UnknownType);
+ QCOMPARE(object->property("nullVariant").typeId(), QMetaType::Nullptr);
+ QCOMPARE(object->property("intVariant").typeId(), QMetaType::Int);
+ QCOMPARE(object->property("doubleVariant").typeId(), QMetaType::Double);
QVariant result;
QMetaObject::invokeMethod(object.get(), "checkNull", Q_RETURN_ARG(QVariant, result));
@@ -8245,7 +8244,7 @@ void tst_qqmlecmascript::singletonWithEnum()
qDebug() << component.errors().first().toString();
QVERIFY(!obj.isNull());
QVariant prop = obj->property("testValue");
- QCOMPARE(prop.type(), QVariant::Int);
+ QCOMPARE(prop.typeId(), QMetaType::Int);
QCOMPARE(prop.toInt(), int(SingletonWithEnum::TestValue));
{
@@ -8267,7 +8266,7 @@ void tst_qqmlecmascript::lazyBindingEvaluation()
qDebug() << component.errors().first().toString();
QVERIFY(!obj.isNull());
QVariant prop = obj->property("arrayLength");
- QCOMPARE(prop.type(), QVariant::Int);
+ QCOMPARE(prop.typeId(), QMetaType::Int);
QCOMPARE(prop.toInt(), 2);
}
@@ -8574,7 +8573,7 @@ void tst_qqmlecmascript::instanceof()
QJSEngine engine;
QJSValue ret = engine.evaluate(setupCode + ";\n" + QTest::currentDataTag());
- if (expectedValue.type() == QVariant::Bool) {
+ if (expectedValue.typeId() == QMetaType::Bool) {
bool returnValue = ret.toBool();
QVERIFY2(!ret.isError(), qPrintable(ret.toString()));
QCOMPARE(returnValue, expectedValue.toBool());
diff --git a/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
index 0ba29d6b6a..494d5af2b8 100644
--- a/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
+++ b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp
@@ -142,7 +142,7 @@ void tst_qqmlexpression::expressionFromDataComponent()
QQmlExpression expression(object->scriptString());
QVariant result = expression.evaluate();
- QCOMPARE(result.type(), QVariant::String);
+ QCOMPARE(result.typeId(), QMetaType::QString);
QCOMPARE(result.toString(), QStringLiteral("success"));
}
diff --git a/tests/auto/qml/qqmlinstantiator/stringmodel.h b/tests/auto/qml/qqmlinstantiator/stringmodel.h
index 6ae3cbb6ee..c538b1a684 100644
--- a/tests/auto/qml/qqmlinstantiator/stringmodel.h
+++ b/tests/auto/qml/qqmlinstantiator/stringmodel.h
@@ -98,7 +98,7 @@ public:
{
int row = index.row();
if ((row<0) || (row>=items.count()))
- return QVariant::Invalid;
+ return QVariant(QMetaType(QMetaType::UnknownType));
switch (role) {
case Qt::DisplayRole:
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 9a9f13ee0a..c0286bd195 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -357,9 +357,8 @@ private:
// a specific userType.
static bool isJSNumberType(int userType)
{
- return userType == (int) QVariant::Int
- || userType == (int) QVariant::UInt
- || userType == (int) QVariant::Double;
+ return userType == QMetaType::Int || userType == QMetaType::UInt
+ || userType == QMetaType::Double;
}
void getSingletonInstance(QQmlEngine& engine, const char* fileName, const char* propertyName, QObject** result /* out */);
@@ -764,7 +763,7 @@ void tst_qqmllanguage::assignObjectToVariant()
QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QVariant v = object->property("a");
- QVERIFY(v.userType() == qMetaTypeId<QObject *>());
+ QVERIFY(v.typeId() == qMetaTypeId<QObject *>());
}
void tst_qqmllanguage::assignLiteralSignalProperty()
@@ -864,24 +863,24 @@ void tst_qqmllanguage::assignLiteralToVar()
QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
- QVERIFY(isJSNumberType(object->property("test1").userType()));
- QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double);
- QCOMPARE(object->property("test3").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test4").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test5").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test6").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test7").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test8").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
- QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
- QCOMPARE(object->property("test12").userType(), (int)QVariant::Color);
- QCOMPARE(object->property("test13").userType(), (int)QVariant::RectF);
- QCOMPARE(object->property("test14").userType(), (int)QVariant::PointF);
- QCOMPARE(object->property("test15").userType(), (int)QVariant::SizeF);
- QCOMPARE(object->property("test16").userType(), (int)QVariant::Vector3D);
- QVERIFY(isJSNumberType(object->property("variantTest1Bound").userType()));
- QVERIFY(isJSNumberType(object->property("test1Bound").userType()));
+ QVERIFY(isJSNumberType(object->property("test1").typeId()));
+ QCOMPARE(object->property("test2").typeId(), (int)QMetaType::Double);
+ QCOMPARE(object->property("test3").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test4").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test5").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test6").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test7").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test8").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test9").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test10").typeId(), QMetaType::Bool);
+ QCOMPARE(object->property("test11").typeId(), QMetaType::Bool);
+ QCOMPARE(object->property("test12").typeId(), QMetaType::QColor);
+ QCOMPARE(object->property("test13").typeId(), QMetaType::QRectF);
+ QCOMPARE(object->property("test14").typeId(), QMetaType::QPointF);
+ QCOMPARE(object->property("test15").typeId(), QMetaType::QSizeF);
+ QCOMPARE(object->property("test16").typeId(), QMetaType::QVector3D);
+ QVERIFY(isJSNumberType(object->property("variantTest1Bound").typeId()));
+ QVERIFY(isJSNumberType(object->property("test1Bound").typeId()));
QCOMPARE(object->property("test1"), QVariant(5));
QCOMPARE(object->property("test2"), QVariant((double)1.7));
@@ -1019,24 +1018,24 @@ void tst_qqmllanguage::bindJSValueToVar()
QObject *object = root->findChild<QObject *>("varProperties");
- QVERIFY(isJSNumberType(object->property("test1").userType()));
- QVERIFY(isJSNumberType(object->property("test2").userType()));
- QCOMPARE(object->property("test3").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test4").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test5").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test6").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test7").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test8").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
- QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
- QCOMPARE(object->property("test12").userType(), (int)QVariant::Color);
- QCOMPARE(object->property("test13").userType(), (int)QVariant::RectF);
- QCOMPARE(object->property("test14").userType(), (int)QVariant::PointF);
- QCOMPARE(object->property("test15").userType(), (int)QVariant::SizeF);
- QCOMPARE(object->property("test16").userType(), (int)QVariant::Vector3D);
- QVERIFY(isJSNumberType(object->property("test1Bound").userType()));
- QVERIFY(isJSNumberType(object->property("test20Bound").userType()));
+ QVERIFY(isJSNumberType(object->property("test1").typeId()));
+ QVERIFY(isJSNumberType(object->property("test2").typeId()));
+ QCOMPARE(object->property("test3").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test4").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test5").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test6").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test7").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test8").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test9").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test10").typeId(), QMetaType::Bool);
+ QCOMPARE(object->property("test11").typeId(), QMetaType::Bool);
+ QCOMPARE(object->property("test12").typeId(), QMetaType::QColor);
+ QCOMPARE(object->property("test13").typeId(), QMetaType::QRectF);
+ QCOMPARE(object->property("test14").typeId(), QMetaType::QPointF);
+ QCOMPARE(object->property("test15").typeId(), QMetaType::QSizeF);
+ QCOMPARE(object->property("test16").typeId(), QMetaType::QVector3D);
+ QVERIFY(isJSNumberType(object->property("test1Bound").typeId()));
+ QVERIFY(isJSNumberType(object->property("test20Bound").typeId()));
QCOMPARE(object->property("test1"), QVariant(5));
QCOMPARE(object->property("test2"), QVariant((double)1.7));
@@ -1068,24 +1067,24 @@ void tst_qqmllanguage::bindJSValueToVariant()
QObject *object = root->findChild<QObject *>("variantProperties");
- QVERIFY(isJSNumberType(object->property("test1").userType()));
- QVERIFY(isJSNumberType(object->property("test2").userType()));
- QCOMPARE(object->property("test3").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test4").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test5").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test6").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test7").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test8").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test9").userType(), (int)QVariant::String);
- QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool);
- QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
- QCOMPARE(object->property("test12").userType(), (int)QVariant::Color);
- QCOMPARE(object->property("test13").userType(), (int)QVariant::RectF);
- QCOMPARE(object->property("test14").userType(), (int)QVariant::PointF);
- QCOMPARE(object->property("test15").userType(), (int)QVariant::SizeF);
- QCOMPARE(object->property("test16").userType(), (int)QVariant::Vector3D);
- QVERIFY(isJSNumberType(object->property("test1Bound").userType()));
- QVERIFY(isJSNumberType(object->property("test20Bound").userType()));
+ QVERIFY(isJSNumberType(object->property("test1").typeId()));
+ QVERIFY(isJSNumberType(object->property("test2").typeId()));
+ QCOMPARE(object->property("test3").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test4").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test5").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test6").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test7").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test8").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test9").typeId(), QMetaType::QString);
+ QCOMPARE(object->property("test10").typeId(), QMetaType::Bool);
+ QCOMPARE(object->property("test11").typeId(), QMetaType::Bool);
+ QCOMPARE(object->property("test12").typeId(), QMetaType::QColor);
+ QCOMPARE(object->property("test13").typeId(), QMetaType::QRectF);
+ QCOMPARE(object->property("test14").typeId(), QMetaType::QPointF);
+ QCOMPARE(object->property("test15").typeId(), QMetaType::QSizeF);
+ QCOMPARE(object->property("test16").typeId(), QMetaType::QVector3D);
+ QVERIFY(isJSNumberType(object->property("test1Bound").typeId()));
+ QVERIFY(isJSNumberType(object->property("test20Bound").typeId()));
QCOMPARE(object->property("test1"), QVariant(5));
QCOMPARE(object->property("test2"), QVariant((double)1.7));
@@ -1455,7 +1454,7 @@ void tst_qqmllanguage::dynamicProperties()
QCOMPARE(object->property("urlProperty"), QVariant(QUrl("main.qml")));
QCOMPARE(object->property("colorProperty"), QVariant(QColor("red")));
QVariant date = object->property("dateProperty");
- if (!date.convert(QMetaType::QDate))
+ if (!date.convert(QMetaType(QMetaType::QDate)))
QFAIL("could not convert to date");
QCOMPARE(date, QVariant(QDate(1945, 9, 2)));
QCOMPARE(object->property("varProperty"), QVariant("Hello World!"));
@@ -1964,14 +1963,14 @@ void tst_qqmllanguage::aliasProperties()
QVERIFY(object != nullptr);
QVariant v = object->property("otherAlias");
- QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>());
+ QCOMPARE(v.typeId(), qMetaTypeId<MyQmlObject *>());
MyQmlObject *o = qvariant_cast<MyQmlObject*>(v);
QCOMPARE(o->value(), 10);
delete o;
v = object->property("otherAlias");
- QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>());
+ QCOMPARE(v.typeId(), qMetaTypeId<MyQmlObject *>());
o = qvariant_cast<MyQmlObject*>(v);
QVERIFY(!o);
}
@@ -3995,7 +3994,7 @@ void tst_qqmllanguage::functionParameterTypes()
{
QMetaMethod slot = metaObject->method(metaObject->indexOfSlot("returnItem()"));
QVERIFY(slot.isValid());
- QCOMPARE(slot.returnType(), QMetaType::type("QObject*"));
+ QCOMPARE(slot.returnType(), QMetaType::QObjectStar);
QObject *returnedPtr = nullptr;
slot.invoke(obj.data(), Qt::DirectConnection, Q_RETURN_ARG(QObject*, returnedPtr));
QCOMPARE(returnedPtr, obj.data());
@@ -4388,9 +4387,9 @@ void tst_qqmllanguage::getSingletonInstance(QObject* o, const char* propertyName
QVERIFY(variant.isValid());
QObject *singleton = nullptr;
- if (variant.userType() == qMetaTypeId<QObject *>())
+ if (variant.typeId() == qMetaTypeId<QObject *>())
singleton = variant.value<QObject*>();
- else if (variant.userType() == qMetaTypeId<QJSValue>())
+ else if (variant.typeId() == qMetaTypeId<QJSValue>())
singleton = variant.value<QJSValue>().toQObject();
QVERIFY(singleton != nullptr);
@@ -4399,10 +4398,10 @@ void tst_qqmllanguage::getSingletonInstance(QObject* o, const char* propertyName
void verifyCompositeSingletonPropertyValues(QObject* o, const char* n1, int v1, const char* n2, int v2)
{
- QCOMPARE(o->property(n1).userType(), (int)QMetaType::Int);
+ QCOMPARE(o->property(n1).typeId(), (int)QMetaType::Int);
QCOMPARE(o->property(n1), QVariant(v1));
- QCOMPARE(o->property(n2).userType(), (int)QVariant::String);
+ QCOMPARE(o->property(n2).typeId(), QMetaType::QString);
QString numStr;
QCOMPARE(o->property(n2), QVariant(QString(QLatin1String("Test value: ")).append(numStr.setNum(v2))));
}
@@ -5334,7 +5333,7 @@ void tst_qqmllanguage::instanceof()
QQmlExpression expr(engine.contextForObject(o.data()), nullptr, QString::fromLatin1(QTest::currentDataTag()));
QVariant ret = expr.evaluate();
- if (expectedValue.type() == QVariant::Bool) {
+ if (expectedValue.typeId() == QMetaType::Bool) {
// no error expected
QVERIFY2(!expr.hasError(), qPrintable(expr.error().description()));
bool returnValue = ret.toBool();
@@ -5503,7 +5502,7 @@ void tst_qqmllanguage::selfReference()
const QMetaObject *metaObject = o->metaObject();
QMetaProperty selfProperty = metaObject->property(metaObject->indexOfProperty("self"));
- QCOMPARE(selfProperty.userType(), compilationUnit->typeIds.id.id());
+ QCOMPARE(selfProperty.metaType().id(), compilationUnit->typeIds.id.id());
QByteArray typeName = selfProperty.typeName();
QVERIFY(typeName.endsWith('*'));
diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
index d54e3467b7..c2f9cfbc11 100644
--- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
+++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
@@ -145,7 +145,7 @@ bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVarian
for (int i=0 ; i < testList.count() ; ++i) {
const QVariant &testVariant = testList.at(i);
- if (testVariant.type() != QVariant::Map)
+ if (testVariant.typeId() != QMetaType::QVariantMap)
return false;
const QVariantMap &map = testVariant.toMap();
@@ -164,7 +164,7 @@ bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVarian
const QVariant &modelData = model->data(i, roleIndex);
- if (testData.type() == QVariant::List) {
+ if (testData.typeId() == QMetaType::QVariantList) {
const QVariantList &subList = testData.toList();
allOk = allOk && compareVariantList(subList, modelData);
} else {
@@ -421,7 +421,7 @@ void tst_qqmllistmodel::static_nestedElements()
QVERIFY(obj != nullptr);
QVariant count = obj->property("count");
- QCOMPARE(count.type(), QVariant::Int);
+ QCOMPARE(count.typeId(), QMetaType::Int);
QCOMPARE(count.toInt(), elementCount);
delete obj;
@@ -809,7 +809,7 @@ void tst_qqmllistmodel::get()
int role = roleFromName(model, roleName);
QVERIFY(role >= 0);
- if (roleValue.type() == QVariant::List) {
+ if (roleValue.typeId() == QMetaType::QVariantList) {
const QVariantList &list = roleValue.toList();
QVERIFY(compareVariantList(list, model->data(index, role)));
} else {
@@ -861,7 +861,7 @@ void tst_qqmllistmodel::get_nested()
QFETCH(QVariant, roleValue);
QFETCH(bool, dynamicRoles);
- if (roleValue.type() == QVariant::Map)
+ if (roleValue.typeId() == QMetaType::QVariantMap)
return;
QQmlEngine engine;
@@ -935,7 +935,7 @@ void tst_qqmllistmodel::get_nested()
int role = roleFromName(childModel, roleName);
QVERIFY(role >= 0);
- if (roleValue.type() == QVariant::List) {
+ if (roleValue.typeId() == QMetaType::QVariantList) {
QVERIFY(compareVariantList(roleValue.toList(), childModel->data(index, role)));
} else {
QCOMPARE(childModel->data(index, role), roleValue);
diff --git a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp
index b5e8800d0e..85814a54fb 100644
--- a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp
+++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp
@@ -119,7 +119,7 @@ bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testL
for (int i=0 ; i < testList.count() ; ++i) {
const QVariant &testVariant = testList.at(i);
- if (testVariant.type() != QVariant::Map)
+ if (testVariant.typeId() != QMetaType::QVariantMap)
return false;
const QVariantMap &map = testVariant.toMap();
@@ -138,7 +138,7 @@ bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testL
const QVariant &modelData = model->data(model->index(i, 0, QModelIndex()), roleIndex);
- if (testData.type() == QVariant::List) {
+ if (testData.typeId() == QMetaType::QVariantList) {
const QVariantList &subList = testData.toList();
allOk = allOk && compareVariantList(subList, modelData);
} else {
@@ -484,7 +484,7 @@ void tst_qqmllistmodelworkerscript::get_worker()
waitForWorker(item);
// see if we receive the model changes in the main thread's model
- if (roleValue.type() == QVariant::List) {
+ if (roleValue.typeId() == QMetaType::QVariantList) {
const QVariantList &list = roleValue.toList();
QVERIFY(compareVariantList(list, model.data(index, role)));
} else {
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index c947f050ba..51ecc92ffb 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -329,10 +329,10 @@ void tst_qqmlmetatype::externalEnums()
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj);
QVariant a = obj->property("a");
- QCOMPARE(a.userType(), QVariant::Int);
+ QCOMPARE(a.typeId(), QMetaType::Int);
QCOMPARE(a.toInt(), int(QStandardPaths::DocumentsLocation));
QVariant b = obj->property("b");
- QCOMPARE(b.userType(), QVariant::Int);
+ QCOMPARE(b.typeId(), QMetaType::Int);
QCOMPARE(b.toInt(), int(QStandardPaths::DocumentsLocation));
}
@@ -398,10 +398,10 @@ void tst_qqmlmetatype::unregisterCustomType()
QObject *controller = obj->findChild<QObject *>("controller");
QVERIFY2(qobject_cast<Controller1 *>(controller), "child 'controller' could be found and is a Controller1*");
QVariant stringVal = controller->property("string");
- QCOMPARE(stringVal.userType(), QVariant::String);
+ QCOMPARE(stringVal.typeId(), QMetaType::QString);
QCOMPARE(stringVal.toString(), QStringLiteral("Controller #1"));
QVariant enumVal = controller->property("enumVal");
- QVERIFY2(QMetaType(enumVal.userType()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
+ QVERIFY2(QMetaType(enumVal.typeId()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
QCOMPARE(enumVal.toInt(), 1);
}
QQmlMetaType::unregisterType(controllerId);
@@ -423,10 +423,10 @@ void tst_qqmlmetatype::unregisterCustomType()
QObject *controller = obj->findChild<QObject *>("controller");
QVERIFY2(qobject_cast<Controller2 *>(controller), "child 'controller' could be found and is a Controller2*");
QVariant stringVal = controller->property("string");
- QCOMPARE(stringVal.userType(), QVariant::String);
+ QCOMPARE(stringVal.typeId(), QMetaType::QString);
QCOMPARE(stringVal.toString(), QStringLiteral("Controller #2"));
QVariant enumVal = controller->property("enumVal");
- QVERIFY2(QMetaType(enumVal.userType()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
+ QVERIFY2(QMetaType(enumVal.typeId()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
QCOMPARE(enumVal.toInt(), 111);
}
QQmlMetaType::unregisterType(controllerId);
@@ -448,10 +448,10 @@ void tst_qqmlmetatype::unregisterCustomType()
QObject *controller = obj->findChild<QObject *>("controller");
QVERIFY2(qobject_cast<Controller1 *>(controller), "child 'controller' could be found and is a Controller1*");
QVariant stringVal = controller->property("string");
- QCOMPARE(stringVal.userType(), QVariant::String);
+ QCOMPARE(stringVal.typeId(), QMetaType::QString);
QCOMPARE(stringVal.toString(), QStringLiteral("Controller #1"));
QVariant enumVal = controller->property("enumVal");
- QVERIFY2(QMetaType(enumVal.userType()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
+ QVERIFY2(QMetaType(enumVal.typeId()).flags() & QMetaType::IsEnumeration, "enumVal's type is enumeratoion");
QCOMPARE(enumVal.toInt(), 1);
}
}
@@ -498,7 +498,7 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj.data());
QVariant stringVal = obj->property("text");
- QCOMPARE(stringVal.userType(), QVariant::String);
+ QCOMPARE(stringVal.typeId(), QMetaType::QString);
QCOMPARE(stringVal.toString(), QStringLiteral("StaticProvider #1"));
}
QQmlMetaType::unregisterType(staticProviderId);
@@ -515,7 +515,7 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj.data());
QVariant stringVal = obj->property("text");
- QCOMPARE(stringVal.userType(), QVariant::String);
+ QCOMPARE(stringVal.typeId(), QMetaType::QString);
QCOMPARE(stringVal.toString(), QStringLiteral("StaticProvider #2"));
}
QQmlMetaType::unregisterType(staticProviderId);
@@ -532,7 +532,7 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj.data());
QVariant stringVal = obj->property("text");
- QCOMPARE(stringVal.userType(), QVariant::String);
+ QCOMPARE(stringVal.typeId(), QMetaType::QString);
QCOMPARE(stringVal.toString(), QStringLiteral("StaticProvider #1"));
}
}
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 12c6ef89aa..6505cb46c6 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -525,7 +525,7 @@ void tst_qqmlproperty::qmlmetaproperty_object()
QCOMPARE(prop.isValid(), true);
QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyType(), QMetaType::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(!QQmlPropertyPrivate::binding(prop));
@@ -630,7 +630,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.isValid(), true);
QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyType(), QMetaType::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(!QQmlPropertyPrivate::binding(prop));
@@ -835,7 +835,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_context()
QCOMPARE(prop.isValid(), true);
QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyType(), QMetaType::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(!QQmlPropertyPrivate::binding(prop));
@@ -940,7 +940,7 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.isValid(), true);
QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject));
QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(prop.propertyType(), (int)QVariant::Int);
+ QCOMPARE(prop.propertyType(), QMetaType::Int);
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(!QQmlPropertyPrivate::binding(prop));
@@ -1232,7 +1232,7 @@ void tst_qqmlproperty::read()
QCOMPARE(p.propertyType(), qMetaTypeId<MyQObject*>());
QVariant v = p.read();
- QVERIFY(v.canConvert(QMetaType::QObjectStar));
+ QVERIFY(v.canConvert(QMetaType(QMetaType::QObjectStar)));
QVERIFY(qvariant_cast<QObject *>(v) == o.qObject());
}
{
@@ -1243,7 +1243,7 @@ void tst_qqmlproperty::read()
QCOMPARE(p.propertyType(), qMetaTypeId<MyQObject*>());
QVariant v = p.read();
- QVERIFY(v.canConvert(QMetaType::QObjectStar));
+ QVERIFY(v.canConvert(QMetaType(QMetaType::QObjectStar)));
QVERIFY(qvariant_cast<QObject *>(v) == o.qObject());
}
@@ -1254,7 +1254,7 @@ void tst_qqmlproperty::read()
QCOMPARE(p.propertyTypeCategory(), QQmlProperty::Object);
QCOMPARE(p.propertyType(), qMetaTypeId<MyQmlObject*>());
QVariant v = p.read();
- QCOMPARE(v.userType(), int(QMetaType::QObjectStar));
+ QCOMPARE(v.typeId(), QMetaType::QObjectStar);
QVERIFY(qvariant_cast<QObject *>(v) == o.qmlObject());
}
{
@@ -1268,7 +1268,7 @@ void tst_qqmlproperty::read()
QVERIFY(p.propertyType() != QMetaType::QObjectStar);
QVariant v = p.read();
- QCOMPARE(v.userType(), int(QMetaType::QObjectStar));
+ QCOMPARE(v.typeId(), QMetaType::QObjectStar);
QCOMPARE(qvariant_cast<QObject *>(v)->property("a").toInt(), 10);
QCOMPARE(qvariant_cast<QObject *>(v)->property("b").toInt(), 19);
}
@@ -1278,7 +1278,7 @@ void tst_qqmlproperty::read()
QVERIFY(object != nullptr);
QVariant v = QQmlProperty::read(object.data(), "test", &engine);
- QCOMPARE(v.userType(), int(QMetaType::QObjectStar));
+ QCOMPARE(v.typeId(), QMetaType::QObjectStar);
QCOMPARE(qvariant_cast<QObject *>(v)->property("a").toInt(), 10);
QCOMPARE(qvariant_cast<QObject *>(v)->property("b").toInt(), 19);
}
@@ -1996,14 +1996,14 @@ void tst_qqmlproperty::copy()
QCOMPARE(property->read(), QVariant(10));
QCOMPARE(property->type(), QQmlProperty::Property);
QCOMPARE(property->propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(property->propertyType(), (int)QVariant::Int);
+ QCOMPARE(property->propertyType(), QMetaType::Int);
QQmlProperty p1(*property);
QCOMPARE(p1.name(), QString("defaultProperty"));
QCOMPARE(p1.read(), QVariant(10));
QCOMPARE(p1.type(), QQmlProperty::Property);
QCOMPARE(p1.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(p1.propertyType(), (int)QVariant::Int);
+ QCOMPARE(p1.propertyType(), QMetaType::Int);
QQmlProperty p2(&object, QLatin1String("url"));
QCOMPARE(p2.name(), QString("url"));
@@ -2012,7 +2012,7 @@ void tst_qqmlproperty::copy()
QCOMPARE(p2.read(), QVariant(10));
QCOMPARE(p2.type(), QQmlProperty::Property);
QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+ QCOMPARE(p2.propertyType(), QMetaType::Int);
delete property; property = nullptr;
@@ -2020,13 +2020,13 @@ void tst_qqmlproperty::copy()
QCOMPARE(p1.read(), QVariant(10));
QCOMPARE(p1.type(), QQmlProperty::Property);
QCOMPARE(p1.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(p1.propertyType(), (int)QVariant::Int);
+ QCOMPARE(p1.propertyType(), QMetaType::Int);
QCOMPARE(p2.name(), QString("defaultProperty"));
QCOMPARE(p2.read(), QVariant(10));
QCOMPARE(p2.type(), QQmlProperty::Property);
QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
- QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+ QCOMPARE(p2.propertyType(), QMetaType::Int);
}
void tst_qqmlproperty::noContext()
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 237b65679e..39af59d0b0 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -468,7 +468,7 @@ void tst_QQmlPropertyMap::QTBUG_35906()
QScopedPointer<QObject> obj(component.create());
QVERIFY(!obj.isNull());
QVariant value = obj->property("testValue");
- QCOMPARE(value.type(), QVariant::Int);
+ QCOMPARE(value.typeId(), QMetaType::Int);
QCOMPARE(value.toInt(), 42);
}
diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
index 3526eb98be..f5812f56ee 100644
--- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
+++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp
@@ -217,7 +217,7 @@ void tst_qquickapplication::font()
QVariant defaultFontProperty = item->property("defaultFont");
QVERIFY(defaultFontProperty.isValid());
- QCOMPARE(defaultFontProperty.type(), QVariant::Font);
+ QCOMPARE(defaultFontProperty.typeId(), QMetaType::QFont);
QCOMPARE(defaultFontProperty.value<QFont>(), qApp->font());
}
diff --git a/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp b/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp
index 04cc81683c..71477c058b 100644
--- a/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp
+++ b/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp
@@ -92,7 +92,7 @@ void tst_QQuickColorGroup::checkColorProperty_data()
auto mo = QQuickColorGroup::staticMetaObject;
for (int i = mo.propertyOffset(); i < mo.propertyCount(); ++i) {
auto property = mo.property(i);
- if (property.type() == QVariant::Color) {
+ if (property.userType() == QMetaType::QColor) {
QTest::addRow("%s", property.name()) << i;
}
}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 323513400a..c625f99c00 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -6447,7 +6447,7 @@ void tst_QQuickGridView::matchIndexLists(const QVariantList &indexLists, const Q
void tst_QQuickGridView::matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes)
{
for (QVariantMap::const_iterator it = items.begin(); it != items.end(); ++it) {
- QCOMPARE(it.value().type(), QVariant::Int);
+ QCOMPARE(it.value().typeId(), QMetaType::Int);
QString name = it.key();
int itemIndex = it.value().toInt();
QVERIFY2(expectedIndexes.contains(itemIndex), QTest::toString(QString("Index %1 not found in expectedIndexes").arg(itemIndex)));
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 00cd06f3ae..3a742f2a6d 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -7906,7 +7906,7 @@ void tst_QQuickListView::matchIndexLists(const QVariantList &indexLists, const Q
void tst_QQuickListView::matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes)
{
for (QVariantMap::const_iterator it = items.begin(); it != items.end(); ++it) {
- QCOMPARE(it.value().type(), QVariant::Int);
+ QCOMPARE(it.value().typeId(), QMetaType::Int);
QString name = it.key();
int itemIndex = it.value().toInt();
QVERIFY2(expectedIndexes.contains(itemIndex), qPrintable(QString("Index %1 not found in expectedIndexes").arg(itemIndex)));
@@ -7920,7 +7920,7 @@ void tst_QQuickListView::matchItemsAndIndexes(const QVariantMap &items, const Qa
void tst_QQuickListView::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems)
{
for (int i=0; i<itemLists.count(); i++) {
- QCOMPARE(itemLists[i].type(), QVariant::List);
+ QCOMPARE(itemLists[i].typeId(), QMetaType::QVariantList);
QVariantList current = itemLists[i].toList();
for (int j=0; j<current.count(); j++) {
QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>());
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index e6bbd8c215..3885dd4a9a 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -4045,7 +4045,7 @@ void tst_qquickpositioners::matchIndexLists(const QVariantList &indexLists, cons
void tst_qquickpositioners::matchItemsAndIndexes(const QVariantMap &items, const QaimModel &model, const QList<int> &expectedIndexes)
{
for (QVariantMap::const_iterator it = items.begin(); it != items.end(); ++it) {
- QCOMPARE(it.value().type(), QVariant::Int);
+ QCOMPARE(it.value().typeId(), QMetaType::Int);
QString name = it.key();
int itemIndex = it.value().toInt();
QVERIFY2(expectedIndexes.contains(itemIndex), QTest::toString(QString("Index %1 not found in expectedIndexes").arg(itemIndex)));
@@ -4059,7 +4059,7 @@ void tst_qquickpositioners::matchItemsAndIndexes(const QVariantMap &items, const
void tst_qquickpositioners::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems)
{
for (int i=0; i<itemLists.count(); i++) {
- QCOMPARE(itemLists[i].type(), QVariant::List);
+ QCOMPARE(itemLists[i].typeId(), QMetaType::QVariantList);
QVariantList current = itemLists[i].toList();
for (int j=0; j<current.count(); j++) {
QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>());