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

Can't detect PDF printing on Mac

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.0.2, 5.1.1
    • GUI: Printing
    • None
    • Mac version 10.7.5
    • macOS

    Description

      QPrintDialog doesn't set the outputFileName of the QPrinter if the user selects "Save as PDF" even though in qprintdialog_mac.mm it appears to record the name.

      As a secondary note, it also does not change the outputFormat to PdfFormat. I can see this being debatable but not so much the file name.

      Minimal test case:

      ================= MacPDF.pro ================
      QT += core gui printsupport
      TARGET = MacPDF
      TEMPLATE = app
      SOURCES += main.cpp
      =============================================

      ================= main.cpp ==================
      #include <QApplication>
      #include <QDebug>
      #include <QtPrintSupport/QPrinter>
      #include <QtPrintSupport/QPrintDialog>

      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);

          QPrinter printer(QPrinter::HighResolution);
          QPrintDialog dlg(&printer);

          if (dlg.exec() == QDialog::Accepted)
          {
             qDebug() << "File name:" << printer.outputFileName();

             if (printer.outputFormat() == QPrinter::PdfFormat)
                qDebug() << "Format: PDF";

             if (printer.outputFormat() == QPrinter::NativeFormat)
                qDebug() << "Format: Native";
          }
      }
      =============================================

      Attachments

        1. main.cpp
          0.6 kB
        2. MacPDF.pro
          0.2 kB

        Issue Links

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

          Activity

            People

              johnlayt John Layt
              superfun Mike Kuta
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes