aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-02-11 16:33:46 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-12 16:18:27 +0000
commit0e92e0bd6e7209ad491472b3928840ad78c5371a (patch)
tree1195f62920b2fbc74e0c0efdbf5912b884a1b383
parente33794e0537efbb22f9d8c4d528bfa062335da03 (diff)
Replace QScopedPointer with std::unique_ptr
Fix compiler warning, QScopedPointer::take was deprecated in Qt 6.1. Change-Id: I67045bce97efb082b1b7467a6c24d5dbf996fdc1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 070072e7cabd6f4f26f4938b1616e56254ad25d9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/particles/shared/particlestestsshared.h6
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp6
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp6
-rw-r--r--tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp36
4 files changed, 27 insertions, 27 deletions
diff --git a/tests/auto/particles/shared/particlestestsshared.h b/tests/auto/particles/shared/particlestestsshared.h
index e1fc6f4ccd..92424e98b3 100644
--- a/tests/auto/particles/shared/particlestestsshared.h
+++ b/tests/auto/particles/shared/particlestestsshared.h
@@ -57,18 +57,18 @@ bool myFuzzyGEQ(qreal a, qreal b)
QQuickView* createView(const QUrl &filename, int additionalWait=0)
{
- QScopedPointer<QQuickView> view(new QQuickView(nullptr));
+ std::unique_ptr<QQuickView> view(new QQuickView(nullptr));
view->setSource(filename);
if (view->status() != QQuickView::Ready)
return nullptr;
view->show();
- if (!QTest::qWaitForWindowExposed(view.data()))
+ if (!QTest::qWaitForWindowExposed(view.get()))
return nullptr;
if (additionalWait)
QTest::qWait(additionalWait);
- return view.take();
+ return view.release();
}
void ensureAnimTime(int requiredTime, QAbstractAnimation* anim)//With consistentTiming, who knows how long an animation really takes...
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 61780fc405..7860f5677a 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -1986,7 +1986,7 @@ public slots:
void tst_qquickitem::testSGInvalidate()
{
for (int i=0; i<2; ++i) {
- QScopedPointer<QQuickView> view(new QQuickView());
+ std::unique_ptr<QQuickView> view(new QQuickView());
InvalidatedItem *item = new InvalidatedItem();
@@ -2003,9 +2003,9 @@ void tst_qquickitem::testSGInvalidate()
item->setParentItem(view->contentItem());
view->show();
- QVERIFY(QTest::qWaitForWindowExposed(view.data()));
+ QVERIFY(QTest::qWaitForWindowExposed(view.get()));
- delete view.take();
+ view.reset();
QCOMPARE(invalidateSpy.size(), expected);
}
}
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index d70a23061b..b5ab520055 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -1177,7 +1177,7 @@ void tst_QQuickMultiPointTouchArea::transformedTouchArea()
QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file)
{
- QScopedPointer<QQuickView> window(new QQuickView(nullptr));
+ std::unique_ptr<QQuickView> window(new QQuickView(nullptr));
window->setSource(testFileUrl(file));
if (window->status() != QQuickView::Ready)
return nullptr;
@@ -1186,9 +1186,9 @@ QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file
const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
window->setFramePosition(screenGeometry.center() - offset);
window->show();
- if (!QTest::qWaitForWindowExposed(window.data()))
+ if (!QTest::qWaitForWindowExposed(window.get()))
return nullptr;
- return window.take();
+ return window.release();
}
void tst_QQuickMultiPointTouchArea::mouseInteraction_data()
diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
index a6b0ea7059..32e4a1a05a 100644
--- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
+++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
@@ -1074,40 +1074,40 @@ void tst_QQuickRepeater::ownership()
QQmlComponent component(&engine, testFileUrl("ownership.qml"));
- QScopedPointer<QAbstractItemModel> aim(new QStandardItemModel);
- QPointer<QAbstractItemModel> modelGuard(aim.data());
- QQmlEngine::setObjectOwnership(aim.data(), QQmlEngine::JavaScriptOwnership);
+ std::unique_ptr<QAbstractItemModel> aim(new QStandardItemModel);
+ QPointer<QAbstractItemModel> modelGuard(aim.get());
+ QQmlEngine::setObjectOwnership(aim.get(), QQmlEngine::JavaScriptOwnership);
{
- QJSValue wrapper = engine.newQObject(aim.data());
+ QJSValue wrapper = engine.newQObject(aim.get());
}
- QScopedPointer<QObject> repeater(component.create());
- QVERIFY(!repeater.isNull());
+ std::unique_ptr<QObject> repeater(component.create());
+ QVERIFY(repeater);
- QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(aim.data()));
+ QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(aim.get()));
- repeater->setProperty("model", QVariant::fromValue<QObject*>(aim.data()));
+ repeater->setProperty("model", QVariant::fromValue<QObject*>(aim.get()));
- QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(aim.data()));
+ QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(aim.get()));
engine.collectGarbage();
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
QVERIFY(modelGuard);
- QScopedPointer<QQmlComponent> delegate(new QQmlComponent(&engine));
+ std::unique_ptr<QQmlComponent> delegate(new QQmlComponent(&engine));
delegate->setData(QByteArrayLiteral("import QtQuick 2.0\nItem{}"), dataDirectoryUrl().resolved(QUrl("inline.qml")));
- QPointer<QQmlComponent> delegateGuard(delegate.data());
- QQmlEngine::setObjectOwnership(delegate.data(), QQmlEngine::JavaScriptOwnership);
+ QPointer<QQmlComponent> delegateGuard(delegate.get());
+ QQmlEngine::setObjectOwnership(delegate.get(), QQmlEngine::JavaScriptOwnership);
{
- QJSValue wrapper = engine.newQObject(delegate.data());
+ QJSValue wrapper = engine.newQObject(delegate.get());
}
- QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(delegate.data()));
+ QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(delegate.get()));
- repeater->setProperty("delegate", QVariant::fromValue<QObject*>(delegate.data()));
+ repeater->setProperty("delegate", QVariant::fromValue<QObject*>(delegate.get()));
- QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(delegate.data()));
+ QVERIFY(!QQmlData::keepAliveDuringGarbageCollection(delegate.get()));
engine.collectGarbage();
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
@@ -1120,8 +1120,8 @@ void tst_QQuickRepeater::ownership()
QVERIFY(delegateGuard);
QVERIFY(modelGuard);
- delegate.take();
- aim.take();
+ delegate.release();
+ aim.release();
engine.collectGarbage();
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);