Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61031

QWin32PrintEngine incorrectly unsets custom size in some cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.1, 5.9
    • GUI: Printing
    • 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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            johnlayt John Layt
            jneuhaus John Neuhaus
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes