View Full Version : put html text into a qtextedit
dreamer
4th May 2008, 17:42
How can i put a local file including htm3 text into QTextedit???
I have an object of type QFile handling my local file....I'd like to have
QFILE----->QTEXTEDIT............!!!!!!!!!!!!!
marcel
4th May 2008, 17:48
The QFile is of no use here.
Read the markup from the file using a QTextStream and set it in the QTextEdit using QTextEdit::setHtml.
roxton
8th May 2008, 19:44
A simplified example:
QFile file (fileName);
if (! file.open(QFile::ReadOnly | QFile::Text))
return;
QTextStream in(&file);
in.setCodec("UTF-8");
textEdit->setPlainText(in.readAll());
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.