}
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
{
}
- QWeakPointer<QObject> target;
+ QPointer<QObject> target;
//we use targetValue to be able to unregister the target from the global hash
QObject *targetValue;
static QVector<QStaticPlugin> staticPlugins();
- QWeakPointer<QObject> inst;
+ QPointer<QObject> inst;
QtPluginInstanceFunction instance;
QJsonObject metaData;
bool compatPlugin;
QStateMachine *machine() const;
void emitTriggered();
- QList<QWeakPointer<QAbstractState> > targetStates;
+ QList<QPointer<QAbstractState> > targetStates;
#ifndef QT_NO_ANIMATION
QList<QAbstractAnimation*> animations;
}
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) {
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];
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;
}
int touchPointId;
};
struct ActiveTouchPointsValue {
- QWeakPointer<QWindow> window;
- QWeakPointer<QObject> target;
+ QPointer<QWindow> window;
+ QPointer<QObject> target;
QTouchEvent::TouchPoint touchPoint;
};
QHash<ActiveTouchPointsKey, ActiveTouchPointsValue> activeTouchPoints;
: pos(p), screenPos(sp), window(w) { }
QPointF pos;
QPointF screenPos;
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
};
QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints;
bool objectAcceptsInputMethod(QObject *object);
QTransform inputItemTransform;
- QWeakPointer<QObject> inputItem;
+ QPointer<QObject> inputItem;
QPlatformInputContext *testContext;
};
#include "qwindowsysteminterface_qpa.h"
#include <QElapsedTimer>
+#include <QPointer>
QT_BEGIN_HEADER
public:
explicit CloseEvent(QWindow *w)
: WindowSystemEvent(Close), window(w) { }
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
};
class GeometryChangeEvent : public WindowSystemEvent {
GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry)
: WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry)
{ }
- QWeakPointer<QWindow> tlw;
+ QPointer<QWindow> tlw;
QRect newGeometry;
};
explicit EnterEvent(QWindow *enter)
: WindowSystemEvent(Enter), enter(enter)
{ }
- QWeakPointer<QWindow> enter;
+ QPointer<QWindow> enter;
};
class LeaveEvent : public WindowSystemEvent {
explicit LeaveEvent(QWindow *leave)
: WindowSystemEvent(Leave), leave(leave)
{ }
- QWeakPointer<QWindow> leave;
+ QPointer<QWindow> leave;
};
class ActivatedWindowEvent : public WindowSystemEvent {
explicit ActivatedWindowEvent(QWindow *activatedWindow)
: WindowSystemEvent(ActivatedWindow), activated(activatedWindow)
{ }
- QWeakPointer<QWindow> activated;
+ QPointer<QWindow> activated;
};
class WindowStateChangedEvent : public WindowSystemEvent {
: WindowSystemEvent(WindowStateChanged), window(_window), newState(_newState)
{ }
- QWeakPointer<QWindow> window;
+ QPointer<QWindow> window;
Qt::WindowState newState;
};
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;
};
public:
ScreenOrientationEvent(QScreen *s, Qt::ScreenOrientation o)
: WindowSystemEvent(ScreenOrientation), screen(s), orientation(o) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
Qt::ScreenOrientation orientation;
};
public:
ScreenGeometryEvent(QScreen *s, const QRect &g)
: WindowSystemEvent(ScreenGeometry), screen(s), geometry(g) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
QRect geometry;
};
public:
ScreenAvailableGeometryEvent(QScreen *s, const QRect &g)
: WindowSystemEvent(ScreenAvailableGeometry), screen(s), availableGeometry(g) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
QRect availableGeometry;
};
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;
};
public:
ScreenRefreshRateEvent(QScreen *s, qreal r)
: WindowSystemEvent(ScreenRefreshRate), screen(s), rate(r) { }
- QWeakPointer<QScreen> screen;
+ QPointer<QScreen> screen;
qreal rate;
};
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;
};
#include "QtCore/qhash.h"
#include "QtCore/qshareddata.h"
#include "QtCore/qsharedpointer.h"
+#include "QtCore/qpointer.h"
QT_BEGIN_NAMESPACE
RawHeadersList rawHeaders;
CookedHeadersMap cookedHeaders;
AttributesMap attributes;
- QWeakPointer<QObject> originatingObject;
+ QPointer<QObject> originatingObject;
RawHeadersList::ConstIterator findRawHeader(const QByteArray &key) const;
RawHeadersList allRawHeaders() const;
#include <qpoint.h>
#include <qrect.h>
#include <qsharedpointer.h>
+#include <qpointer.h>
#include <qvector.h>
#include <qpixmap.h>
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;
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(),
// 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());
}
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());
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;
};
{
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()
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()) {
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;
}
Q_Q(QWidget);
QStyle *oldStyle = q->style();
#ifndef QT_NO_STYLE_STYLESHEET
- QWeakPointer<QStyle> origStyle;
+ QPointer<QStyle> origStyle;
#endif
#ifdef Q_WS_MAC
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
};
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)));
private:
QCalendarWidget *verifyCalendarInstance();
- QWeakPointer<QCalendarWidget> calendar;
+ QPointer<QCalendarWidget> calendar;
QDate oldDate;
bool dateChanged;
};
{
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
{
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()));
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();
// 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
Qt::NoModifier,
Qt::TouchPointReleased,
touchPoints);
- QWeakPointer<QWidget> p;
+ QPointer<QWidget> p;
bool res;
touchBeginEvent.ignore();
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));
// 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;
void tst_QSharedPointer_and_QWidget::weak_externalDelete()
{
QWidget *w = new QWidget;
- QWeakPointer<QWidget> ptr = w;
+ QPointer<QWidget> ptr = w;
QVERIFY(!ptr.isNull());
{
QWidget *parent = new QWidget;
QWidget *w = new QWidget(parent);
- QWeakPointer<QWidget> ptr = w;
+ QPointer<QWidget> ptr = w;
QVERIFY(!ptr.isNull());
{
QWidget *parent = new QWidget;
QWidget *w = new QWidget;
- QWeakPointer<QWidget> ptr = w;
+ QPointer<QWidget> ptr = w;
w->setParent(parent);
QVERIFY(!ptr.isNull());
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());
// 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);
}