1 Attachment(s)
QTextEdit html rendering issues
Hi, i'm trying to render a html file, is a report from a query, with this code:
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);
}
}
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.
Attachment 8013
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.
Re: QTextEdit html rendering issues
QTextEdit only supports a subset of HTML that does not specifically mention width styles on table elements. If you want a fully fledged HTML/CSS (read only) experience then use WebKit.
Re: QTextEdit html rendering issues
Thanks,
But if you look the html code you will see that I don't use CSS or other not supported html subset, for
example, documentation says:
table Table Supports the following attributes: border, bgcolor (Qt color names or #RRGGBB), cellspacing, cellpadding, width (absolute or relative), and height.
My tabable is defined with:
Code:
<table style="text-align: left; width: 300px; height: 58px;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; width: 180px;">FORMA DE PAGO<br>
</td>
<td style="vertical-align: top; width: 80px;">%37<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">VALIDEZ DE LA OFERTA<br>
</td>
<td style="vertical-align: top;">%38<br>
</td>
</tr>
</tbody>
</table>
And it says too that supports align, but if you see this line, I used supported align set:
Code:
<div style="text-align: right; font-weight: bold;"><big><big>PROPUESTA COMERCIAL</big></big><br>
</div>
But in QTextEdit text is shown on the left.
Thanks again.
Re: QTextEdit html rendering issues
I just used QWebView, including <QtWebKit/QWebView> and the webkit module on my .pro file too.
Re: QTextEdit html rendering issues
Quote:
Originally Posted by
haldrik
But if you look the html code you will see that I don't use CSS or other not supported html subset
This:
Code:
style="text-align: left; width: 300px; height: 58px;"
... is CSS.
Re: QTextEdit html rendering issues
Re: QTextEdit html rendering issues
Quote:
Originally Posted by
haldrik
And it says too that supports align, but if you see this line, I used supported align set:
Code:
<div style="text-align: right; font-weight: bold;"><big><big>PROPUESTA COMERCIAL</big></big><br>
</div>
Just to reinforce this, this a is "div" element with a "style" attribute containing CSS properties. The supported attributes for this element are "align" and "dir". Even if "style" were supported here, the allowed CSS subset does not include "text-align".