Rendering QChart without QGraphicsView
<p>I'd like to render <code>QChart</code> (which is <code>QGraphicsWidget</code> in its core) to specific painter, for example <code>QSvgGenerator</code>. </p>

<p>I've read following topic <a href="https://forum.qt.io/topic/38352/rendering-qgraphicsitem-without-qgraphicsscene/2" rel="nofollow">https://forum.qt.io/topic/38352/rendering-qgraphicsitem-without-qgraphicsscene/2</a> and implemented it in my code: </p>

<pre><code>QBuffer b;
QSvgGenerator p;
p.setOutputDevice(&amp;b);
QSize s = app-&gt;chart()-&gt;size().toSize();
p.setSize(s);
p.setViewBox(QRect(0,0,s.width(),s.height()));
QPainter painter;
painter.begin(&amp;p);
painter.setRenderHint(QPainter::Antialiasing);
app-&gt;chart()-&gt;paint(&amp;painter, 0, 0); // This gives 0 items in 1 group
m_view-&gt;render(&amp;painter); // m_view has app-&gt;chart() in it, and this one gives right image
qDebug() &lt;&lt; "Copied";
painter.end();
QMimeData * d = new QMimeData();
d-&gt;setData("image/svg+xml",b.buffer());
QApplication::clipboard()-&gt;setMimeData(d,QClipboard::Clipboard);
</code></pre>

<p>There are two lines with comments: first one is for painting <code>QChart</code> directly, second - rendering <code>QGraphicsView</code>. </p>

<p>I've already tried to play with <code>setViewBox</code>, setting it to enormous values doesn't help. The effect is the same if I use <code>QImage</code> instead of <code>QSvgGenerator</code>, I get empty picture.  </p>

<p>So the question is why <code>QChart-&gt;paint()</code> gives me empty painting? </p>

<p>EDIT: working code may be found on bitbucket:  <a href="https://bitbucket.org/morodeer/charts_test_2/commits/b1eee99736beb5e43eae2a40ae116ee07e01558f" rel="nofollow">https://bitbucket.org/morodeer/charts_test_2/commits/b1eee99736beb5e43eae2a40ae116ee07e01558f</a></p>