View Full Version : Printing QGRaphicsscene

27th September 2011, 16:01

I am posting this issue after trying too many different ways to solve it:

I have this situation;

scene-> new QGraphicsScene(QRect(0,0,5000,5000));

then I read values from a file and plot lines on the scene, and it works, i see the scene in the view with all the points, but, when I want to print it to PDF, I get nothing, unless I set the QBrush to the scene, then i get the PDF with green color.

QPrinter printer(QPrinter::HighResolution);
if (dialog ....)
QPainter painter(&printer);
QGraphicsScene *scene = view->scene();
scene->render(&painter, printer.pageRect(), scene->sceneRect(), Qt:: ..);

I tried without the second, third, .. parameter, etc. and I do not get anything in the PDF. What is wrong?
Thanks in advance,