I am designing a chat application. My query is that I am printing the message and name of the user in a chat box on pressing a send button in Qt. Every time I press the button instead of writing the new message in next line, it erases the previous message and overwrites it by showing the new message only.
Code:
QString str = ui->textEdit->toPlainText();
QString name= ui->textEdit->objectName();
ui->textBrowser->setText(name);
ui->textBrowser->setText(name + ": " + str);
std::cout<<endl;