forked from qt-creator/qt-creator
Terminal: Q_ASSERT workaround
Change-Id: I7e1bf06db437b523e8b06695c3b12f2562a73ce8 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -550,12 +550,18 @@ bool ShortcutMap::dispatchEvent(QKeyEvent *e)
|
|||||||
<< "\", " << next->id << ", " << static_cast<bool>(enabledShortcuts > 1)
|
<< "\", " << next->id << ", " << static_cast<bool>(enabledShortcuts > 1)
|
||||||
<< ") to object(" << next->owner << ')';
|
<< ") 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 (auto action = qobject_cast<QAction *>(next->owner)) {
|
||||||
if (action)
|
// 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();
|
return action->isEnabled();
|
||||||
|
} else {
|
||||||
|
QShortcutEvent se(next->keyseq, next->id, enabledShortcuts > 1);
|
||||||
|
QCoreApplication::sendEvent(const_cast<QObject *>(next->owner), &se);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user