title: QtChart - C++ - Saving a chart which wasn't displayed
body: <p>I'm trying to save a chart to a file, in a QTextDocument in this example :</p>
  
  <pre><code>QTextDocument doc("Frame rate test\n");
  QTextCursor cursor(&amp;doc);
  cursor.movePosition(QTextCursor::End);
  
  if (getTestFinishedStatus())
  {
      QPixmap pix = _pFrameRateChart-&gt;grab(); //_pFrameRateChart is QChartView
      cursor.insertImage(pix.toImage());
  }
  
  QTextDocumentWriter docWriter;
  docWriter.setFileName("framerate.odf");
  docWriter.setFormat("ODF");
  docWriter.write(&amp;doc);
  </code></pre>
  
  <p>The problem is the result isn't same if I'm displaying the chart in an ui.
  Here is the result when not displayed :</p>
  
  <p><a href="https://i.stack.imgur.com/BkLKO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BkLKO.png" alt="enter image description here"></a></p>
  
  <p>Here is the result when displayed :</p>
  
  <p><a href="https://i.stack.imgur.com/mx4W1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mx4W1.png" alt="enter image description here"></a></p>
  
  <p>Obviously I would like to have the second result even when I don't add the ChartView to a widget to display it on an ui.
  I've tried resizing the QChartView, resizing the QChart, adding the Chart to a temporarly widget and QVBoxLayout then saving it, showing temporarly the QChartView before saving it etc... but didn't managed to get a good result.</p>