[Qt-interest] QTextDocument::drawContents() draw untranslated?

Joshua Grauman jnfo-c at grauman.com
Thu Jun 25 20:11:59 CEST 2009


Nevermind, I'm new to using QPainter and I simply forgot to do a 
painter.save() and painter.restore() because my painter.translate() is 
absolute and not relative... Thanks anyway!

Josh

> Hello,
>
> I'm trying to use QTextDocument::drawContents(&painter, view) to draw a
> document to a painter. It's clipping when I get too far in my document.
> I'm assuming this is because QPainter is limited by a short int, although
> I don't know that for sure. An easy solution would be if
> QTextDocument::drawContents() could draw "translated", rather than just
> clipped. For example, painter.drawPixmap() has a source and destination
> QRect. Any thoughts/ideas? I'd rather not have to draw to a QPixmap
> first... Thanks.
>
> for (int page=0; page<pageCount; page++)
> {
>   QRectF view(0, page*pageHeight, pageWidth, pageHeight);
>
>   painter.translate(0, -page*pageHeight);
>   //I think when page gets too large this isn't working...
>
>   document()->drawContents(&painter, view);
>   //I would like this to have a source AND destination QRect
> }
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list