[Qt-interest] append non-paragraph text in QPlainTextEdit
Robert Hairgrove
evorgriahr at hispeed.ch
Wed May 12 18:20:51 CEST 2010
Klaus Schneider-Zapp wrote:
> 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
It sounds like you need to buffer the input ... have you looked at
QDataStream and QBuffer?
More information about the Qt-interest-old
mailing list