diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-06-04 10:54:58 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-06-04 10:34:45 +0000 |
commit | 902db8f33298dab3c9b7ae9733432d1a3e2af8e1 (patch) | |
tree | ae2cf32f2bdfd8df1f29409dad0791c749e1cb19 | |
parent | a95aad7f6dd9c87e87dc685dcf62d33b8609ecb4 (diff) |
Remove the shortcut when the menu item that is using it is removed
Change-Id: I58ae027a6a913f45f7b3fad020c290c4d75804da
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 6cadd6dc755b82f98bb4ff4f4336f63597d755b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/imports/platform/qquickplatformmenuitem.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/imports/platform/qquickplatformmenuitem.cpp b/src/imports/platform/qquickplatformmenuitem.cpp index 44f38e0f..b45a95aa 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; |