1

I'm working on my serialport assistant, I want to show the data received on QPlainTextEdit, firstly, I tried "append":

QByteArray serialData = mySerialPort->readAll();
ui->receiveData->appendPlainText(buf);

“append”is fast,never reduce the baudRate,but it will append a new paragraph with new line,it looks very uncomfortable.

after view this answer,How to append text to QPlainTextEdit without adding newline, and keep scroll at the bottom? I tried this

ui->receiveData->moveCursor(QTextCursor::End);
ui->receiveData->insertPlainText(buf);

without new line,but It brought more serious problems.it reduce the baudRate (Calculate once per second) gradually from 460800 to 1200 even lowver! besides,the UI interface even became unresponsive.

Please help or try to give some ideas how to achieve this.

pogibas
  • 27,303
  • 19
  • 84
  • 117
StephenXu
  • 21
  • 3
  • i think you need get known frame or data packet in data stream otherwise you didn't know data end and can not place "\n" or new line to append. before Qt PlainTextEdit properties, you need to set sender up to data packet or header in stream from serial port. – CMLDMR Oct 21 '17 at 13:42
  • thanks,but you may misunderstand my question.I just want to find an efficient way to append new string to QPlainTextEdit without new line. – StephenXu Oct 21 '17 at 15:49

0 Answers0