PDA

View Full Version : How to use QTextBlockUserData?



FinderCheng
28th December 2010, 01:51
Hi, there! I wounder how can I use class QTextBlockUserData?

I'm trying to develop an HTML editor using QTextEdit as a visual editor. The HTML text generated by QTextEdit is related to Qt itself, so I have to generate simpler HTML text myself instead of using QTextEdit::toHtml(). I want to store css or other data in QTextBlockUserData which can be related to QTextBlock. But I've no idea how to use it. QTextCursor::insertBlock(); returns void; QTextCursor::block() returns QTextCursor's copy, not a reference or a pointer. Although there is the function QTextBlock::setUserData(), but how can I add the data?

Or some idea about developing an HTML editor?

Thank you!