Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3
Description
We're seeing an issue whereby once a Quick Menu is shown (after clicking on it in the menubar) that a shortcut'd action (Ctrl+C/Copy) that resides in the menu will only work every second time once the menu is closed. After investigation this is caused by an orphaned shortcut in the shortcut map.
QQuickActionPrivate::ShortcutEntry::grab()
does not check if m_shortcutId != 0 and overrides it thereby leaving an orphaned shortcut.
The events causing this sequence of events is
void QQuickActionPrivate::setShortcut(const QVariant &var)
will set a shortcut without checking entry visibility:
for (QQuickActionPrivate::ShortcutEntry *entry : qAsConst(shortcutEntries))
entry->grab(keySequence, enabled);
In our case entry is currently visible == false.
The visibility is then changed and the following handler is fired:
void QQuickActionPrivate::itemVisibilityChanged(QQuickItem *item) <SNIP> if (item->isVisible()) entry->grab(keySequence, enabled); else entry->ungrab();
Here grab is called directly and automatically overrides the existing shortcut.