[PyQt] More QPlainTextEdit weirdness! (was: Missing scrollbar
henning.schroeder at gmail.com
Fri Dec 11 13:04:41 GMT 2009
On Fri, Dec 11, 2009 at 1:31 PM, Sundance <sundance at ierne.eu.org> wrote:
> As part of a helpful little feature that shows you the bottom of your text in
> a split screen while you scroll back, I use the awesome
> QTextDocument.drawContents() method. In short, you feed it a QPainter and a
> QRectF and it does what it says on the label: a slice of your document as
> delineated by the QRectF is rendered onto the QPainter.
> And yet in the latter case, drawContents() renders nothing at all. Cursory
> investigation points to a different QAbstractTextDocumentLayout implementation
> under the hood depending on the TextEdit flavor in use.
Have you tried plaintext_edit.document().documentLayout().draw(paint, context) ?
Or you could try
text_layout = QTextLayout()
doc = plaintext_edit.document().clone()
More information about the PyQt