diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-08-24 06:15:38 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-08-24 06:15:38 (GMT) |
commit | 0085b442847e02564e49b339cd2e78eb70489c86 (patch) | |
tree | c21a3cf95c5b6b062ff77f538fe1c7cb498ed9ed | |
parent | b979a3d96d63e869fb0d7db55b891d557eecd35f (diff) | |
download | Qt-0085b442847e02564e49b339cd2e78eb70489c86.zip Qt-0085b442847e02564e49b339cd2e78eb70489c86.tar.gz Qt-0085b442847e02564e49b339cd2e78eb70489c86.tar.bz2 |
Fix onFooPressed key handlers.
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 17 | ||||
-rw-r--r-- | src/declarative/fx/qfxmouseregion_p.h | 11 |
2 files changed, 7 insertions, 21 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index d78e096..feb4e8c 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -611,7 +611,7 @@ class QFxKeysAttachedPrivate : public QObjectPrivate public: QFxKeysAttachedPrivate() : QObjectPrivate(), enabled(true) {} - bool isConnected(int idx); + bool isConnected(const char *signalName); bool enabled; }; @@ -740,16 +740,9 @@ const QFxKeysAttached::SigMap QFxKeysAttached::sigMap[] = { QHash<QObject*, QFxKeysAttached*> QFxKeysAttached::attachedProperties; -bool QFxKeysAttachedPrivate::isConnected(int idx) +bool QFxKeysAttachedPrivate::isConnected(const char *signalName) { - if (idx < 32) { - quint32 mask = 1 << idx; - return connectedSignals[0] & mask; - } else if (idx < 64) { - quint32 mask = 1 << (idx-32); - return connectedSignals[1] & mask; - } - return false; + return isSignalConnected(signalIndex(signalName)); } QFxKeysAttached::QFxKeysAttached(QObject *parent) @@ -777,10 +770,10 @@ void QFxKeysAttached::keyPressed(QKeyEvent *event) QByteArray keySignal = keyToSignal(event->key()); if (!keySignal.isEmpty()) { keySignal += "(QFxKeyEvent*)"; - int idx = QFxKeysAttached::staticMetaObject.indexOfSignal(keySignal); - if (d->isConnected(idx)) { + if (d->isConnected(keySignal)) { // If we specifically handle a key then default to accepted ke.setAccepted(true); + int idx = QFxKeysAttached::staticMetaObject.indexOfSignal(keySignal); metaObject()->method(idx).invoke(this, Q_ARG(QFxKeysAttached, &ke)); } } diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h index 70df8d1..caed2ab 100644 --- a/src/declarative/fx/qfxmouseregion_p.h +++ b/src/declarative/fx/qfxmouseregion_p.h @@ -85,15 +85,8 @@ public: bool isConnected(const char *signal) { Q_Q(QFxMouseRegion); - int idx = QFxMouseRegion::staticMetaObject.indexOfSignal(signal); - if (idx < 32) { - quint32 mask = 1 << idx; - return QObjectPrivate::get(q)->connectedSignals[0] & mask; - } else if (idx < 64) { - quint32 mask = 1 << (idx-32); - return QObjectPrivate::get(q)->connectedSignals[1] & mask; - } - return false; + int idx = QObjectPrivate::get(q)->signalIndex(signal); + return QObjectPrivate::get(q)->isSignalConnected(idx); } bool absorb : 1; |