KRichTextEdit for kdelibs

Thomas McGuire thomas.mcguire at gmx.net
Sat Apr 19 16:23:55 BST 2008


Hi,

Am Samstag 19 April 2008 12:18:51 schrieb Tom Albers:
> Can you explain a bit about the produced html? I heard it was kind of ugly
> or am I mixing things up?
You are right, it is ugly. The HTML QTextEdit::toHtml() produces is worse than 
what MS Word creates.

Here is an example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-
html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: Prue-wrap; }
</style></head><body style=" font-family:&apsNimbus Mono L&aps; font-
size:11pt; font-weight:600; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-
right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span 
style=" font-family:&apsNimbus Sans L&aps; font-weight:400;">Hello 
</span><span style=" font-family:&apsNimbus Sans 
L&aps;">World</span></p></body></html>

This is for "Hello World", where "World" is bold.

It can be worked around by writing our own toHtml() which iterates over the 
QTextBlocks in a QTextDocument and produces sane HTML, but that is tedious 
work (and frankly, I have other priorities than to do this).

Regards,
Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080419/4ed931fd/attachment.sig>


More information about the kde-core-devel mailing list