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>bb10
parent
fa7c9bbe1c
commit
7d28f7772c
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public:
|
|||
static QVector<QStaticPlugin> staticPlugins();
|
||||
|
||||
|
||||
QWeakPointer<QObject> inst;
|
||||
QPointer<QObject> inst;
|
||||
QtPluginInstanceFunction instance;
|
||||
QJsonObject metaData;
|
||||
bool compatPlugin;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
bool objectAcceptsInputMethod(QObject *object);
|
||||
|
||||
QTransform inputItemTransform;
|
||||
QWeakPointer<QObject> inputItem;
|
||||
QPointer<QObject> inputItem;
|
||||
QPlatformInputContext *testContext;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ®ion);
|
||||
QWeakPointer<QWindow> exposed;
|
||||
QPointer<QWindow> exposed;
|
||||
bool isExposed;
|
||||
QRegion region;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ protected:
|
|||
private:
|
||||
QCalendarWidget *verifyCalendarInstance();
|
||||
|
||||
QWeakPointer<QCalendarWidget> calendar;
|
||||
QPointer<QCalendarWidget> calendar;
|
||||
QDate oldDate;
|
||||
bool dateChanged;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue