views:

173

answers:

1

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

+1  A: 

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 );
}
Caleb Huitt - cjhuitt
Oops, I didn't notice that this was tagged as ruby. It shouldn't be too difficult to convert my c++ to the proper ruby equivalent.
Caleb Huitt - cjhuitt