Question

How do I load a custom HTML-file into QTextEdit while in runtime?

Was it helpful?

Solution

One very simple way. Be sure to check the documentation, look for error conditions, and what-not. Also, there might be a quicker way than reading it one line at a time.

QFile file( file_name );
QTextStream stream( &file );
QString string;
while( !stream.atEnd() )
{
    stream >> string;
    ui_textEdit->insertHtml( string );
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top