diff options
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index e217b1f..6ea98be 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -259,6 +259,7 @@ MainWindow::MainWindow(const QString &filename) connect(this->designActionExportSTL, SIGNAL(triggered()), this, SLOT(actionExportSTL())); connect(this->designActionExportOFF, SIGNAL(triggered()), this, SLOT(actionExportOFF())); connect(this->designActionExportDXF, SIGNAL(triggered()), this, SLOT(actionExportDXF())); + connect(this->designActionExportImage, SIGNAL(triggered()), this, SLOT(actionExportImage())); connect(this->designActionFlushCaches, SIGNAL(triggered()), this, SLOT(actionFlushCaches())); // View menu @@ -1342,6 +1343,24 @@ void MainWindow::actionExportDXF() #endif /* ENABLE_CGAL */ } +void MainWindow::actionExportImage() +{ + QImage img = screen->grabFrameBuffer(); + setCurrentOutput(); + + QString img_filename = QFileDialog::getSaveFileName(this, + "Export Image", "", "PNG Files (*.png)"); + if (img_filename.isEmpty()) { + PRINTF("No filename specified. Image export aborted."); + clearCurrentOutput(); + return; + } + + img.save(img_filename, "PNG"); + + clearCurrentOutput(); +} + void MainWindow::actionFlushCaches() { PolySet::ps_cache.clear(); |