From 6a7272687080abcc4d79ba3c1a8fd44ad23a1206 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 18 Dec 2009 15:17:33 +1000 Subject: Remove unnecessary attached prop. hash. --- .../graphicsitems/qmlgraphicslistview.cpp | 24 +++++----------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 51d88ed..cddf33c 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -91,9 +91,7 @@ class QmlGraphicsListViewAttached : public QObject public: QmlGraphicsListViewAttached(QObject *parent) : QObject(parent), m_view(0), m_isCurrent(false), m_delayRemove(false) {} - ~QmlGraphicsListViewAttached() { - attachedProperties.remove(parent()); - } + ~QmlGraphicsListViewAttached() {} Q_PROPERTY(QmlGraphicsListView *view READ view CONSTANT) QmlGraphicsListView *view() { return m_view; } @@ -134,15 +132,6 @@ public: } } - static QmlGraphicsListViewAttached *properties(QObject *obj) { - QmlGraphicsListViewAttached *rv = attachedProperties.value(obj); - if (!rv) { - rv = new QmlGraphicsListViewAttached(obj); - attachedProperties.insert(obj, rv); - } - return rv; - } - void emitAdd() { emit add(); } void emitRemove() { emit remove(); } @@ -160,20 +149,17 @@ public: mutable QString m_section; QString m_prevSection; bool m_delayRemove; - - static QHash attachedProperties; }; -QHash QmlGraphicsListViewAttached::attachedProperties; - //---------------------------------------------------------------------------- class FxListItem { public: FxListItem(QmlGraphicsItem *i, QmlGraphicsListView *v) : item(i), section(0), view(v) { - attached = QmlGraphicsListViewAttached::properties(item); - attached->m_view = view; + attached = static_cast(qmlAttachedPropertiesObject(item)); + if (attached) + attached->m_view = view; } ~FxListItem() {} qreal position() const { @@ -2684,7 +2670,7 @@ void QmlGraphicsListView::animStopped() QmlGraphicsListViewAttached *QmlGraphicsListView::qmlAttachedProperties(QObject *obj) { - return QmlGraphicsListViewAttached::properties(obj); + return new QmlGraphicsListViewAttached(obj); } QML_DEFINE_TYPE(Qt,4,6,ListView,QmlGraphicsListView) -- cgit v0.12