QPlainTextEdit can not handle large amounts of text



  • QPlainTextEdit is propably the lightest widget to show plain text right?
    I have problems showing text stream (NMEA) coming from serial port (QSerialPort). The program becomes unresponsive very fast.
    Yet there is forexample the KDE Konsole, that can handle HUGE text streams, and even scroll it.
    What is the widget area in Konsole where the text is showing up? Can not figure it out from the huge source code...

    I know a human can not read the stream that fast, but that is not the point.
    Point is that the program should be able to handle the text stream without becoming unresponsive. Konsole handles it well.
    QPlainTextEdit can not handle even a slow text streams on it's own, does it require a limited fifo buffer to redraw text from or what could be the solution to a efficient way of showing text streams?
    Here is my simple serial console in GitHub: https://goo.gl/xXuMOa


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    One thing in you code is that in your receive function your are looping over each byte you received and ask to update the widget. What is generally done when handling large amount of data in such small amount is that the processing is done in a different thread. Also the UI update should be batched, there's no real benefit to update your QPlainTextEdit content for every single byte you get.

    Hope it helps



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.