diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-07-05 13:29:57 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-05 15:02:58 +0200 |
commit | 5d6f8b18fe77d2fc17a3c1d77d1c4baeff0e9704 (patch) | |
tree | 507f652c897825a7f6b3a09a5dd2c09d6c1797f4 /src/qml | |
parent | 2e4d1ccb18aba13f94670d3d1104839fecf2ab5c (diff) |
Get rid of the first half of QQmlGuard usage
QQmlGuard was being used as a more performant replacement
for QPointer. QPointer got now fixed in Qt 5.0, making this
class obsolete.
Change-Id: I77eef066c4823af4b074ef32d4d78dbd67c36cd0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
25 files changed, 43 insertions, 50 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 382b85685a..cd5d1e96b7 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1102,7 +1102,7 @@ public: static void markObjects(Managed *that); QV8Engine *v8; - QQmlGuard<QObject> parent; + QPointer<QObject> parent; QV4::Value valuemap; QV4::Value qmlGlobal; QV4::Value m_statusChanged; diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h index 646135b61f..0f44952567 100644 --- a/src/qml/qml/qqmlcontextwrapper_p.h +++ b/src/qml/qml/qqmlcontextwrapper_p.h @@ -93,7 +93,7 @@ struct Q_QML_EXPORT QmlContextWrapper : Object bool isNullWrapper; QQmlGuardedContextData context; - QQmlGuard<QObject> scopeObject; + QPointer<QObject> scopeObject; }; } diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index be1c28c62b..2b186dbb75 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -986,7 +986,7 @@ QQmlNetworkAccessManagerFactory *QQmlEngine::networkAccessManagerFactory() const void QQmlEnginePrivate::registerFinalizeCallback(QObject *obj, int index) { if (activeVME) { - activeVME->finalizeCallbacks.append(qMakePair(QQmlGuard<QObject>(obj), index)); + activeVME->finalizeCallbacks.append(qMakePair(QPointer<QObject>(obj), index)); } else { void *args[] = { 0 }; QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, index, args); diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index b300dcc791..c57c70fa40 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -162,7 +162,7 @@ public: QUrl baseUrl; - typedef QPair<QQmlGuard<QObject>,int> FinalizeCallback; + typedef QPair<QPointer<QObject>,int> FinalizeCallback; void registerFinalizeCallback(QObject *obj, int index); QQmlVME *activeVME; diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h index b7f5624fb2..9cc5a326f8 100644 --- a/src/qml/qml/qqmlexpression_p.h +++ b/src/qml/qml/qqmlexpression_p.h @@ -55,7 +55,6 @@ #include "qqmlexpression.h" -#include <private/qqmlguard_p.h> #include <private/qqmlengine_p.h> #include <private/qfieldlist_p.h> #include <private/qflagpointer_p.h> diff --git a/src/qml/qml/qqmlincubator_p.h b/src/qml/qml/qqmlincubator_p.h index 54be20d68f..229919f37a 100644 --- a/src/qml/qml/qqmlincubator_p.h +++ b/src/qml/qml/qqmlincubator_p.h @@ -85,7 +85,7 @@ public: enum Progress { Execute, Completing, Completed }; Progress progress; - QQmlGuard<QObject> result; + QPointer<QObject> result; QQmlGuardedContextData rootContext; QQmlCompiledData *compiledData; QQmlVME vme; diff --git a/src/qml/qml/qqmllist_p.h b/src/qml/qml/qqmllist_p.h index a39730049d..48732223dd 100644 --- a/src/qml/qml/qqmllist_p.h +++ b/src/qml/qml/qqmllist_p.h @@ -54,7 +54,6 @@ // #include "qqmllist.h" -#include "qqmlguard_p.h" #include "qqmlpropertycache_p.h" QT_BEGIN_NAMESPACE @@ -66,7 +65,7 @@ public: static QQmlListReference init(const QQmlListProperty<QObject> &, int, QQmlEngine *); - QQmlGuard<QObject> object; + QPointer<QObject> object; QQmlMetaObject elementType; QQmlListProperty<QObject> property; int propertyType; diff --git a/src/qml/qml/qqmllistwrapper_p.h b/src/qml/qml/qqmllistwrapper_p.h index 83624d1423..c87b9b22d5 100644 --- a/src/qml/qml/qqmllistwrapper_p.h +++ b/src/qml/qml/qqmllistwrapper_p.h @@ -54,8 +54,9 @@ // #include <QtCore/qglobal.h> +#include <QtCore/qpointer.h> + #include <QtQml/qqmllist.h> -#include <private/qqmlguard_p.h> #include <private/qv4value_p.h> #include <private/qv4object_p.h> @@ -88,7 +89,7 @@ public: private: QV8Engine *v8; - QQmlGuard<QObject> object; + QPointer<QObject> object; QQmlListProperty<QObject> property; int propertyType; diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 188fa7db0d..f3b4d6b1e5 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -44,7 +44,6 @@ #include <private/qqmlproxymetaobject_p.h> #include <private/qqmlcustomparser_p.h> -#include <private/qqmlguard_p.h> #include <private/qhashedstring_p.h> #include <private/qqmlimport_p.h> diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h index ea4a3e7822..93f2cd68da 100644 --- a/src/qml/qml/qqmlnotifier_p.h +++ b/src/qml/qml/qqmlnotifier_p.h @@ -43,7 +43,6 @@ #define QQMLNOTIFIER_P_H #include "qqmldata_p.h" -#include "qqmlguard_p.h" #include <QtCore/qmetaobject.h> #include <private/qmetaobject_p.h> diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h index 6482432a20..9af091ad46 100644 --- a/src/qml/qml/qqmlproperty_p.h +++ b/src/qml/qml/qqmlproperty_p.h @@ -59,7 +59,6 @@ #include <private/qobject_p.h> #include <private/qtqmlglobal_p.h> #include <private/qqmlpropertycache_p.h> -#include <private/qqmlguard_p.h> #include <private/qqmlboundsignalexpressionpointer_p.h> QT_BEGIN_NAMESPACE @@ -78,8 +77,8 @@ public: Q_DECLARE_FLAGS(WriteFlags, WriteFlag) QQmlContextData *context; - QQmlGuard<QQmlEngine> engine; - QQmlGuard<QObject> object; + QPointer<QQmlEngine> engine; + QPointer<QObject> object; QQmlPropertyData core; diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h index 9ad364e94d..ae70367dc4 100644 --- a/src/qml/qml/qqmltypewrapper_p.h +++ b/src/qml/qml/qqmltypewrapper_p.h @@ -54,8 +54,8 @@ // #include <QtCore/qglobal.h> +#include <QtCore/qpointer.h> -#include <private/qqmlguard_p.h> #include <private/qv4value_p.h> #include <private/qv4object_p.h> @@ -89,7 +89,7 @@ public: private: QV8Engine *v8; TypeNameMode mode; - QQmlGuard<QObject> object; + QPointer<QObject> object; QQmlType *type; QQmlTypeNameCache *typeNamespace; diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index 7355e0df02..05412e99a7 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -63,7 +63,7 @@ class QmlValueTypeReference : public QmlValueTypeWrapper public: QmlValueTypeReference(QV8Engine *engine); - QQmlGuard<QObject> object; + QPointer<QObject> object; int property; }; diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index e4a996fac6..e32193e6f6 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -1367,7 +1367,7 @@ void QQmlVMEGuard::guard(QQmlVME *vme) clear(); m_objectCount = vme->objects.count(); - m_objects = new QQmlGuard<QObject>[m_objectCount]; + m_objects = new QPointer<QObject>[m_objectCount]; for (int ii = 0; ii < m_objectCount; ++ii) m_objects[ii] = vme->objects[ii]; diff --git a/src/qml/qml/qqmlvme_p.h b/src/qml/qml/qqmlvme_p.h index 750076f277..09e3237aee 100644 --- a/src/qml/qml/qqmlvme_p.h +++ b/src/qml/qml/qqmlvme_p.h @@ -202,7 +202,7 @@ public: private: int m_objectCount; - QQmlGuard<QObject> *m_objects; + QPointer<QObject> *m_objects; int m_contextCount; QQmlGuardedContextData *m_contexts; }; diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 162f3dbd22..115814914d 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1047,7 +1047,7 @@ private: QString m_statusText; QNetworkRequest m_request; QStringList m_addedHeaders; - QQmlGuard<QNetworkReply> m_network; + QPointer<QNetworkReply> m_network; void destroyNetwork(); QNetworkAccessManager *m_nam; diff --git a/src/qml/qml/v4/qv4include_p.h b/src/qml/qml/v4/qv4include_p.h index 76f5ec3e9a..d6bbcd1a60 100644 --- a/src/qml/qml/v4/qv4include_p.h +++ b/src/qml/qml/v4/qv4include_p.h @@ -57,7 +57,6 @@ #include <QtCore/qurl.h> #include <private/qqmlcontext_p.h> -#include <private/qqmlguard_p.h> #include <private/qv4value_p.h> #include <private/qv4context_p.h> @@ -96,7 +95,7 @@ private: QV4::ExecutionEngine *v4; QNetworkAccessManager *m_network; - QQmlGuard<QNetworkReply> m_reply; + QPointer<QNetworkReply> m_reply; QUrl m_url; int m_redirectCount; diff --git a/src/qml/qml/v4/qv4qobjectwrapper.cpp b/src/qml/qml/v4/qv4qobjectwrapper.cpp index dc7b50edd3..f79675845b 100644 --- a/src/qml/qml/v4/qv4qobjectwrapper.cpp +++ b/src/qml/qml/v4/qv4qobjectwrapper.cpp @@ -41,7 +41,6 @@ #include "qv4qobjectwrapper_p.h" -#include <private/qqmlguard_p.h> #include <private/qqmlpropertycache_p.h> #include <private/qqmlengine_p.h> #include <private/qqmlvmemetaobject_p.h> @@ -924,7 +923,7 @@ namespace { void QObjectWrapper::collectDeletables(Managed *m, GCDeletable **deletable) { QObjectWrapper *This = static_cast<QObjectWrapper*>(m); - QQmlGuard<QObject> &object = This->m_object; + QPointer<QObject> &object = This->m_object; if (!object) return; @@ -1652,7 +1651,7 @@ QV4::Value QObjectMethod::method_toString(QV4::ExecutionContext *ctx) result += QString::fromUtf8(m_object->metaObject()->className()); result += QLatin1String("(0x"); - result += QString::number((quintptr)m_object.object(),16); + result += QString::number((quintptr)m_object.data(),16); if (!objectName.isEmpty()) { result += QLatin1String(", \""); diff --git a/src/qml/qml/v4/qv4qobjectwrapper_p.h b/src/qml/qml/v4/qv4qobjectwrapper_p.h index 73f19acb3f..6580d19fe9 100644 --- a/src/qml/qml/v4/qv4qobjectwrapper_p.h +++ b/src/qml/qml/v4/qv4qobjectwrapper_p.h @@ -101,7 +101,7 @@ private: QQmlPropertyData *findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const; - QQmlGuard<QObject> m_object; + QPointer<QObject> m_object; String *m_destroy; String *m_toString; @@ -137,7 +137,7 @@ private: QV4::Value method_toString(QV4::ExecutionContext *ctx); QV4::Value method_destroy(QV4::ExecutionContext *ctx, Value *args, int argc); - QQmlGuard<QObject> m_object; + QPointer<QObject> m_object; int m_index; QV4::PersistentValue m_qmlGlobal; @@ -161,7 +161,7 @@ struct QmlSignalHandler : public QV4::Object QObject *object() const { return m_object.data(); } private: - QQmlGuard<QObject> m_object; + QPointer<QObject> m_object; int m_signalIndex; static void destroy(Managed *that) diff --git a/src/qml/qml/v4/qv4sequenceobject.cpp b/src/qml/qml/v4/qv4sequenceobject.cpp index 454b327efb..be431e3c19 100644 --- a/src/qml/qml/v4/qv4sequenceobject.cpp +++ b/src/qml/qml/v4/qv4sequenceobject.cpp @@ -480,7 +480,7 @@ private: } mutable Container m_container; - QQmlGuard<QObject> m_object; + QPointer<QObject> m_object; int m_propertyIndex; bool m_isReference; diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp index 4c4e541e11..129a81ee50 100644 --- a/src/qml/types/qqmlbind.cpp +++ b/src/qml/types/qqmlbind.cpp @@ -44,7 +44,6 @@ #include <private/qqmlnullablevalue_p_p.h> #include <private/qqmlproperty_p.h> #include <private/qqmlbinding_p.h> -#include <private/qqmlguard_p.h> #include <qqmlengine.h> #include <qqmlcontext.h> @@ -66,7 +65,7 @@ public: QQmlNullableValue<bool> when; bool componentComplete; - QQmlGuard<QObject> obj; + QPointer<QObject> obj; QString propName; QQmlNullableValue<QVariant> value; QQmlProperty prop; diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index 4e1adf175a..7931c4e18c 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -80,7 +80,7 @@ public: int parseGroups(const QStringList &groupNames) const; int parseGroups(const QV4::Value &groupNames) const; - QQmlGuard<QQmlDelegateModel> model; + QPointer<QQmlDelegateModel> model; const int groupCount; QV8Engine * const v8Engine; QQmlDelegateModelAttachedMetaObject *metaObject; @@ -231,7 +231,7 @@ public: QQmlV4Function *args, Compositor::Group *group, int *index, int *count, int *groups) const; Compositor::Group group; - QQmlGuard<QQmlDelegateModel> model; + QPointer<QQmlDelegateModel> model; QQmlDelegateModelGroupEmitterList emitters; QQmlChangeSet changeSet; QString name; diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index f371429779..4c0b382439 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -121,7 +121,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(const QV4::String *key, Role const ListLayout::Role &ListLayout::createRole(const QString &key, ListLayout::Role::DataType type) { - const int dataSizes[] = { sizeof(QString), sizeof(double), sizeof(bool), sizeof(ListModel *), sizeof(QQmlGuard<QObject>), sizeof(QVariantMap), sizeof(QDateTime) }; + const int dataSizes[] = { sizeof(QString), sizeof(double), sizeof(bool), sizeof(ListModel *), sizeof(QPointer<QObject>), sizeof(QVariantMap), sizeof(QDateTime) }; const int dataAlignments[] = { sizeof(QString), sizeof(double), sizeof(bool), sizeof(ListModel *), sizeof(QObject *), sizeof(QVariantMap), sizeof(QDateTime) }; Role *r = new Role; @@ -636,7 +636,7 @@ QString *ListElement::getStringProperty(const ListLayout::Role &role) QObject *ListElement::getQObjectProperty(const ListLayout::Role &role) { char *mem = getPropertyMemory(role); - QQmlGuard<QObject> *o = reinterpret_cast<QQmlGuard<QObject> *>(mem); + QPointer<QObject> *o = reinterpret_cast<QPointer<QObject> *>(mem); return o->data(); } @@ -662,22 +662,22 @@ QDateTime *ListElement::getDateTimeProperty(const ListLayout::Role &role) return dt; } -QQmlGuard<QObject> *ListElement::getGuardProperty(const ListLayout::Role &role) +QPointer<QObject> *ListElement::getGuardProperty(const ListLayout::Role &role) { char *mem = getPropertyMemory(role); bool existingGuard = false; - for (size_t i=0 ; i < sizeof(QQmlGuard<QObject>) ; ++i) { + for (size_t i=0 ; i < sizeof(QPointer<QObject>) ; ++i) { if (mem[i] != 0) { existingGuard = true; break; } } - QQmlGuard<QObject> *o = 0; + QPointer<QObject> *o = 0; if (existingGuard) - o = reinterpret_cast<QQmlGuard<QObject> *>(mem); + o = reinterpret_cast<QPointer<QObject> *>(mem); return o; } @@ -733,7 +733,7 @@ QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListMo break; case ListLayout::Role::QObject: { - QQmlGuard<QObject> *guard = reinterpret_cast<QQmlGuard<QObject> *>(mem); + QPointer<QObject> *guard = reinterpret_cast<QPointer<QObject> *>(mem); QObject *object = guard->data(); if (object) data = QVariant::fromValue(object); @@ -840,9 +840,9 @@ int ListElement::setQObjectProperty(const ListLayout::Role &role, QObject *o) if (role.type == ListLayout::Role::QObject) { char *mem = getPropertyMemory(role); - QQmlGuard<QObject> *g = reinterpret_cast<QQmlGuard<QObject> *>(mem); + QPointer<QObject> *g = reinterpret_cast<QPointer<QObject> *>(mem); bool existingGuard = false; - for (size_t i=0 ; i < sizeof(QQmlGuard<QObject>) ; ++i) { + for (size_t i=0 ; i < sizeof(QPointer<QObject>) ; ++i) { if (mem[i] != 0) { existingGuard = true; break; @@ -851,11 +851,11 @@ int ListElement::setQObjectProperty(const ListLayout::Role &role, QObject *o) bool changed; if (existingGuard) { changed = g->data() != o; - g->~QQmlGuard(); + g->~QPointer(); } else { changed = true; } - new (mem) QQmlGuard<QObject>(o); + new (mem) QPointer<QObject>(o); if (changed) roleIndex = role.index; } @@ -940,7 +940,7 @@ void ListElement::setBoolPropertyFast(const ListLayout::Role &role, bool b) void ListElement::setQObjectPropertyFast(const ListLayout::Role &role, QObject *o) { char *mem = getPropertyMemory(role); - new (mem) QQmlGuard<QObject>(o); + new (mem) QPointer<QObject>(o); } void ListElement::setListPropertyFast(const ListLayout::Role &role, ListModel *m) @@ -1086,9 +1086,9 @@ void ListElement::destroy(ListLayout *layout) break; case ListLayout::Role::QObject: { - QQmlGuard<QObject> *guard = getGuardProperty(r); + QPointer<QObject> *guard = getGuardProperty(r); if (guard) - guard->~QQmlGuard(); + guard->~QPointer(); } break; case ListLayout::Role::VariantMap: diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index de083a963b..c4d1e5ee55 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -278,7 +278,7 @@ private: ListModel *getListProperty(const ListLayout::Role &role); QString *getStringProperty(const ListLayout::Role &role); QObject *getQObjectProperty(const ListLayout::Role &role); - QQmlGuard<QObject> *getGuardProperty(const ListLayout::Role &role); + QPointer<QObject> *getGuardProperty(const ListLayout::Role &role); QVariantMap *getVariantMapProperty(const ListLayout::Role &role); QDateTime *getDateTimeProperty(const ListLayout::Role &role); diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index 96a780f1df..4e81275e2f 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -686,7 +686,7 @@ public: QObject *modelData() const { return object; } QObject *proxiedObject() { return object; } - QQmlGuard<QObject> object; + QPointer<QObject> object; }; class VDMObjectDelegateDataType : public QQmlRefCount, public QQmlAdaptorModel::Accessors |