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

[REG 5.2->5.3] QPrinter::{width,height} return incorrect size

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.5.0
    • 5.3.2, 5.4.0 RC
    • GUI: Printing
    • None
    • Windows 8.1
      Qt 5.2.1, 5.3.2 and 5.5 (dev)
    • 593e3f2fbb324f076e4d3f05b269f21f8c3ca403

    Description

      When you print with a dpi setting different from the dpi setting of the default printer, QPrinter::width() and height() return values as if the dpi setting of the default printer was used.

      tl;dr:
      1. start attached program (with Qt 5.3 or higher)
      2. press print
      3. change dpi to a higher value or select another printer with a different dpi setting
      4. QPrinter::pageRect(QPrinter::DevicePixel) and QPaintDevice::width() and height() should return the same size, which they don't

      I attached a small test program which demonstrates this issue.
      In my case my default printer is set to 600dpi.
      In the print preview the returned size is 4958x7017.
      If I print without changing anything the size stays the same.
      But when I change the dpi setting in the print dialog or select another printer with a different dpi setting (The dpi setting has to be different from the default dpi setting that was active after starting the program) the size still returns 4958x7017 while pageRect(QPrinter::DevicePixel) returns 9917x14033.

      Attachments

        1. printer_size.zip
          1.0 kB
        2. qt521_1200dpi.pdf
          15 kB
        3. qt521_600dpi.pdf
          15 kB
        4. qt532_1200dpi.pdf
          16 kB
        5. qt532_300dpi.pdf
          3 kB
        6. qt532_600dpi.pdf
          15 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mkrems Marcel Krems
            mkrems Marcel Krems
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes