aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-06-04 10:54:58 +0200
committerAndy Shaw <andy.shaw@qt.io>2020-06-04 11:24:59 +0200
commit6cadd6dc755b82f98bb4ff4f4336f63597d755b3 (patch)
tree00940cfb5c77f2904ed0d01757b730e67be997d6 /src
parentfc5bd87eb202edb3ede1f349da46c4c86ca82ca3 (diff)
Remove the shortcut when the menu item that is using it is removed
Change-Id: I58ae027a6a913f45f7b3fad020c290c4d75804da Pick-to: 5.15 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/platform/qquickplatformmenuitem.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/imports/platform/qquickplatformmenuitem.cpp b/src/imports/platform/qquickplatformmenuitem.cpp
index 3a717047..b63f7202 100644
--- a/src/imports/platform/qquickplatformmenuitem.cpp
+++ b/src/imports/platform/qquickplatformmenuitem.cpp
@@ -121,6 +121,16 @@ QQuickPlatformMenuItem::~QQuickPlatformMenuItem()
m_menu->removeItem(this);
if (m_group)
m_group->removeItem(this);
+#if QT_CONFIG(shortcut)
+ if (m_shortcutId != -1) {
+ QKeySequence sequence;
+ if (m_shortcut.type() == QVariant::Int)
+ sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(m_shortcut.toInt()));
+ else
+ sequence = QKeySequence::fromString(m_shortcut.toString());
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(m_shortcutId, this, sequence);
+ }
+#endif
delete m_iconLoader;
m_iconLoader = nullptr;
delete m_handle;