Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPainter/QPainterPath and svg groups
Forum Updated to NodeBB v4.3 + New Features

QPainter/QPainterPath and svg groups

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    acethewd
    wrote on last edited by
    #1

    I am sure this has been discussed before but I can't seem to find anything on it.

    I am using QPainter and QPainterPath to generate path information that I output to an svg file. This works fine except when I want to have nested groups. I can't seem to find the correct combination of commands to allow me to nest grouped paths.

    Below was generated with SVG-edit and is a simple example of what I am trying do.

    @<svg width="640" height="480" >
    <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
    <g>
    <title>Layer 1</title>
    <g id="svg_9">
    <g id="svg_7">
    <g id="svg_3">
    <rect id="svg_1" height="63" width="75" y="38" x="39" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    <rect id="svg_2" height="74" width="121" y="155" x="62" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    </g>
    <g id="svg_6">
    <ellipse ry="44" rx="44" id="svg_4" cy="77" cx="312" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    <ellipse ry="31" rx="29" id="svg_5" cy="165" cx="301" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    </g>
    </g>
    <circle id="svg_8" r="44.65423" cy="320" cx="199" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    </g>
    </g>
    </svg>@

    Using the Qt classes, I get something similar to the following where all my grouped paths are at the same level (this isn't exact since I don't have Qt loaded on this system):

    @<svg width="640" height="480" >
    <g>
    <title>Layer 1</title>
    <g>
    <rect id="svg_1" height="63" width="75" y="38" x="39" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    <rect id="svg_2" height="74" width="121" y="155" x="62" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    </g>
    <g>
    <ellipse ry="44" rx="44" id="svg_4" cy="77" cx="312" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    <ellipse ry="31" rx="29" id="svg_5" cy="165" cx="301" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    </g>
    <g>
    <circle id="svg_8" r="44.65423" cy="320" cx="199" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="5" stroke="#000000" fill="#FF0000"/>
    </g>
    </g>
    </svg>@

    Any suggestions are appreciated. Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      acethewd
      wrote on last edited by
      #2

      No ideas?

      Guess I can drop the use of the QPainter/QPainterPath classes and just manually create the svg file. Bit more work but does give me more control.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved