[Qt-interest] Wrapping text around picture in QTextEdit
Dmitry Fomin
fomin.dm at gmail.com
Wed Oct 12 21:56:32 CEST 2011
Hello everyone!
I'm developing a WYSIWYG editor using QTextEdit. I need to support
text wrapping around pictures, but it seems that QTextEdit does not
support that.
I tried to use QTextLayout for this and lay out text manually in
paintEvent(), but text gets uneditable.
I tried to insert pucture using html, but html subset of QTextDocument
doesn't support 'position' for attribute 'style' in <img> tag.
Components with full html and css support don't support editing.
I thought about implementing QAbstractTextDocumentLayout subclass, but
it seems to be a very hard task, while, for example,
QPlainTextDocumentLayout implementation providing simpler text layout
consists of 2.7K lines of code.
I tried to insert a picture in QTextFrame, but QTextFrame cannot be
moved to specific position.
I investigated source code of KWord, but it's very complex; I suppose
KWord uses its own system for laying out document items.
I would like to have something like this -
http://dl.dropbox.com/u/6880232/1.png - but with editing option. I get
this by simply inserting an image to QTextEdit as a special character:
http://dl.dropbox.com/u/6880232/2.png.
Are there accessible solutions for this task? What could you suggest
for implementing the editor?
Thanks.
Dmitry
More information about the Qt-interest-old
mailing list