Merge remote-tracking branch 'origin/12.0'

Change-Id: I17c37a6fd474c3441343e91a67817c8179d0c7cc
This commit is contained in:
Eike Ziller
2023-10-30 13:20:46 +01:00
20 changed files with 185 additions and 62 deletions

View File

@@ -550,12 +550,18 @@ bool ShortcutMap::dispatchEvent(QKeyEvent *e)
<< "\", " << next->id << ", " << static_cast<bool>(enabledShortcuts > 1)
<< ") to object(" << next->owner << ')';
}
QShortcutEvent se(next->keyseq, next->id, enabledShortcuts > 1);
QCoreApplication::sendEvent(const_cast<QObject *>(next->owner), &se);
QAction *action = qobject_cast<QAction *>(next->owner);
if (action)
if (auto action = qobject_cast<QAction *>(next->owner)) {
// We call the action here ourselves instead of relying on sending a ShortCut event,
// as the action will try to match the shortcut id to the global shortcutmap.
// This triggers an annoying Q_ASSERT when linking against a debug Qt. Calling trigger
// directly circumvents this.
action->trigger();
return action->isEnabled();
} else {
QShortcutEvent se(next->keyseq, next->id, enabledShortcuts > 1);
QCoreApplication::sendEvent(const_cast<QObject *>(next->owner), &se);
}
return true;
}