PDA

View Full Version : Print QGraphicsScene in more than one page



jano_alex_es
16th November 2009, 12:33
Hi,

I'm trying to print a QGraphicsScene and I don't know how to solve a size problem.

The scene can be large, really large, but when rendering the scene it always use only one page, resizing it if necessary.

I tried with QPrintPreviewDialog instead, but, obviously, it just previews, it doesn't cut it in different pages.

Maybe I can solve it just calculating the sceneRect width/height and splitting the scene manually, but it should be different according the page width/height and this is set up later, on the dialog.

I'm diving trough QtAssistant and I don't find any other way to do it. But seems like it has something like that; am I missing something?

thanks!


EDIT: another question. When printing the scene is printed on the top of the page. I can print on another place of the paper changing the parameter "QRectF & target" of QGraphicsScene::render, but; how I could get the QRectF of the page and, with that, calculate what's the center point of the page?

aamer4yu
17th November 2009, 04:31
You could use QGraphicsScene::render in combination with the print sizes and print parts of scene to the printer.
Have a look at the documentation.

jano_alex_es
17th November 2009, 08:19
I did :P Please read the edit.