title: Multi-line centered text in svg rendered in qt
body: <p>I am trying to make an svg that will be read in a <code>QGraphicsSvgItem</code>. I read some documentation, and it seems this is what I want:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363)  --&gt;
  &lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt;
  &lt;svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
       width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100"
       xml:space="preserve"&gt;
      &lt;rect fill="#437624" stroke="none" fill-opacity="1" x="0" y="0" width="100" height="100" /&gt;
  
      &lt;text y="50" transform="translate(50)"&gt;
         &lt;tspan x="0" text-anchor="middle"&gt;No&lt;/tspan&gt;
         &lt;tspan x="0" text-anchor="middle" dy="15"&gt;Arrow&lt;/tspan&gt;
     &lt;/text&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>This creates a rectangle - and a multi-line text centered inside:<br>
  <a href="https://i.stack.imgur.com/w9J6H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w9J6H.png" alt="enter image description here"></a>   This is what it looks like in the browser.</p>
  
  <p>In Qt though, when loaded in <code>QGraphicsSvgItem</code>, it looks like this:<br>
  <a href="https://i.stack.imgur.com/9HOA5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9HOA5.png" alt="enter image description here"></a></p>
  
  <p>I imagine that something is not supported by the Qt SVG renderer... </p>
  
  <p>Even worse, setting the font size makes my Qt text completely disappear:</p>
  
  <pre><code>    &lt;text y="40" font-size="24" transform="translate(50)"&gt;
         &lt;tspan x="0" text-anchor="middle"&gt;No&lt;/tspan&gt;
         &lt;tspan x="0" text-anchor="middle" dy="30"&gt;Arrow&lt;/tspan&gt;
     &lt;/text&gt;
  </code></pre>
  
  <p>How can I make Qt get a multi-line centered text, as the first image, from the svg (what should I put in the SVG) ?</p>
  
  <p>(Qt 4.7 to 5.5...)</p>
  
  <p>Edit:</p>
  
  <p>This worked (but still can't figure out how to do multi-line other than determining individual items)</p>
  
  <pre><code>&lt;text x="0" y="40" font-size="24" transform="translate(50)" text-anchor="middle"&gt;No&lt;/text&gt;
  &lt;text x="0" y="70" font-size="24" transform="translate(50)" text-anchor="middle"&gt;Arrow&lt;/text&gt;
  </code></pre>
  
  <p>I find it puzzling that even copying svgs from tutorials, any svgs that contain <code>tspan</code> render correctly in browser but don't show in <code>QGraphicsSvgItem</code> - or perhaps they do but in a complete different location.</p>