From 1f7d0dceadffc00e55868e6d8b4d39a6c061eb25 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sun, 9 Jul 2017 16:33:08 +0200 Subject: [PATCH] Disable tab to switch between splits This will be custom made later, as tab is used for emote completion --- src/widgets/resizingtextedit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgets/resizingtextedit.cpp b/src/widgets/resizingtextedit.cpp index deb008fa3..dfb253fca 100644 --- a/src/widgets/resizingtextedit.cpp +++ b/src/widgets/resizingtextedit.cpp @@ -1,7 +1,6 @@ #include "widgets/resizingtextedit.hpp" ResizingTextEdit::ResizingTextEdit() - : keyPressed() { auto sizePolicy = this->sizePolicy(); sizePolicy.setHeightForWidth(true); @@ -9,6 +8,8 @@ ResizingTextEdit::ResizingTextEdit() this->setSizePolicy(sizePolicy); QObject::connect(this, &QTextEdit::textChanged, this, &QWidget::updateGeometry); + + this->setFocusPolicy(Qt::ClickFocus); } QSize ResizingTextEdit::sizeHint() const @@ -43,9 +44,11 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) if (event->key() == Qt::Key_Tab) { QString currentCompletionPrefix = this->textUnderCursor(); + if (!currentCompletionPrefix.size()) { return; } + if (!this->nextCompletion) { // first selection this->completer->setCompletionPrefix(currentCompletionPrefix); @@ -59,6 +62,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) // wrap over and start again this->completer->setCurrentRow(0); } + this->completer->complete(); return; }