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

QPrintDialog CurrentPage range doesn't work

    XMLWordPrintable

Details

    • 9927c1a2bbb372d0e557c58062e4ecda7a644aa1. (Qt 5.2RC)

    Description

      Opening QPrintDialog with CurrentPage range default doesn't work on Windows at all. Other ranges works fine. Looking in to qprintdialog_win.cpp we can see that CurrentPage implementation is totally missing. Is there some special reason for that?

      Here is one kind of patch code that fixed the missing feature:
      Qt4: src\gui\dialogs\qprintdialog_win.cpp:123
      Qt5: qtbase\src\printsupport\dialogs\qprintdialog_win.cpp:118

          else if (pdlg->printRange() == QPrintDialog::CurrentPage &&
                   pdlg->isOptionEnabled(QPrintDialog::PrintCurrentPage))
              pd->Flags |= PD_CURRENTPAGE;
      

      PrintCurrentPage option can be checked like above or maybe patch should enabled option if currentPage range is set? Otherwise CurrentPage is set but disabled.

      Test code:

      #include <QApplication>
      #include <QPrintDialog>
      #include <QPrinter>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QPrinter printer;
          QPrintDialog printDialog(&printer);
          printDialog.setOption(QAbstractPrintDialog::PrintCurrentPage, true);
          printDialog.setPrintRange(QAbstractPrintDialog::CurrentPage);
          printDialog.exec();
          return a.exec();
      }
      

      Someone could make decision with this and add to release.

      Attachments

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

        Activity

          People

            johnlayt John Layt
            qtcomsupport Qt Support
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes