Disabled CTRL+Enter adding messages more than once.

This commit is contained in:
Cranken 2017-07-24 11:50:15 +02:00
parent 33a58903f0
commit 663dfe5e9e

View file

@ -57,7 +57,6 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget)
if (c == nullptr) {
return;
}
c->sendMessage(textInput.toPlainText());
prevMsg.append(textInput.toPlainText());
event->accept();
@ -66,9 +65,9 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget)
textInput.setText(QString());
prevIndex = 0;
}
else if(textInput.toPlainText() == prevMsg.at(1))
else if(textInput.toPlainText() == prevMsg.at(prevMsg.size()-1))
{
prevMsg.removeFirst();
prevMsg.removeLast();
}
prevIndex = prevMsg.size();
}