KRichTextEdit for kdelibs

Stephen Kelly steveire at gmail.com
Sun Apr 20 12:15:39 BST 2008


Thomas McGuire wrote:

> 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).

I've started thinking about this one, and if it makes sense to do I'll try
to do it for KDE 4.1.

> 
> Regards,
> Thomas






More information about the kde-core-devel mailing list