summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp9
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h19
2 files changed, 7 insertions, 21 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index a6f3d8f..b3c5577 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -52,8 +52,6 @@
QT_BEGIN_NAMESPACE
-QHash<QObject*, QDeclarativeGridViewAttached*> QDeclarativeGridViewAttached::attachedProperties;
-
//----------------------------------------------------------------------------
@@ -61,8 +59,9 @@ class FxGridItem
{
public:
FxGridItem(QDeclarativeItem *i, QDeclarativeGridView *v) : item(i), view(v) {
- attached = QDeclarativeGridViewAttached::properties(item);
- attached->m_view = view;
+ attached = static_cast<QDeclarativeGridViewAttached*>(qmlAttachedPropertiesObject<QDeclarativeGridView>(item));
+ if (attached)
+ attached->m_view = view;
}
~FxGridItem() {}
@@ -1748,7 +1747,7 @@ void QDeclarativeGridView::refill()
QDeclarativeGridViewAttached *QDeclarativeGridView::qmlAttachedProperties(QObject *obj)
{
- return QDeclarativeGridViewAttached::properties(obj);
+ return new QDeclarativeGridViewAttached(obj);
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index d463a46..22fcef6 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -167,9 +167,7 @@ class QDeclarativeGridViewAttached : public QObject
public:
QDeclarativeGridViewAttached(QObject *parent)
: QObject(parent), m_isCurrent(false), m_delayRemove(false) {}
- ~QDeclarativeGridViewAttached() {
- attachedProperties.remove(parent());
- }
+ ~QDeclarativeGridViewAttached() {}
Q_PROPERTY(QDeclarativeGridView *view READ view CONSTANT)
QDeclarativeGridView *view() { return m_view; }
@@ -192,15 +190,6 @@ public:
}
}
- static QDeclarativeGridViewAttached *properties(QObject *obj) {
- QDeclarativeGridViewAttached *rv = attachedProperties.value(obj);
- if (!rv) {
- rv = new QDeclarativeGridViewAttached(obj);
- attachedProperties.insert(obj, rv);
- }
- return rv;
- }
-
void emitAdd() { emit add(); }
void emitRemove() { emit remove(); }
@@ -212,10 +201,8 @@ Q_SIGNALS:
public:
QDeclarativeGridView *m_view;
- bool m_isCurrent;
- bool m_delayRemove;
-
- static QHash<QObject*, QDeclarativeGridViewAttached*> attachedProperties;
+ bool m_isCurrent : 1;
+ bool m_delayRemove : 1;
};