[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] printing/saving a graphicsScene()
From:       giulianc51 <giulianc51 () gmail ! com>
Date:       2015-03-29 20:58:47
Message-ID: 20150329225847.45d194c5 () acerCF
[Download RAW message or body]

Hi all

I'm a new subscriber to this list :-)

I'm on qt 4.4.8, pyqt 4.9.3 and debian wheezy; my problem is printing a
QGraphicScene() on a PDF file or saving it to an image;

I followed some examples on the net like:
	printer = QPrinter(QPrinter.HighResolution)
	printer.setPageSize(QPrinter.Letter)
	printer.setOrientation(QPrinter.Landscape)
	printer.setOutputFormat(QPrinter.PdfFormat)
	printer.setOutputFileName(outname)
	painter = QPainter()
	painter.setRenderHint(QPainter.Antialiasing)
	painter.begin(printer)
	scene.render(painter)
and like:
	pixmap = QPixmap()
	painter = QPainter(pixmap)
	painter.setRenderHint(QPainter.Antialiasing)
	scene.render(painter)
	painter.end()
	pixmap.save(outname,"JPG")
without success :-(

in the last test I also tried:
	pixmap = QImage()
with the same result: none;

I also tried:
	gv.render(painter) (gv=QGraphicsView);
this way we have not the list of warnings as with scene.render(), but
I obtain essentially
	.... Painter not active ....
and I cannot print/save my scene;

I think I'm ignoring some subtle detail that does fail my tests: can
you help me? 

thank you in advance, sorry for my bad english, best regards,
giuliano





_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic