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

QPageSetupDialog does not open if system does not have printers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.2
    • GUI: Printing
    • None
    • macOS

    Description

      I try open QPageSetupDialog, but if system does not have any printer, this dialog does not open and show this message: "QPageSetupDialog: Cannot be used on non-native printers"

      I think this problem occurs because this dialog checks output format:

      // qpagesetupdialog.cpp
      
      void QPageSetupDialogPrivate::setPrinter(QPrinter *newPrinter)
      {
       // ...
          if (printer->outputFormat() != QPrinter::NativeFormat)
              qWarning("QPageSetupDialog: Cannot be used on non-native printers");
      }
      
      

      but I cannot add this format because QPrinter ignore it if system doesn't have printers.

      // qprinter.cpp
      void QPrinter::setOutputFormat(OutputFormat format)
      {
          Q_D(QPrinter);
      
          if (d->outputFormat == format)
              return;
      
          if (format == QPrinter::NativeFormat) {
              QPrinterInfo printerToUse = d->findValidPrinter();
              if (!printerToUse.isNull())
                  d->changeEngines(format, printerToUse);
          } else {
              d->changeEngines(format, QPrinterInfo());
          }
      }
      

      Attachments

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

        Activity

          People

            johnlayt John Layt
            trikrista Aleksandr Degtyarev
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes