I use insertPlainText()
to insert data to QTextBrowser in the slot function, but It seems result in lag even no response along with data increasement. But when I add '\n'
at the end of data to simulate the append()
, the lag phenomenon disappeared. But I don't want to add a new line, how to solve this problem?
I tried to use qApp->processEvents()
after the insertPlainText()
, but it cause crash.
I tried to start a timer to run qApp->processEvents()
to refresh the UI, but it didn't solve the problem.
Should I start a new thread to receive serial port data? But the inserted data(I mean received data) size is not big, but the total data size in the browser is big. Receive data may not cost a lot of time.