简体   繁体   中英

Write on the same line in TextEdit in Qt

When we use ui->TextEdit->append("...") the text entered will be shown in a new line in the TextEdit section. What I want to do is to write on the same line... I've tried this code:

ui->textEdit->append("My name is:");
ui->textEdit->append("\b bla");

but it seems that "\b" isn't recognised by Qt

Maybe an option is to do the append outside of the QTextEdit to avoid having a new paragraph created:

QString text = ui->textEdit->text();
text.append("bla");
ui->textEdit->setText(text);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM