Hi, i'm trying to render a html file, is a report from a query, with this code:
void SalesForm::renderProposal()
{
QString fileName
= QDir::currentPath() + "/templates/proposal_template.html";
QMessageBox::warning(this, trUtf8
("Error Abriendo Plantilla"),
trUtf8("No se puedo abrir '%1'").arg(fileName));
}
htmlString = stream.readAll();
QString textEditString
= htmlString.
arg(propsData.
at(0).
at(0)).
arg(propsData.
at(3).
at(0)).
arg(propsData.
at(16).
at(0));
propOutTextEdit->setHtml(textEditString);
}
}
void SalesForm::renderProposal()
{
QString fileName = QDir::currentPath() + "/templates/proposal_template.html";
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
QMessageBox::warning(this, trUtf8("Error Abriendo Plantilla"),
trUtf8("No se puedo abrir '%1'").arg(fileName));
}
QTextStream stream(&file);
QString htmlString;
htmlString = stream.readAll();
QString textEditString = htmlString.arg(propsData.at(0).at(0)).arg(propsData.at(3).at(0)).arg(propsData.at(16).at(0));
propOutTextEdit->setHtml(textEditString);
}
}
To copy to clipboard, switch view to plain text mode
The file loads fine, but the QTextEdit don't render very well the html file, I took a screenshot where the file is loaded
on Google Chrome and QTextEdit twice.
htmlQTextEdit.jpg
html code is shown here:
http://pastebin.ca/2170961
I'm not trying to compare Google Chrome with QTextEdit, but the html file is very simple and is made with kompozer.
Thanks.
Bookmarks