[Qt-interest] create image and print it

Riccardo Roasio riccardo.roasio at gmail.com
Wed Dec 2 18:04:39 CET 2009


Hi,

how can i create an image with QImage and print it using QAPinter?

I' trying using this piece of code but there are problems  on resizing...the
image is not resized during printing process...

 QPrinter *printer=new QPrinter(QPrinter::ScreenResolution);

 printer->setPaperSize(QPrinter::A4);

printer->setOrientation(QPrinter::Portrait);

printer->setNumCopies(1);

printer->setDocName(field("title").toString());


 QPainter *painter = new QPainter(printer);

painter->drawImage(0,0,*image,0,0,-1,-1,Qt::AutoColor);

painter->setRenderHint(QPainter::Antialiasing,true);

painter->end();


Thanks,
Riccardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091202/b584c444/attachment.html 


More information about the Qt-interest-old mailing list