[Qt-interest] append non-paragraph text in QPlainTextEdit

Klaus Schneider-Zapp klaus_snd at web.de
Wed May 12 18:18:58 CEST 2010


Hi,

in my app I read from a serial port and append all incoming text to a 
QPlainTextEdit to be displayed. I cannot use appendPlainText (), since 
incoming pieces are not necessarily new paragraphs. I can use insertText() 
but this has the following problem: If the user selects text and in that 
moment new data comes in, the selection is deleted and replaced. The brute 
force method to solve this would be to save the currect selection and cursor 
position, set the cursor at the end, insert the text, and restore cursor 
position and selection. However, this adds unnecessary overhead to my program 
and slows it down, especially if data is received at a high rate. Is there a 
more convenient way to solve this problem?

Thanks very much and best regards,
Klaus



More information about the Qt-interest-old mailing list