diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-12-29 16:36:53 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-12-29 16:36:53 +0100 |
commit | 58183c47c2b3235f8f56dc6492bb41b775dd6f26 (patch) | |
tree | 568a2ea0b7fd451a36637c44d61618b20792668b /src/mainwindow.cc | |
parent | 9f33eb49ccb7fa8fb80f00865819beb499e70025 (diff) |
Added image export functionality.
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r-- | src/mainwindow.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc index e52b9f3..298c811 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -117,6 +117,11 @@ MainWindow::MainWindow(QString p) connect(act, SIGNAL(triggered()), this, SLOT(reset())); } + { + QAction *act = toolbar->addAction("Image"); + connect(act, SIGNAL(triggered()), this, SLOT(image())); + } + loadSettings(); statusBar()->showMessage(tr("Ready")); @@ -356,6 +361,28 @@ void MainWindow::reset() out->reset(); } +void MainWindow::image() +{ + QString filename + = QFileDialog::getSaveFileName(this, tr("Save Kaiman File"), + "", + tr("Image Files (*.png)")); + + if(filename == "") + { + // User clicked cancel + return; + } + + if(filename.right(4) != ".png") + { + filename += ".png"; + } + + auto image = out->acquire(true); + image.save(filename); +} + void MainWindow::programChanged() { dirty = true; |