Important: Please read the Qt Code of Conduct -

No widgets for long string visualization?

  • Hello there,

    I need to show very long strings in my GUI (thousands of charater). I also need show very long lines (a new line every 10000 - 20000 characters), so I ve setted vertical scroll as always active, and lineWrapMode = NoWrap (this mode seems to make a worse performance). You can see what I mean in the image below.


    Well, I've tried with QTextEdit and QPlainText. This last one has a better performance, but its not enough for a good scroll moving and navigate between these long strings.

    How can I use a widget with a fine performance for this kind of data?


  • Hello,

    If you are only displaying them why not paint them yourself? Then the performance is up to you...

  • Ty kenchan for your fast reply.

    I need some functions from QTextEdit or QPlainText like select data, get selected data, select a column etc... If I paint the text in a QGraphicsScene, I think I'm losing all this stuff, isn't?

  • I have never subclassed QTextEdit or QPlainText so I don't know how much work it takes.
    I don't think you need to draw to a QGraphicsScene, just a plain widget should do the job.

    I think the font you use will also influence the performance.

  • Thanks again Ken,

    I've tried with some other font with the same result.

    I dont know what you mean with a plain widget. Maybe did you mean use labels?

  • Yes, a label would do.

Log in to reply