PDA

View Full Version : Printing resolution indipendent, in millimeters



_Jack_
24th April 2010, 21:51
Hi to all,
I want to draw and print some basic shapes like squares and I need the way to use millimeter unit in natural way.
For example I need to print an exact 10 * 10 mm square
I expect to print a square starting a t x=20 mm, y =20 mm with 10 mm side.. .but something wrong about dimension of printer output.
Could someone please put me in the rigth way or provide a little example about conversion to the measure unit used in Qpainter and the unit used in Printer?

Many thanks in advance.
this is the code I'm using:


QPrinter printer(QPrinter::HighResolution);
printer.setResolution(600);
printer.setPaperSize(QPrinter::A4);
printer.setOrientation (QPrinter::Portrait);
printer.setNumCopies(1);

QPainter painter;
painter.begin(&printer);
painter.drawRect(20,20,10,10);
painter.end();

JohannesMunk
25th April 2010, 13:02
Hi Jack!

At the top of the similar threads list below you can find your answer!

http://www.qtcentre.org/threads/30144-Printing-with-a-coordinate-system-given-in-millimeters (http://www.qtcentre.org/30144-Printing-with-a-coordinate-system-given-in-millimeters)

Joh