Qt World Summit: Register Today!

Show progress of html loading for QTextEdit

  • Hi everybody,
    I am making an app that displays long HTML documents (generated from 50 pages long Word documents) and it takes several seconds on my machine, so I'd like to have a QProgressDialog to show the progress.
    If I read the whole HTML file and call setHtml method, there is no way to show the progress.
    So I tried to read the file, then use QString::split("\n") and used QTextEdit::append for each line, but this resulted in having HTML file displayed as plain text, instead of rich text.
    So I tried with something similar to QString::split("<p>"). This improved the situation, but my HTML uses a lot the
    span class="classNAme"
    feature of HTML, and all the classes are defined in the first QTextEdit::append operation, while the following "append" operations seem to disregard the classes, and are badly displayed.

    Does anyone know a way to append HTML with QTextEdit::append, preserving header instruction of current HTML text?
    As an alternative, does anyone know another way to show loading progression, at least to show that loading is in progress (I tried to play with QCursor, with no luck).

    Thanks to everybody and marry Christmas


  • Hi,

    have you tried "QTextEdit::insertHtml":http://qt-project.org/doc/qt-4.8/qtextedit.html#insertHtml instead of append?

  • Yes I have tried. Same behavior, except that loading is much slower.
    Thanks for replying

Log in to reply