如题,但是我试了下并不能按格式显示。代码如下
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// AddressBook *addressBook = new AddressBook;
// addressBook->show();
QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
std::fstream ifile("1.html");
std::string html = std::string(std::istreambuf_iterator<char>(ifile),std::istreambuf_iterator<char>());
QString qstr(html.c_str());
QTextEdit *addressText = new QTextEdit(qstr);
addressText->show();
return app.exec();
}