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

View File

@ -31,8 +31,6 @@ void ChatTextEdit::keyPressEvent(QKeyEvent * event)
emit enterPressed();
else if (key == Qt::Key_Tab)
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
{
emit keyPressed();