From 587dc52119da45f17e60761c5e5cb7253c0b3da6 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 27 Aug 2019 13:34:23 +0200 Subject: [PATCH] Editor: accept common text edit short cut override events see QWidgetTextControl::processEvent and QInputControl::isCommonTextEditShortcut. This will break assigning shortcuts to for example Shift+a. Change-Id: I4f97c27a47e2a7a44bf06b3ca949a6de74d4bb64 Fixes: QTCREATORBUG-22854 Reviewed-by: Eike Ziller --- src/plugins/texteditor/texteditor.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 04fa63612e9..325cc11775b 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -2849,14 +2849,20 @@ bool TextEditorWidget::event(QEvent *e) if (e->type() != QEvent::InputMethodQuery) d->m_contentsChanged = false; switch (e->type()) { - case QEvent::ShortcutOverride: - if (static_cast(e)->key() == Qt::Key_Escape && d->m_snippetOverlay->isVisible()) { + case QEvent::ShortcutOverride: { + auto ke = static_cast(e); + if (ke->key() == Qt::Key_Escape && d->m_snippetOverlay->isVisible()) { e->accept(); } else { - e->ignore(); // we are a really nice citizen + // hack copied from QInputControl::isCommonTextEditShortcut + // Fixes: QTCREATORBUG-22854 + e->setAccepted((ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier + || ke->modifiers() == Qt::KeypadModifier) + && (ke->key() < Qt::Key_Escape)); d->m_maybeFakeTooltipEvent = false; } return true; + } case QEvent::ApplicationPaletteChange: { // slight hack: ignore palette changes // at this point the palette has changed already,