Qt 5.4 / Win 8.1 / QPrinter always uses PageRect of Standard Printer
-
Hi !
I came across this as a difference between OSX / WIndows...
I tried to print labels on a Dymo Labelwriter 450 (but the Bug "works" with every Printer i then tried including virtual ones like PDF/XPS writers).On OSX i enter the Print Configuration Dialog, set my "label type" which is some 89mm x 28mm big, then i print and OKAY !
On Windows i did the same but the printout was just showing the enlarged top left corner of the Graphics to be printed.
When debugging i detected that the PageRect was equal to A4 size (?!?!). After some playing around i realized that it always returns the PageRect of the Printer that is set to be the Standard Printer (which was an A4 Laser Printer in my case) although i clearly selected the Dymo & the correct label type.
(So if i set the Dymo as Standard Printer and set the correct label type / Orientation in the default print settings everything is fine but of course this is just a workaround)Did anyone come across this problem yet ?
In other words: HEEEELLLLPPPP :-)Thanks for any help on this !
Greetings,
Nils
P.S. here is a code sniplet showing what i am doing (wrong ??):
QPrinter * _printer = new QPrinter(QPrinter::HighResolution); _printer->setFullPage(false); _printer->setOrientation(QPrinter::Landscape); _printer->setNumCopies(1); QPrintDialog thepD(_printer); if(thepD.exec() == QDialog::Accepted ) { QRect pr(_printer->paperRect()); QRect rr(_printer->pageRect()); // both QRects contain values for the Windows System Standard printer, NOT for the one chosen // in the QPrintDialog above ?!? }
-
-
@mcosta :
Hello & sorry !
That was a mistake when i gathered the small code sniplet, i edited the code to be correct now !
Excuse me, that got nothing to do with the problem :-)Nils
-
On Windows and OSX QPrintDialog opens the native dialogs.
Standard printing (from Notepad for example) works properly?
-
@mcosta :
Hello !
Yes, Standarp Printing is okay, so the Paperformat is fine if i select a printer with drastically different PageRect from the Standard Printer (e.g. with the Dymo or just use the Microsoft XPS Writer and select a very small format).Greetings,
Nils