From afbfc2907b417034a98cf17f5787e0dfe467f737 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 4 Mar 2010 13:29:37 +1000 Subject: Remove unnecessary additional hash of QDeclarativeGridViewAttached --- .../graphicsitems/qdeclarativegridview.cpp | 9 ++++----- .../graphicsitems/qdeclarativegridview_p.h | 19 +++---------------- 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 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(qmlAttachedPropertiesObject(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 attachedProperties; + bool m_isCurrent : 1; + bool m_delayRemove : 1; }; -- cgit v0.12