diff options
author | Andreas Buhr <andreas@andreasbuhr.de> | 2021-01-13 13:45:43 +0100 |
---|---|---|
committer | Andreas Buhr <andreas@andreasbuhr.de> | 2021-01-13 17:48:10 +0100 |
commit | 28f515e6334fd1c15a2f7f18de6be7bfe1f9c302 (patch) | |
tree | e04cc4e9c53718210931e5193fd46156cf59d698 /src | |
parent | a34327a557f0460d0786a845846e49b90f83a701 (diff) |
Fix QQuickShortcut::setContext so re-grab all shortcuts
A while ago, QQuickShortcut was extended to not only have a shortcut
m_shortcut but in addition a list m_shortcuts. During this extension,
the setContext method was missed: Shortcuts in m_shortcuts are
not re-grabbed on context change. This patch fixes this.
Task-number: QTBUG-88682
Pick-to: 6.0 5.15
Change-Id: Ie73d516f2a325a328b6e975d69490eea29a18401
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/util/qquickshortcut.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp index 8e135b4624..2905e36d00 100644 --- a/src/quick/util/qquickshortcut.cpp +++ b/src/quick/util/qquickshortcut.cpp @@ -342,8 +342,15 @@ void QQuickShortcut::setContext(Qt::ShortcutContext context) return; ungrabShortcut(m_shortcut); + for (auto &s : m_shortcuts) + ungrabShortcut(s); + m_context = context; + grabShortcut(m_shortcut, context); + for (auto &s : m_shortcuts) + grabShortcut(s, context); + emit contextChanged(); } |