[Qt-interest] QGraphicsView to PDF or high resolution
Deepak Chandran
dchandran1 at yahoo.com
Tue Apr 7 21:37:36 CEST 2009
I need to print the contents of a Graphics View to a file, but the code below does not print exactly what I see on the screen. The outlines (pen) on polygons are missing. What is missing?
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFileName(tr("myFile.pdf"));
//view is the QGraphicsView that I want to print
QPainter painter(printer);
painter.setRenderHint(QPainter::Antialiasing);
if (view)
view->render(&painter);
Also, I would prefer vector diagrams rather than "high resolution". I tried to use Svg printer, but the file was very tiny. What is the correct way to generate vector image file of the graphics view?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090407/3653aeaf/attachment.html
More information about the Qt-interest-old
mailing list