Hello,

I wanted to save a plot as an image and I have a problem with that. I found QwtPlotRender class and renderDocument() method but isn't work as I expected. Small example explain what I mean.

Qt Code:
  1. QwtPlot *plot = new QwtPlot(this);
  2. plot->setTitle(trUtf8("Tytuł nowy"));
  3.  
  4. QwtPlotCurve *curve_samples = new QwtPlotCurve();
  5. curve_samples->attach(plot);
  6. curve_samples->setRawSamples(x, y, 100);
  7. curve_samples->setTitle("Title of cuvere_sample");
  8. curve_samples->setPen(QPen(QColor(Qt::red)));
  9. curve_samples->setCurveAttribute(QwtPlotCurve::Fitted, true);
  10.  
  11. plot->setAxisTitle(QwtPlot::xBottom, "test");
  12.  
  13. ui->verticalLayout->addWidget(plot);
  14.  
  15. QwtPlotRenderer *renderer = new QwtPlotRenderer();
  16. renderer->renderDocument(plot, "/home/discovery/test.png", QSizeF(150, 100));
To copy to clipboard, switch view to plain text mode 

The problem is with QwtPlotCurve, samples are not saved on image.

app_window.jpg
Plot in my application.
test.png
Plot saved in png file.

Did I do something wrong? I am quite beginner with qwt library