From 34c98070d158386673d607eb860f682635849d4a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 5 Apr 2019 09:42:17 +0200 Subject: Fix deprecation warnings about QVariant API Fix warnings like: sruntime/qv4serialize.cpp:378:45: warning: 'QVariant qVariantFromValue(const T&) [with T = QQmlListModelWorkerAgent::VariantRef]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] qml/qqmlvmemetaobject.cpp:597:61: warning: 'QVariant qVariantFromValue(const T&) [with T = QList]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] jsruntime/qv4engine.cpp:1319:66: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] jsruntime/qv4engine.cpp:1350:60: warning: 'QVariant qVariantFromValue(const T&) [with T = QList]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickitem.cpp:8396:78: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickitem.cpp:8693:80: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickgenericshadereffect.cpp:126:69: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickgenericshadereffect.cpp:127:55: warning: 'QVariant qVariantFromValue(const T&) [with T = QSize]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickopenglshadereffect.cpp:713:69: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickopenglshadereffect.cpp:714:55: warning: 'QVariant qVariantFromValue(const T&) [with T = QSize]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] qquickcustomparticle.cpp:416:89: warning: 'QVariant qVariantFromValue(const T&) [with T = double]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] qqmlenginedebugclient.cpp:403:47: warning: 'QVariant qVariantFromValue(const T&) [with T = QQmlEngineDebugObjectReference]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] Task-number: QTBUG-74043 Change-Id: I14cb7d7c1fb8dc6321e32208a7de15f6bdb19065 Reviewed-by: Ulf Hermann --- tests/auto/quick/qquickanchors/tst_qquickanchors.cpp | 4 ++-- tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/auto/quick') diff --git a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp index 77fa1292c4..128a154492 100644 --- a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp +++ b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp @@ -364,7 +364,7 @@ void tst_qquickanchors::reset() const QMetaObject *meta = itemPrivate->anchors()->metaObject(); QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); - QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchorLine))); + QVERIFY(p.write(itemPrivate->anchors(), QVariant::fromValue(anchorLine))); QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(anchor), true); QVERIFY(p.reset(itemPrivate->anchors())); @@ -423,7 +423,7 @@ void tst_qquickanchors::nullItem() QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); QTest::ignoreMessage(QtWarningMsg, ": QML Item: Cannot anchor to a null item."); - QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchor))); + QVERIFY(p.write(itemPrivate->anchors(), QVariant::fromValue(anchor))); delete item; } diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index e4b427f6ec..f19f5f9877 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -899,15 +899,15 @@ void tst_QQuickRepeater::destroyCount() QQuickRepeater *repeater = findItem(rootObject, "repeater"); QVERIFY(repeater); - repeater->setProperty("model", qVariantFromValue(3)); + repeater->setProperty("model", QVariant::fromValue(3)); QCOMPARE(repeater->property("componentCount").toInt(), 3); - repeater->setProperty("model", qVariantFromValue(0)); + repeater->setProperty("model", QVariant::fromValue(0)); QCOMPARE(repeater->property("componentCount").toInt(), 0); - repeater->setProperty("model", qVariantFromValue(4)); + repeater->setProperty("model", QVariant::fromValue(4)); QCOMPARE(repeater->property("componentCount").toInt(), 4); QStringListModel model; - repeater->setProperty("model", qVariantFromValue(&model)); + repeater->setProperty("model", QVariant::fromValue(&model)); QCOMPARE(repeater->property("componentCount").toInt(), 0); QStringList list; list << "1" << "2" << "3" << "4"; @@ -915,7 +915,7 @@ void tst_QQuickRepeater::destroyCount() QCOMPARE(repeater->property("componentCount").toInt(), 4); model.insertRows(2,1); QModelIndex index = model.index(2); - model.setData(index, qVariantFromValue(QStringLiteral("foobar"))); + model.setData(index, QVariant::fromValue(QStringLiteral("foobar"))); QCOMPARE(repeater->property("componentCount").toInt(), 5); model.removeRows(2,1); -- cgit v1.2.3