How to append text in a QTextBrowser in QT?

iloahz picture iloahz · Jan 13, 2012 · Viewed 25k times · Source

I have created a QTextBrowser to display a large amount of data (actually displaying the run time log), which is dynamically generated in another processes.

I have found out that I can use fopen("log.html","a") to append data to an actually log file, and reload() it every time it's updated, but I think that's not efficient, or even possibly unwise.

I wonder if there's a neat way to implement this.

Answer

TonyK picture TonyK · Jan 13, 2012

QTextBrowser inherits QTextEdit, so you can use QTextEdit::append:

void QTextEdit::append ( const QString & text )