summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-10-27 12:21:53 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-10-27 12:22:53 (GMT)
commit40d7920da5762addbbef36ebc049c32409b575cf (patch)
tree9e420ac3efb1a752aa97e2e5ba4fe19504b8affa
parentc17e8c19212d68a6bc2e9492b5ffacdf8c251090 (diff)
downloadQt-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.cpp9
-rw-r--r--src/gui/kernel/qsoftkeymanager_p.h1
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();
};