Don't process completions in widget if completion is not enabled

This commit is contained in:
baldurk
2023-02-06 11:28:10 +00:00
parent c3a7afb7c2
commit ab653e7063
+12 -9
View File
@@ -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