Hi,
I have a problem while saving a Qwt plot as an png image.
I use QPixmap::grabWidget method but only some part of the plot
is written to png file (only label texts and title), and the plot itself is not written to png file...
I added snapshots of original plot and saved plot. Any idea to fix the problem?
int main(int argc, char **argv)
{
Plot plot;
#if QT_VERSION < 0x040000
a.setMainWidget(&plot);
#endif
plot.resize(600,400);
plot.show();
QPixmap p
= QPixmap::grabWidget(&plot,
0,
0, plot.
width(), plot.
height());
p.save("C:\\plot.png","png");
return a.exec();
}
int main(int argc, char **argv)
{
QApplication a(argc, argv);
Plot plot;
#if QT_VERSION < 0x040000
a.setMainWidget(&plot);
#endif
plot.resize(600,400);
plot.show();
QPixmap p = QPixmap::grabWidget(&plot, 0, 0, plot.width(), plot.height());
p.save("C:\\plot.png","png");
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks