This commit is contained in:
Rasmus Karlsson 2017-07-31 01:26:14 +02:00
parent 51f81262d5
commit b25da12e9b

View file

@ -60,25 +60,20 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget)
c->sendMessage(textInput.toPlainText());
prevMsg.append(textInput.toPlainText());
event->accept();
if(!(event->modifiers() == Qt::ControlModifier))
{
if (!(event->modifiers() == Qt::ControlModifier)) {
textInput.setText(QString());
prevIndex = 0;
}
else if(textInput.toPlainText() == prevMsg.at(prevMsg.size()-1))
{
} else if (textInput.toPlainText() == prevMsg.at(prevMsg.size() - 1)) {
prevMsg.removeLast();
}
prevIndex = prevMsg.size();
}
else if(event->key() == Qt::Key_Up){
if(prevMsg.size() && prevIndex){
} else if (event->key() == Qt::Key_Up) {
if (prevMsg.size() && prevIndex) {
prevIndex--;
textInput.setText(prevMsg.at(prevIndex));
}
}
else if(event->key() == Qt::Key_Down){
if(prevIndex != (prevMsg.size() - 1) && prevIndex != prevMsg.size()){
} else if (event->key() == Qt::Key_Down) {
if (prevIndex != (prevMsg.size() - 1) && prevIndex != prevMsg.size()) {
prevIndex++;
textInput.setText(prevMsg.at(prevIndex));
} else {