From ab653e70635911af73393035c0dc78965c627d27 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 6 Feb 2023 11:28:10 +0000 Subject: [PATCH] Don't process completions in widget if completion is not enabled --- qrenderdoc/Widgets/Extended/RDTextEdit.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/qrenderdoc/Widgets/Extended/RDTextEdit.cpp b/qrenderdoc/Widgets/Extended/RDTextEdit.cpp index 45615ceee..2cb01d9e1 100644 --- a/qrenderdoc/Widgets/Extended/RDTextEdit.cpp +++ b/qrenderdoc/Widgets/Extended/RDTextEdit.cpp @@ -229,17 +229,20 @@ void RDTextEdit::keyPressEvent(QKeyEvent *e) bool completionShortcut = false; - // tab triggers completion - if(e->key() == Qt::Key_Tab) - completionShortcut = true; - - // as does ctrl-space and ctrl-E - if(e->modifiers() & Qt::ControlModifier) + if(m_Completer && m_CompletionModel) { - if(e->key() == Qt::Key_E) - completionShortcut = true; - if(e->key() == Qt::Key_Space) + // tab triggers completion + if(e->key() == Qt::Key_Tab) completionShortcut = true; + + // as does ctrl-space and ctrl-E + if(e->modifiers() & Qt::ControlModifier) + { + if(e->key() == Qt::Key_E) + completionShortcut = true; + if(e->key() == Qt::Key_Space) + completionShortcut = true; + } } // add ctrl-end and ctrl-home shortcuts, which aren't implemented for read-only edits