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

Rendering a SVG file back to an SVG or another vector format using QSvgGenerator or QPrinter adds strokes around paths and rects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 4.8.4, 5.0.1
    • None
    • Mac OS X 10.6.8 Snow Leopard, Mac OS X 10.8.2 Mountain Lion, Windows XP
    • macOS

      Compile the small app below. It loads a simple SVG file to a QPicture (to hold vector data). This 1st SVG file has a text and a text that is converted to a path. Rendering to pixels (QWidget, QImage) works fine. Rendering to SVG or PDF (Qt print engine) adds a stroke around the paths (see the out.***).

      This behaviour becomes clear if you change the line
      QSvgRenderer svgRenderer(dirPath + "in1.svg");
      to
      QSvgRenderer svgRenderer(dirPath + "in2.svg");
      In this 2nd example SVG file is just a line and a rect, both with 1 pt thickness. After qt's conversion the line is fine but a stroke seems to be added to the the rect.

      It seems like someone forgot to clear the pen with QPainter::setPen(Qt::NoPen)?

        1. in1.svg
          4 kB
          Florian Bauer
        2. in2.svg
          0.6 kB
          Florian Bauer
        3. main.cpp
          2 kB
          Florian Bauer
        4. qprinterbug.pro
          0.3 kB
          Florian Bauer
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            floba Florian Bauer
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes