diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-10-27 12:21:53 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-10-27 12:22:53 (GMT) |
commit | 40d7920da5762addbbef36ebc049c32409b575cf (patch) | |
tree | 9e420ac3efb1a752aa97e2e5ba4fe19504b8affa | |
parent | c17e8c19212d68a6bc2e9492b5ffacdf8c251090 (diff) | |
download | Qt-40d7920da5762addbbef36ebc049c32409b575cf.zip Qt-40d7920da5762addbbef36ebc049c32409b575cf.tar.gz Qt-40d7920da5762addbbef36ebc049c32409b575cf.tar.bz2 |
Cleanup softkeymanager keyedactions hash when QAction is being deleted.
Reviewed-by: TrustMe
-rw-r--r-- | src/gui/kernel/qsoftkeymanager.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_p.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 75c321e..a5e8eff 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -139,11 +139,18 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key QScopedPointer<QAction> action(createAction(standardKey, actionWidget)); connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent())); - + connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*))); QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key); return action.take(); } +void QSoftKeyManager::cleanupHash(QObject* obj) +{ + Q_D(QSoftKeyManager); + QAction *action = qobject_cast<QAction*>(obj); + d->keyedActions.remove(action); +} + void QSoftKeyManager::sendKeyEvent() { Q_D(QSoftKeyManager); diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index b455445..81218cf 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -96,6 +96,7 @@ protected: Q_DISABLE_COPY(QSoftKeyManager) private Q_SLOTS: + void cleanupHash(QObject* obj); void sendKeyEvent(); }; |