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.
-
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.
@chaochao What about http://doc.qt.io/qt-5/qtextedit.html#append ?
-
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( ... ); -
@chaochao What about http://doc.qt.io/qt-5/qtextedit.html#append ?
-
QTextCursor c( textEdit->document() ); c.movePosition( QTextCursor::End ); c.insertBlock(); c.insertText( ... );@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. -
@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.@chaochao
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.50If 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.