QString filename
= QFileDialog::getSaveFileName(this,
"Export image",
"",
"Images (*.png)");
int imgWidth = this->myGraphicsScene->width();
int imgHeight = this->myGraphicsScene->height();
qpainter.begin(&qimg);
this->myGraphicsScene->render(&qpainter);
qpainter.end();
qimg.save(filename);
QString filename = QFileDialog::getSaveFileName(this, "Export image", "", "Images (*.png)");
int imgWidth = this->myGraphicsScene->width();
int imgHeight = this->myGraphicsScene->height();
QImage qimg(imgWidth, imgHeight, QImage::Format_ARGB32);
QPainter qpainter;
qpainter.begin(&qimg);
this->myGraphicsScene->render(&qpainter);
qpainter.end();
qimg.save(filename);
To copy to clipboard, switch view to plain text mode
Bookmarks