PDA

View Full Version : QTextList signals and slots



'milimoj
25th May 2015, 13:51
How can I capture events when text blocks are added and removed from QTextList. There seams to be no signals for these events???

anda_skoa
25th May 2015, 14:01
Since it is a QObject subclass, have you checked childEvent()?

Cheers,
_

'milimoj
25th May 2015, 14:34
Yes, but from documentation right way to create list is to use QTextCursor. I can not tell QTextCursor to use reimplemented QTextList class where I would do my stuff ??? QTextList constructor is not mentioned in documentation.

d_stranz
25th May 2015, 15:43
See my reply to your other post.

I think you are confused about the architecture of QTextDocument and its helper classes. QTextDocument is not a document editor, it is a specification for how to organize and display text and other information in a format that allows the document to be rendered in a variety of ways.

Your application is responsible for creating and modifying the document, as well as for maintaining the information to be represented visually by the document. The document doesn't tell you what's been added to it, you tell the document to add something to it. Once you have done that, the QTextCursor provides a way to traverse the document and retrieve or modify the content. But at the core, QTextDocument is simply a way to store and format information to be displayed in a QTextEdit. The signals provided by QTextDocument are there to notify the QTextEdit that the view needs to be refreshed, and QTextEdit takes responsibility for traversing the the document (using QTextCursor) and formatting the information for display.