summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-05-30 13:53:24 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-05 18:42:26 +0200
commit7d28f7772cd8f5aad63359ed0b9c57c12923dc85 (patch)
tree71e1cc4d972f7417b0d510451aacfce2e98eafa7
parentfa7c9bbe1cc71a16835c373095515513ab5949db (diff)
Use QPointer instead of QWeakPointer.
The use of QWeakPointer for tracking QObject pointers is to be deprecated. Change-Id: If460ca7f515db77af24030152f4bd56e1a5fae7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/animation/qabstractanimation.cpp2
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h2
-rw-r--r--src/corelib/plugin/qlibrary_p.h2
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h2
-rw-r--r--src/corelib/statemachine/qstate.cpp2
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qguiapplication_p.h6
-rw-r--r--src/gui/kernel/qinputmethod_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h29
-rw-r--r--src/network/access/qnetworkrequest_p.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h3
-rw-r--r--src/widgets/dialogs/qdialog.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp4
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h4
-rw-r--r--src/widgets/kernel/qaction.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp6
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa_p.h4
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp2
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h2
-rw-r--r--src/widgets/widgets/qmenu.cpp2
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp6
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp4
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp2
-rw-r--r--tests/auto/other/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp8
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp2
26 files changed, 56 insertions, 53 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 969a54775b..e56d1e26d3 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -925,7 +925,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
}
state = newState;
- QWeakPointer<QAbstractAnimation> guard(q);
+ QPointer<QAbstractAnimation> guard(q);
//(un)registration of the animation must always happen before calls to
//virtual function (updateState) to ensure a correct state of the timer
diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h
index c413c683ff..d6c0f9057c 100644
--- a/src/corelib/animation/qpropertyanimation_p.h
+++ b/src/corelib/animation/qpropertyanimation_p.h
@@ -70,7 +70,7 @@ public:
{
}
- QWeakPointer<QObject> target;
+ QPointer<QObject> target;
//we use targetValue to be able to unregister the target from the global hash
QObject *targetValue;
diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h
index 604a5fbdde..ca7b5d9bb4 100644
--- a/src/corelib/plugin/qlibrary_p.h
+++ b/src/corelib/plugin/qlibrary_p.h
@@ -96,7 +96,7 @@ public:
static QVector<QStaticPlugin> staticPlugins();
- QWeakPointer<QObject> inst;
+ QPointer<QObject> inst;
QtPluginInstanceFunction instance;
QJsonObject metaData;
bool compatPlugin;
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index 64a0af7cfb..442398825a 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -80,7 +80,7 @@ public:
QStateMachine *machine() const;
void emitTriggered();
- QList<QWeakPointer<QAbstractState> > targetStates;
+ QList<QPointer<QAbstractState> > targetStates;
#ifndef QT_NO_ANIMATION
QList<QAbstractAnimation*> animations;
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 0230acbab6..14432edd7c 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -299,7 +299,7 @@ void QState::addTransition(QAbstractTransition *transition)
}
transition->setParent(this);
- const QList<QWeakPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
+ const QList<QPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
for (int i = 0; i < targets.size(); ++i) {
QAbstractState *t = targets.at(i).data();
if (!t) {
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 05e1274fef..f71e611303 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1604,7 +1604,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
touchPoint.d = touchPoint.d->detach();
// update state
- QWeakPointer<QWindow> w;
+ QPointer<QWindow> w;
QTouchEvent::TouchPoint previousTouchPoint;
ActiveTouchPointsKey touchInfoKey(e->device, touchPoint.id());
ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];
@@ -1613,7 +1613,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (e->device->type() == QTouchDevice::TouchPad) {
// on touch-pads, send all touch points to the same widget
w = d->activeTouchPoints.isEmpty()
- ? QWeakPointer<QWindow>()
+ ? QPointer<QWindow>()
: d->activeTouchPoints.constBegin().value().window;
}
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 8b7977e87a..e79c2afdf2 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -205,8 +205,8 @@ public:
int touchPointId;
};
struct ActiveTouchPointsValue {
- QWeakPointer<QWindow> window;
- QWeakPointer<QObject> target;
+ QPointer<QWindow> window;
+ QPointer<QObject> target;
QTouchEvent::TouchPoint touchPoint;
};
QHash<ActiveTouchPointsKey, ActiveTouchPointsValue> activeTouchPoints;
@@ -216,7 +216,7 @@ public:
: pos(p), screenPos(sp), window(w) { }
QPointF pos;
QPointF screenPos;
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
};
QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints;
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
index ad3d2141c1..7b24ebe33d 100644
--- a/src/gui/kernel/qinputmethod_p.h
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -85,7 +85,7 @@ public:
bool objectAcceptsInputMethod(QObject *object);
QTransform inputItemTransform;
- QWeakPointer<QObject> inputItem;
+ QPointer<QObject> inputItem;
QPlatformInputContext *testContext;
};
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 3eebaf2dfc..919a7de39b 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -44,6 +44,7 @@
#include "qwindowsysteminterface_qpa.h"
#include <QElapsedTimer>
+#include <QPointer>
QT_BEGIN_HEADER
@@ -88,7 +89,7 @@ public:
public:
explicit CloseEvent(QWindow *w)
: WindowSystemEvent(Close), window(w) { }
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
};
class GeometryChangeEvent : public WindowSystemEvent {
@@ -96,7 +97,7 @@ public:
GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry)
: WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry)
{ }
- QWeakPointer<QWindow> tlw;
+ QPointer<QWindow> tlw;
QRect newGeometry;
};
@@ -105,7 +106,7 @@ public:
explicit EnterEvent(QWindow *enter)
: WindowSystemEvent(Enter), enter(enter)
{ }
- QWeakPointer<QWindow> enter;
+ QPointer<QWindow> enter;
};
class LeaveEvent : public WindowSystemEvent {
@@ -113,7 +114,7 @@ public:
explicit LeaveEvent(QWindow *leave)
: WindowSystemEvent(Leave), leave(leave)
{ }
- QWeakPointer<QWindow> leave;
+ QPointer<QWindow> leave;
};
class ActivatedWindowEvent : public WindowSystemEvent {
@@ -121,7 +122,7 @@ public:
explicit ActivatedWindowEvent(QWindow *activatedWindow)
: WindowSystemEvent(ActivatedWindow), activated(activatedWindow)
{ }
- QWeakPointer<QWindow> activated;
+ QPointer<QWindow> activated;
};
class WindowStateChangedEvent : public WindowSystemEvent {
@@ -130,7 +131,7 @@ public:
: WindowSystemEvent(WindowStateChanged), window(_window), newState(_newState)
{ }
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
Qt::WindowState newState;
};
@@ -138,7 +139,7 @@ public:
public:
UserEvent(QWindow * w, ulong time, EventType t)
: WindowSystemEvent(t), window(w), nullWindow(w == 0), timestamp(time) { }
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
bool nullWindow;
unsigned long timestamp;
};
@@ -209,7 +210,7 @@ public:
public:
ScreenOrientationEvent(QScreen *s, Qt::ScreenOrientation o)
: WindowSystemEvent(ScreenOrientation), screen(s), orientation(o) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
Qt::ScreenOrientation orientation;
};
@@ -217,7 +218,7 @@ public:
public:
ScreenGeometryEvent(QScreen *s, const QRect &g)
: WindowSystemEvent(ScreenGeometry), screen(s), geometry(g) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
QRect geometry;
};
@@ -225,7 +226,7 @@ public:
public:
ScreenAvailableGeometryEvent(QScreen *s, const QRect &g)
: WindowSystemEvent(ScreenAvailableGeometry), screen(s), availableGeometry(g) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
QRect availableGeometry;
};
@@ -233,7 +234,7 @@ public:
public:
ScreenLogicalDotsPerInchEvent(QScreen *s, qreal dx, qreal dy)
: WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s), dpiX(dx), dpiY(dy) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
qreal dpiX;
qreal dpiY;
};
@@ -242,7 +243,7 @@ public:
public:
ScreenRefreshRateEvent(QScreen *s, qreal r)
: WindowSystemEvent(ScreenRefreshRate), screen(s), rate(r) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
qreal rate;
};
@@ -250,13 +251,13 @@ public:
public:
explicit ThemeChangeEvent(QWindow * w)
: WindowSystemEvent(ThemeChange), window(w) { }
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
};
class ExposeEvent : public WindowSystemEvent {
public:
ExposeEvent(QWindow *exposed, const QRegion &region);
- QWeakPointer<QWindow> exposed;
+ QPointer<QWindow> exposed;
bool isExposed;
QRegion region;
};
diff --git a/src/network/access/qnetworkrequest_p.h b/src/network/access/qnetworkrequest_p.h
index 13861cc80e..0df886cfc2 100644
--- a/src/network/access/qnetworkrequest_p.h
+++ b/src/network/access/qnetworkrequest_p.h
@@ -59,6 +59,7 @@
#include "QtCore/qhash.h"
#include "QtCore/qshareddata.h"
#include "QtCore/qsharedpointer.h"
+#include "QtCore/qpointer.h"
QT_BEGIN_NAMESPACE
@@ -74,7 +75,7 @@ public:
RawHeadersList rawHeaders;
CookedHeadersMap cookedHeaders;
AttributesMap attributes;
- QWeakPointer<QObject> originatingObject;
+ QPointer<QObject> originatingObject;
RawHeadersList::ConstIterator findRawHeader(const QByteArray &key) const;
RawHeadersList allRawHeaders() const;
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index b404d26ed5..2666e5925c 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -50,6 +50,7 @@
#include <qpoint.h>
#include <qrect.h>
#include <qsharedpointer.h>
+#include <qpointer.h>
#include <qvector.h>
#include <qpixmap.h>
@@ -113,7 +114,7 @@ private:
Qt::DropAction toDropAction(xcb_atom_t atom) const;
xcb_atom_t toXdndAction(Qt::DropAction a) const;
- QWeakPointer<QWindow> currentWindow;
+ QPointer<QWindow> currentWindow;
QPoint currentPosition;
QXcbDropData *dropData;
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 97a5b6d454..0e57a16757 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -624,7 +624,7 @@ void QDialog::contextMenuEvent(QContextMenuEvent *e)
while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis))
w = w->isWindow() ? 0 : w->parentWidget();
if (w) {
- QWeakPointer<QMenu> p = new QMenu(this);
+ QPointer<QMenu> p = new QMenu(this);
QAction *wt = p.data()->addAction(tr("What's This?"));
if (p.data()->exec(e->globalPos()) == wt) {
QHelpEvent e(QEvent::WhatsThis, w->rect().center(),
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index a63403a039..6feeb943b7 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -6067,7 +6067,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
// initial gesture targets
if (!conflictedGestures.isEmpty()) {
for (int i = 0; i < cachedTargetItems.size(); ++i) {
- QWeakPointer<QGraphicsObject> item = cachedTargetItems.at(i);
+ QPointer<QGraphicsObject> item = cachedTargetItems.at(i);
// get gestures to deliver to the current item
QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data());
@@ -6153,7 +6153,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
}
qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
for (int i = 0; i < cachedTargetItems.size(); ++i) {
- QWeakPointer<QGraphicsObject> receiver = cachedTargetItems.at(i);
+ QPointer<QGraphicsObject> receiver = cachedTargetItems.at(i);
QSet<QGesture *> gestures =
undeliveredGestures & cachedItemGestures.value(receiver.data());
gestures -= cachedAlreadyDeliveredGestures.value(receiver.data());
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index 3826f3b4e9..63f7488704 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -71,10 +71,10 @@
QT_BEGIN_NAMESPACE
struct QEditorInfo {
- QEditorInfo(QWidget *e, bool s): widget(QWeakPointer<QWidget>(e)), isStatic(s) {}
+ QEditorInfo(QWidget *e, bool s): widget(QPointer<QWidget>(e)), isStatic(s) {}
QEditorInfo(): isStatic(false) {}
- QWeakPointer<QWidget> widget;
+ QPointer<QWidget> widget;
bool isStatic;
};
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 0d500c81d6..05d250e73a 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -1181,7 +1181,7 @@ void QAction::activate(ActionEvent event)
{
Q_D(QAction);
if(event == Trigger) {
- QWeakPointer<QObject> guard = this;
+ QPointer<QObject> guard = this;
if(d->checkable) {
// the checked action of an exclusive group cannot be unchecked
if (d->checked && (d->group && d->group->isExclusive()
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 1ca30c5819..e9003e8c14 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3425,7 +3425,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents);
touchEvent->setTarget(widget);
touchEvent->setAccepted(acceptTouchEvents);
- QWeakPointer<QWidget> p = widget;
+ QPointer<QWidget> p = widget;
res = acceptTouchEvents && d->notify_helper(widget, touchEvent);
eventAccepted = touchEvent->isAccepted();
if (p.isNull()) {
@@ -4369,14 +4369,14 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
touchPoint.d = touchPoint.d->detach();
// update state
- QWeakPointer<QObject> target;
+ QPointer<QObject> target;
ActiveTouchPointsKey touchInfoKey(device, touchPoint.id());
ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];
if (touchPoint.state() == Qt::TouchPointPressed) {
if (device->type() == QTouchDevice::TouchPad) {
// on touch-pads, send all touch points to the same widget
target = d->activeTouchPoints.isEmpty()
- ? QWeakPointer<QObject>()
+ ? QPointer<QObject>()
: d->activeTouchPoints.constBegin().value().target;
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 454ffd5eb7..e6a760abde 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2459,7 +2459,7 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
Q_Q(QWidget);
QStyle *oldStyle = q->style();
#ifndef QT_NO_STYLE_STYLESHEET
- QWeakPointer<QStyle> origStyle;
+ QPointer<QStyle> origStyle;
#endif
#ifdef Q_WS_MAC
diff --git a/src/widgets/kernel/qwidgetwindow_qpa_p.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h
index d4fd37c456..8afa3f33cd 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa_p.h
+++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h
@@ -95,9 +95,9 @@ private:
void updateGeometry();
QWidget *m_widget;
- QWeakPointer<QWidget> m_implicit_mouse_grabber;
+ QPointer<QWidget> m_implicit_mouse_grabber;
#ifndef QT_NO_DRAGANDDROP
- QWeakPointer<QWidget> m_dragTarget;
+ QPointer<QWidget> m_dragTarget;
#endif
};
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 4c418bde9e..b916212871 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2598,7 +2598,7 @@ void QCalendarPopup::setCalendarWidget(QCalendarWidget *cw)
widgetLayout->setSpacing(0);
}
delete calendar.data();
- calendar = QWeakPointer<QCalendarWidget>(cw);
+ calendar = QPointer<QCalendarWidget>(cw);
widgetLayout->addWidget(cw);
connect(cw, SIGNAL(activated(QDate)), this, SLOT(dateSelected(QDate)));
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 35f0f57f54..f7e6861677 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -173,7 +173,7 @@ protected:
private:
QCalendarWidget *verifyCalendarInstance();
- QWeakPointer<QCalendarWidget> calendar;
+ QPointer<QCalendarWidget> calendar;
QDate oldDate;
bool dateChanged;
};
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 8d50b03edb..4747d1c661 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1098,7 +1098,7 @@ void QMenuPrivate::_q_actionTriggered()
{
Q_Q(QMenu);
if (QAction *action = qobject_cast<QAction *>(q->sender())) {
- QWeakPointer<QAction> actionGuard = action;
+ QPointer<QAction> actionGuard = action;
emit q->triggered(action);
if (!activationRecursionGuard && actionGuard) {
//in case the action has not been activated by the mouse
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<QObject> p = object;
+ QPointer<QObject> 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<QThread> weak(static_cast<QThread*>(thr));
+ QPointer<QThread> weak(static_cast<QThread*>(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<DummyEventDispatcher> weak_ed(ed);
+ QPointer<DummyEventDispatcher> 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<QWidget> p;
+ QPointer<QWidget> 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<QWidget> pl = leftWidget, pc = centerWidget, pr = rightWidget;
+ QPointer<QWidget> pl = leftWidget, pc = centerWidget, pr = rightWidget;
QList<QTouchEvent::TouchPoint> 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<QObject> receiver(object);
+ QPointer<QObject> 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<QWidget> ptr = w;
+ QPointer<QWidget> 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<QWidget> ptr = w;
+ QPointer<QWidget> 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<QWidget> ptr = w;
+ QPointer<QWidget> 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<QWidget> ptr(new QWidget);
- QWeakPointer<QWidget> weak = ptr.data();
+ QPointer<QWidget> weak = ptr.data();
QWeakPointer<QWidget> 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<QAction> a = m.addAction("action");
+ QPointer<QAction> a = m.addAction("action");
a.data()->trigger();
QVERIFY(!a);
}