Core: Fix selecting recent document with arrow keys

The editor actions are defined in the editor since the removal of the
TextEditorActionHandler. So we potentially capture the ctrl+up/down in
the editor. Fix this by overwriting the shortcuts in the event handler
of the open editor widget.

Fixes: QTCREATORBUG-31072
Change-Id: I45217962bcb2ef3ae8ebed7c4a6d0412bcc0216b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2024-06-20 10:01:18 +02:00
parent df2e55d92a
commit 03e35aac14

View File

@@ -161,6 +161,17 @@ void OpenEditorsWindow::setVisible(bool visible)
bool OpenEditorsWindow::eventFilter(QObject *obj, QEvent *e)
{
if (obj == m_editorView) {
if (e->type() == QEvent::ShortcutOverride) {
auto ke = static_cast<QKeyEvent*>(e);
if (ke->key() == Qt::Key_Up) {
selectPreviousEditor();
return true;
}
if (ke->key() == Qt::Key_Down) {
selectNextEditor();
return true;
}
}
if (e->type() == QEvent::KeyPress) {
auto ke = static_cast<QKeyEvent*>(e);
if (ke->key() == Qt::Key_Escape) {