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

Qt Print Dialog has no data starting on page 2.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.11.3
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      This is a bug with QPreviewPaintEngine.
      If I use setClipPath to cut the original image, the preview data will disappear from the second page.
      Comparing the generated preview QPictures , starting from page 2 , the data size starts to be different from that of page1 .
      Here is my example:

      QPrintPreviewDialog dialog;
      connect(&dialog, &QPrintPreviewDialog::paintRequested, this, [=](QPrinter *_printer){
          QPainter p(_printer);
      
          QImage testImage(_printer->pageLayout().fullRectPixels(_printer->resolution()).size(), QImage::Format_ARGB32);
          testImage.fill(Qt::green);
          p.setClipRect(QRect(0, 0, 200, 200));
          for (int i = 0; i < 10; ++i) {
              if (i != 0)
                  _printer->newPage();
      
              p.drawImage(0, 0, testImage);
          }
          for (int i = 0; i < _printer->d_func()->previewPages().count(); ++i) {
              qInfo() << "currentPage: " << i + 1 << "Pictures Data Size: " <<  _printer->d_func()->previewPages().at(i)->size();
          }
      });
      
      dialog.exec();

       

       

      The following is the debug output of the program:

       

      currentPage: 1 Pictures Data Size: 138
       currentPage: 2 Pictures Data Size: 355
       currentPage: 3 Pictures Data Size: 355
       currentPage: 4 Pictures Data Size: 355
       currentPage: 5 Pictures Data Size: 355
       currentPage: 6 Pictures Data Size: 355
       currentPage: 7 Pictures Data Size: 355
       currentPage: 8 Pictures Data Size: 355
       currentPage: 9 Pictures Data Size: 355
       currentPage: 10 Pictures Data Size: 353

      Obviously, the same image is used as the raw data, but the resulting data is not the same size.Even if the setClippath function is not used, the output data size is also not the same.

       

        Attachments

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

          Activity

            People

            Assignee:
            vgt Eirik Aavitsland
            Reporter:
            chen_bin Chen Bin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes