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

QPrintDialog::show with Qt::WindowFlags::Sheet does not appear if no Printers are available

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 6.2.0, 6.2.1
    • Fix Version/s: None
    • Component/s: GUI: Printing
    • Labels:
      None
    • Environment:
      macOS Catalina 10.14
      macOS Big Sure 11.4
      macOS Monterey 12.0.1
    • Platform/s:
      macOS

      Description

      To achieve the native modal dialog look on macOS Big Sur and later we have to use the following code:

      QPrinterDialog dialog;
      
      dialog.setParent(parent, Qt::sheet);
      dialog.setModality(Qt::ApplicationModal);
      dialog.show();
      
      QEventLoop nestedLoop;
      QObject::connect(&dialog, &QDialog::finished, [&nestedLoop](...){ nestedLoop.exit(); });
      
      nestedLoop.exec();

       

      For QPrinterDialog this produces the expected outcome only if the system has any registered printers. If QPrinterInfo::availablePrinters() is empty the call to QPrinterDialog::show() results in an invisible printer dialog which still locks the application until the user presses ESC.

      Using QPrinterDialog::exec() in the same constellations - no printers known to the system - opens the expected printer dialog. The problem seems to be with the implementation of qprinterdialog_mac.mm which does different things in exec() and show().

       

       

        Attachments

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

          Activity

            People

            Assignee:
            johnlayt John Layt
            Reporter:
            rkoecher Rene Koedher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes