Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.6.1, 5.9
-
None
-
Windows 10
Qt 5.6.1 (Qt 5.9.0 still has the offending code block unaltered, but isn't tested)
Compiled with Visual Studio 2015
Zebra Printer Driver version 5.1.16.6447
Zebra printer set as default
Description
When using a Zebra Label Printer (ZDesigner GK420t), when the printer property "Override Application Default Settings" is unchecked, launching a QPrintDialog will reset the page size to 0.75 x 0.25 inches if accepted.
Tracked it down to QWin32PrintEnginePrivate::setPageSize, in qprintengine_win.cpp lines 1605 and 1612 (in 5.6.1):
1605:
const QPageSize printerPageSize = m_printDevice.supportedPageSize(pageSize);
Starting at 1612:
if (printerPageSize.isValid()) { has_custom_paper_size = false; devMode->dmPaperSize = m_pageLayout.pageSize().windowsId(); devMode->dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH); devMode->dmPaperWidth = 0; devMode->dmPaperLength = 0; }
The pageSize is "supported" as it is the default size set in the driver, so printerPageSize is valid. However it's still technically a custom size (windowsId() returns 256), so dmPaperSize is set to 256 while dmPaperWidth and Length are both set to 0. PrintDlgEx doesn't like this, and chooses 0.75 x 0.25 to fill in the GUI, thus silently changing the page size when the dialog is accepted.
I haven't been able to fix this in code without complicated checks or outright overriding the size returned by the dialog, and we serve a large a portion of customers with this brand of label printer