1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
And fix ChatTextEdit's inconsistent behavior of not forwarding backspace key press events while we're at it.
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2015-01-24 23:37:43 +01:00
parent 33ac7deee0
commit 909ade6d5e
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 5 additions and 6 deletions

View File

@ -70,9 +70,11 @@ void TabCompleter::complete()
if (nextCompletion != completionMap.end()) { if (nextCompletion != completionMap.end()) {
// clear previous completion // clear previous completion
for (int i = 0; i < lastCompletionLength; i++) { auto cur = msgEdit->textCursor();
msgEdit->keyPressEvent(new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier)); cur.setPosition(cur.selectionEnd());
} msgEdit->setTextCursor(cur);
for (int i = 0; i < lastCompletionLength; i++)
msgEdit->textCursor().deletePreviousChar();
// insert completion // insert completion
msgEdit->insertPlainText(*nextCompletion); msgEdit->insertPlainText(*nextCompletion);
@ -95,7 +97,6 @@ void TabCompleter::complete()
} }
} }
void TabCompleter::reset() void TabCompleter::reset()
{ {
enabled = false; enabled = false;

View File

@ -31,8 +31,6 @@ void ChatTextEdit::keyPressEvent(QKeyEvent * event)
emit enterPressed(); emit enterPressed();
else if (key == Qt::Key_Tab) else if (key == Qt::Key_Tab)
emit tabPressed(); emit tabPressed();
else if (key == Qt::Key_Backspace) // because of the backspace() hack in tabber, we can't emit on these
QTextEdit::keyPressEvent(event);
else else
{ {
emit keyPressed(); emit keyPressed();