Disable tab to switch between splits

This will be custom made later, as tab is used for emote completion
This commit is contained in:
Rasmus Karlsson 2017-07-09 16:33:08 +02:00
parent 2425ddbd2c
commit 1f7d0dcead

View file

@ -1,7 +1,6 @@
#include "widgets/resizingtextedit.hpp" #include "widgets/resizingtextedit.hpp"
ResizingTextEdit::ResizingTextEdit() ResizingTextEdit::ResizingTextEdit()
: keyPressed()
{ {
auto sizePolicy = this->sizePolicy(); auto sizePolicy = this->sizePolicy();
sizePolicy.setHeightForWidth(true); sizePolicy.setHeightForWidth(true);
@ -9,6 +8,8 @@ ResizingTextEdit::ResizingTextEdit()
this->setSizePolicy(sizePolicy); this->setSizePolicy(sizePolicy);
QObject::connect(this, &QTextEdit::textChanged, this, &QWidget::updateGeometry); QObject::connect(this, &QTextEdit::textChanged, this, &QWidget::updateGeometry);
this->setFocusPolicy(Qt::ClickFocus);
} }
QSize ResizingTextEdit::sizeHint() const QSize ResizingTextEdit::sizeHint() const
@ -43,9 +44,11 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Tab) { if (event->key() == Qt::Key_Tab) {
QString currentCompletionPrefix = this->textUnderCursor(); QString currentCompletionPrefix = this->textUnderCursor();
if (!currentCompletionPrefix.size()) { if (!currentCompletionPrefix.size()) {
return; return;
} }
if (!this->nextCompletion) { if (!this->nextCompletion) {
// first selection // first selection
this->completer->setCompletionPrefix(currentCompletionPrefix); this->completer->setCompletionPrefix(currentCompletionPrefix);
@ -59,6 +62,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
// wrap over and start again // wrap over and start again
this->completer->setCurrentRow(0); this->completer->setCurrentRow(0);
} }
this->completer->complete(); this->completer->complete();
return; return;
} }