Unsolved Implementing QAbstractTextDocumentLayout::draw
-
Hello, everyone.
I'm having a lot of trouble understanding what am I supposed to to on the
draw
implementation of aQAbstractTextDocumentLayout
specialization I'm writing.The problem is that I only receive a
QPainter
and aPaintContext
. I don't know much about all the things aQPainter
is capable of doing, as I'm still learning, but I believe there is not enough information for me to determine which block of the document I'm supposed to print first... The only thing I get is the cursor position, which is not enough information.Should I just draw the whole document an then clip by the context's clip rectangle? Isn't this a waste of effort?
I'm implementing a document layout to be associated with a
QTextDocument
that will be shown by aQTextEdit
widget.I really need your help... What would help is an explanation about what is what in the parameters I get and how everything connects with the
QTextEdit
viewport, because the documentation of this method is terrible!!Thank you.
-
Hi Arthur,
Sorry you did not get any feedback for your issue after so long, shows there must be a minimal use or understanding of this class. Did you get help or find solution you can share. I'm also trying to find help using this class and lack of doc is still there I'm afraid.One possibility is to look at KoTextDocumentLayout.h and cpp files, these might help with some information.
https://github.com/JeremiasE/KFormula/blob/gsoc/libs/kotext/KoTextDocumentLayout.h