aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-07-05 13:29:57 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-05 15:02:58 +0200
commit5d6f8b18fe77d2fc17a3c1d77d1c4baeff0e9704 (patch)
tree507f652c897825a7f6b3a09a5dd2c09d6c1797f4 /src/qml/types
parent2e4d1ccb18aba13f94670d3d1104839fecf2ab5c (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/types')
-rw-r--r--src/qml/types/qqmlbind.cpp3
-rw-r--r--src/qml/types/qqmldelegatemodel_p_p.h4
-rw-r--r--src/qml/types/qqmllistmodel.cpp28
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h2
4 files changed, 18 insertions, 19 deletions
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);