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

QPrintDialog does not return a printer

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.9.2
    • Fix Version/s: 5.9.2
    • Component/s: GUI: Printing
    • Labels:
      None
    • Commits:
      2b51ad471270c01858369f10c7645d863d89160c

      Description

      my code, which has not been modified, worked with qt-5.9.1

      QPrintDialog appears and I select a printer, but the log file shows:

      check for printer
      result:1
      page 767 x 1110
      Could not determine printer to print to

      My code is:

      QtPdf::QtPdf(const RptType tp, const short id)
      {
      QString fn = QDir::homePath() + "/reports/doc-";
      fn += QString::number(id) + ".pdf";
      printer.setOutputFileName(fn);
      printer.setDocName("Invoice");
      printer.setColorMode(QPrinter::Color);
      printer.setFontEmbeddingEnabled(true);
      QPageLayout qpl;
      printer.setOutputFormat(QPrinter::PdfFormat);
      printer.setPageLayout(qpl);
      printer.setPageOrientation(QPageLayout::Portrait);
      printer.setCreator("xyz SCRL");
      QPrintDialog *dialog = new QPrintDialog(&printer);
      dialog->setWindowTitle("Print Document");
      if (dialog->exec() != QDialog::Accepted)
      return;
      dY = BORDER_TOP;
      painter.begin(&printer);

      QFont qf;
      qf.setFamily(DEFAULT_FONT);
      painter.setFont(qf);

      QRectF pz = printer.pageRect(QPrinter::DevicePixel);
      pageHeight = pz.bottom();
      pageWidth = pz.right() - pz.left();
      cout << "page " << pageWidth << " x " << pageHeight << endl;
      getCoy();
      SetFontSize( 10 );
      switch (tp) {
      case invoice: getInv(id); break;
      case reminder: remind(id); break;
      }
      }

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              andysh Andy Shaw
              Reporter:
              treeve Treeve Jelbert
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes