Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to append text in a QTextBrowser in QT?

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.

like image 327
iloahz Avatar asked Jan 13 '12 06:01

iloahz


People also ask

How do I add text to QTextEdit?

Re: How to add a new word to QTextEdit with "append" Like QTextExit::append() docs say, it appends a new paragraph. Use QTextEdit::moveCursor(QTextCursor::End) and QTextEdit::insertHtml() or QTextEdit::insertPlainText() instead. Dear JPN! for formatting the txtScrollEdit Text.

How do you use text browser QT?

If you want to provide your users with an editable rich text editor, use QTextEdit. If you want a text browser without hypertext navigation use QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QLabel.


1 Answers

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

void QTextEdit::append ( const QString & text )
like image 90
TonyK Avatar answered Sep 24 '22 06:09

TonyK