mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #1039
And fix ChatTextEdit's inconsistent behavior of not forwarding backspace key press events while we're at it.
This commit is contained in:
parent
33ac7deee0
commit
909ade6d5e
|
@ -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;
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user