Qt applendPlainText()/append() 多添加一个换行解决方法

 

void ConsoleDialog::appendMessageToEditor(const QString &message)
{
    ui->textEdit->appendPlainText(message);
    ui->textEdit->moveCursor(QTextCursor::End);
    ui->textEdit->textCursor().deletePreviousChar();
}

  每次append后,光标移到最后,删除前一个字符,即换行符。

相关文章:

  • 2022-12-23
  • 2021-06-18
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-08-22
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
相关资源
相似解决方案