Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
how to prevent textbrowser from being modified?
Now,i use textbrowser as central wigdet and use function insertplaintext to display on textbrowser.If i do not click the textbrowser,insertplaintext can inset at the last .but if i click it,insertplaintext will inset from my clicked position. What i want is that insertplaintext is always at the last positon. how to do that? thank for your help.
QTextCursor c( textEdit->document() ); c.movePosition( QTextCursor::End ); c.insertBlock(); c.insertText( ... );
@jsulm can not use append.i dont know why。append will display wrong like this.
c data :2
c data :2
adc data :2.50,
adc data :2.50
@raven-worx no ,it will display err like when i use append.
QByteArray data = _serial->readAll();
this is my data to be diplayed on textbrowser.
to make it clear.
You get this:
a d c data :2 .50, a d c data :2 .50,
but want it to display like this?
adc data :2.50, adc data :2.50
If this is the case the question is when you are doing the call to readAll() and append it.
Since it seems you are reading from a serial device, i guess you are just calling it whenever new data is available. Every call to append creates a new paragraph. So if your received data just contains a single character and append it you get this.