From 13fd16e67500e77b8cda34de448cb89ca38a5dab Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 25 Aug 2009 10:06:37 +1000 Subject: Remove unnecessary KeysAttached static map --- src/declarative/fx/qfxitem.cpp | 19 ++++++++++++------- src/declarative/fx/qfxitem.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index feb4e8c..ed2386b 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -704,7 +704,6 @@ private: }; static const SigMap sigMap[]; - static QHash attachedProperties; friend class QFxItem; }; @@ -738,8 +737,6 @@ const QFxKeysAttached::SigMap QFxKeysAttached::sigMap[] = { { 0, 0 } }; -QHash QFxKeysAttached::attachedProperties; - bool QFxKeysAttachedPrivate::isConnected(const char *signalName) { return isSignalConnected(signalIndex(signalName)); @@ -796,10 +793,12 @@ void QFxKeysAttached::keyReleased(QKeyEvent *event) QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj) { - QFxKeysAttached *rv = attachedProperties.value(obj); - if (!rv) { - rv = new QFxKeysAttached(obj); - attachedProperties.insert(obj, rv); + QFxKeysAttached *rv = 0; + QFxItem *item = qobject_cast(obj); + if (item) { + rv = item->keyHandler(); + if (!rv) + rv = new QFxKeysAttached(obj); } return rv; } @@ -1423,6 +1422,12 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, } } +QFxKeysAttached *QFxItem::keyHandler() +{ + Q_D(QFxItem); + return d->keyHandler; +} + void QFxItem::setKeyHandler(QFxKeysAttached *handler) { Q_D(QFxItem); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 89c2cf1..222677c 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -197,6 +197,7 @@ private: QFxAnchorLine verticalCenter() const; QFxAnchorLine baseline() const; + QFxKeysAttached *keyHandler(); void setKeyHandler(QFxKeysAttached *); friend class QmlStatePrivate; -- cgit v0.12