[Interest] QGraphicsScene.render() does not respect source rect ?

David Heremans dhran at scarlet.be
Tue Mar 5 20:58:34 CET 2013


Hello,

I seem to have a small problem here with the render function of the
QGraphicsScene.
I'm trying to print parts of a scene onto several pages, however it
seems that
the render method does the scaling as requested , but does not clip the
origin
to the source QRectF.
The scene contains several items that are all arranged in a tree like
structure, something like this:

    |
+++++++++  <= bar that is parent of all items
| | | | |
O O O O O  <= a set of items below it.


and if I restrain the source QRectF to one or more items it will still print
the parent and the other children outside of the given rectangle. Filling up
the rest of the page which I definitely don't want.

I attached a small minimal example to demonstrate what I mean.
If I do not have the parent-item each ellipse ends up on a separate page
in the
first PDF generated. As soon as a attach them to a parent you will see
in the
second pdf that it will draw all the items to the right also...

Is there a way to avoid this? Or am I obliged to first render onto a
temporary image that I then copy towards the printer(or pdf)?

rgds,

David H

PS: I'm using Qt 4.8.1 on linux and 4.7.4 on windows 7 here, both of
course giving the same result :-)


-- 
openMSX - the open source MSX emulator that aims for perfection
http://openmsx.sf.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 2305 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130305/2961213d/attachment.cpp>
-------------- next part --------------
QT       += core gui

TARGET = printpdf
TEMPLATE = app


SOURCES += main.cpp


More information about the Interest mailing list