From 7d28f7772cd8f5aad63359ed0b9c57c12923dc85 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 30 May 2012 13:53:24 +0200 Subject: Use QPointer instead of QWeakPointer. The use of QWeakPointer for tracking QObject pointers is to be deprecated. Change-Id: If460ca7f515db77af24030152f4bd56e1a5fae7c Reviewed-by: Thiago Macieira --- tests/auto/corelib/thread/qthread/tst_qthread.cpp | 6 +++--- tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp | 4 ++-- tests/auto/other/gestures/tst_gestures.cpp | 2 +- .../qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp | 8 ++++---- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index da49f43b7d..c9c19515d0 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -1043,7 +1043,7 @@ void tst_QThread::connectThreadFinishedSignalToObjectDeleteLaterSlot() { QThread thread; QObject *object = new QObject; - QWeakPointer p = object; + QPointer p = object; QVERIFY(!p.isNull()); connect(&thread, SIGNAL(started()), &thread, SLOT(quit()), Qt::DirectConnection); connect(&thread, SIGNAL(finished()), object, SLOT(deleteLater())); @@ -1128,7 +1128,7 @@ void tst_QThread::destroyFinishRace() for (int i = 0; i < 15; i++) { Thread *thr = new Thread; connect(thr, SIGNAL(finished()), thr, SLOT(deleteLater())); - QWeakPointer weak(static_cast(thr)); + QPointer weak(static_cast(thr)); thr->start(); while (weak) { qApp->processEvents(); @@ -1284,7 +1284,7 @@ void tst_QThread::customEventDispatcher() // test that the ED has really been used QVERIFY(ed->visited); - QWeakPointer weak_ed(ed); + QPointer weak_ed(ed); QVERIFY(!weak_ed.isNull()); thr.quit(); // wait for thread to be stopped diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index 997e15ed55..3adf2868be 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -1189,7 +1189,7 @@ void tst_QTouchEvent::deleteInEventHandler() Qt::NoModifier, Qt::TouchPointReleased, touchPoints); - QWeakPointer p; + QPointer p; bool res; touchBeginEvent.ignore(); @@ -1339,7 +1339,7 @@ void tst_QTouchEvent::deleteInRawEventTranslation() QPointF rightScreenPos = rightWidget->mapToGlobal(rightPos.toPoint()); QRectF screenGeometry = qApp->desktop()->screenGeometry(&touchWidget); - QWeakPointer pl = leftWidget, pc = centerWidget, pr = rightWidget; + QPointer pl = leftWidget, pc = centerWidget, pr = rightWidget; QList rawTouchPoints; rawTouchPoints.append(QTouchEvent::TouchPoint(0)); diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index 81881fc700..917337a7d9 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -300,7 +300,7 @@ public Q_SLOTS: // TODO rename to sendGestureSequence static void sendCustomGesture(CustomEvent *event, QObject *object, QGraphicsScene *scene = 0) { - QWeakPointer receiver(object); + QPointer receiver(object); for (int i = CustomGesture::SerialMaybeThreshold; i <= CustomGesture::SerialFinishedThreshold && receiver; ++i) { event->serial = i; diff --git a/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp b/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp index 6540ab596b..ebfec4d457 100644 --- a/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp +++ b/tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp @@ -76,7 +76,7 @@ public: void tst_QSharedPointer_and_QWidget::weak_externalDelete() { QWidget *w = new QWidget; - QWeakPointer ptr = w; + QPointer ptr = w; QVERIFY(!ptr.isNull()); @@ -88,7 +88,7 @@ void tst_QSharedPointer_and_QWidget::weak_parentDelete() { QWidget *parent = new QWidget; QWidget *w = new QWidget(parent); - QWeakPointer ptr = w; + QPointer ptr = w; QVERIFY(!ptr.isNull()); @@ -100,7 +100,7 @@ void tst_QSharedPointer_and_QWidget::weak_parentDelete_setParent() { QWidget *parent = new QWidget; QWidget *w = new QWidget; - QWeakPointer ptr = w; + QPointer ptr = w; w->setParent(parent); QVERIFY(!ptr.isNull()); @@ -114,7 +114,7 @@ void tst_QSharedPointer_and_QWidget::weak_parentDelete_setParent() void tst_QSharedPointer_and_QWidget::strong_weak() { QSharedPointer ptr(new QWidget); - QWeakPointer weak = ptr.data(); + QPointer weak = ptr.data(); QWeakPointer weak2 = ptr; QVERIFY(!weak.isNull()); diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 473c5e05ec..d5e8dce860 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -816,7 +816,7 @@ void tst_QMenu::deleteActionInTriggered() // should not crash QMenu m; QObject::connect(&m, SIGNAL(triggered(QAction*)), this, SLOT(deleteAction(QAction*))); - QWeakPointer a = m.addAction("action"); + QPointer a = m.addAction("action"); a.data()->trigger(); QVERIFY(!a); } -- cgit v1.2.3