[Kde-pim] Newlines in QTextDocument

Stephen Kelly steveire at gmail.com
Mon Feb 23 17:03:38 GMT 2009


Hi,

You may be aware that there are a few bugs regarding newlines in 
QTextDocument.

One is this:
https://bugs.kde.org/show_bug.cgi?id=180207

(Can we have a list of the others. Even the closed ones. I want to have one 
solution to this issue)

One solution that was proposed was to remove the line of paragraph style 
from the html output of document->toHtml. That's what's done in 
KRichTextEdit, but I don't remember who put it there:

http://websvn.kde.org/trunk/KDE/kdelibs/kdeui/widgets/krichtextedit.cpp?view=markup

I don't think it solves all the problems, and I don't think it's a great 
solution. If that was unneeded, Qt would not have put it there. I think it's 
there so that the document survives round trips through QTextDocument the 
exact same.

Another solution was to create a system for creating wholly nicer html from 
the QTextDocument.

http://websvn.kde.org/trunk/KDE/kdepimlibs/kpimidentities/richtextbuilders/

That also doesn't solve the newlines problem though. Additionally, I'm going 
to have to change the API of the Director and Builders to make it more 
flexible, so the headers can't be installed yet.

What we need is some tests with qtextedit to make sure that:
* HTML Documents survive round trips through QTextDocument with the same 
number of newlines.
* Browsers also render the generated document correctly.
* Documents created in a QTextEdit also adhere to the above.
* Documents exported into QTextEdit (with its limited html support) can be 
exported with the correct number of newlines.
* The exported html should be standard and well defined html. Note that the 
patch I made to Qt does not make valid html according to ogoffart (link 
below)

I think this is mostly a html and css issue.

Ahmed has done some investigation, so I hope he will post here too.

Other interesting links:

http://www.nabble.com/New-qt-patch.-Can-it-go-into-qt-copy--td20368821.html
http://lists.trolltech.com/qt-interest/2008-11/thread00279-0.html

At this point, I think the most valuable thing we can get is some test cases 
and information on what 'valid html' is around newlines etc. Unfortunately 
the closing </p> tag is optional, and I think that causes headaches.

I can do coding work on this, but I need answers to the above so I know what 
to export. I can't do much of that sort of investigation work though as I'm 
currently travelling.

All the best,

Steve.



_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list