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

When using QWidget::render to export to vector formats, QAbstractScrollAreas should be correctly clipped

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Component/s: PDF, SVG Support
    • Labels:
      None

      Description

      I want to export widget contents to PNG, SVG, and PDF depending what the user chooses. Using QWidget::render, exporting to PNG works nicely but when using QSvgGenerator and QPdfWriter, elements outside the QAbstractScrollArea are not correctly clipped. See the attached minimal example.

      PNG export:

      PDF export, converted to PNG using pdftoppm:

      SVG export converted to PNG using ImageMagick:

      As can be seen, for both SVG and PDF export, The 6th row and the 3rd column of the table lookg wrong. They should be clipped at the scrollbars. Also the SVG export does not correctly clip the textinside the widgets even though QWidget::render on QPdfWriter does this correctly.

      There are other problems, like the light gray rectangle extending below the tab rider, which only is there in the PDF/SVG export. I think, I'll open another issue for this.

      There also is a problem with the SVG export's tab rider outline being black for some reason instead of a light gray.

        Attachments

        1. main.cpp
          4 kB
        2. project.pro
          0.1 kB
        3. test.pdf.png-1.png
          test.pdf.png-1.png
          21 kB
        4. test.png
          test.png
          11 kB
        5. test.svg.png
          test.svg.png
          16 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            srutledg Shawn Rutledge
            Reporter:
            uiohbgq uiohbgq
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes