diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-04 03:29:37 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-04 03:29:37 (GMT) |
commit | afbfc2907b417034a98cf17f5787e0dfe467f737 (patch) | |
tree | 94d1709df0a535c4f1a45e00e724c7f12d4ceb70 /src | |
parent | 08cf6561c4ad2288e385e63d941b60b268cc484e (diff) | |
download | Qt-afbfc2907b417034a98cf17f5787e0dfe467f737.zip Qt-afbfc2907b417034a98cf17f5787e0dfe467f737.tar.gz Qt-afbfc2907b417034a98cf17f5787e0dfe467f737.tar.bz2 |
Remove unnecessary additional hash of QDeclarativeGridViewAttached
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 9 | ||||
-rw-r--r-- | src/declarative/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<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; }; |