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 /src/gui/kernel/qsoftkeymanager.cpp | |
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
Diffstat (limited to 'src/gui/kernel/qsoftkeymanager.cpp')
-rw-r--r-- | src/gui/kernel/qsoftkeymanager.cpp | 9 |
1 files changed, 8 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); |