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.
plot->setTitle(trUtf8("Tytuł nowy"));
curve_samples->attach(plot);
curve_samples->setRawSamples(x, y, 100);
curve_samples->setTitle("Title of cuvere_sample");
curve_samples
->setCurveAttribute
(QwtPlotCurve::Fitted,
true);
plot
->setAxisTitle
(QwtPlot::xBottom,
"test");
ui->verticalLayout->addWidget(plot);
QwtPlotRenderer *renderer = new QwtPlotRenderer();
renderer
->renderDocument
(plot,
"/home/discovery/test.png",
QSizeF(150,
100));
QwtPlot *plot = new QwtPlot(this);
plot->setTitle(trUtf8("Tytuł nowy"));
QwtPlotCurve *curve_samples = new QwtPlotCurve();
curve_samples->attach(plot);
curve_samples->setRawSamples(x, y, 100);
curve_samples->setTitle("Title of cuvere_sample");
curve_samples->setPen(QPen(QColor(Qt::red)));
curve_samples->setCurveAttribute(QwtPlotCurve::Fitted, true);
plot->setAxisTitle(QwtPlot::xBottom, "test");
ui->verticalLayout->addWidget(plot);
QwtPlotRenderer *renderer = new QwtPlotRenderer();
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
Bookmarks