* lazzara/igr/gui/segmentation2dt/src/plot_widget.cc,
* lazzara/igr/gui/segmentation2dt/src/plot_widget.hh: Here.
---
milena/sandbox/ChangeLog | 7 ++++++
.../igr/gui/segmentation2dt/src/plot_widget.cc | 21 ++++++++++++++++++++
.../igr/gui/segmentation2dt/src/plot_widget.hh | 1 +
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 07874a9..62d9d00 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,12 @@
2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add save button for function plots.
+
+ * lazzara/igr/gui/segmentation2dt/src/plot_widget.cc,
+ * lazzara/igr/gui/segmentation2dt/src/plot_widget.hh: Here.
+
+2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add function visualization in the mean region widget.
* lazzara/igr/gui/segmentation2dt/src/mean_regions_widget.cc,
diff --git a/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.cc
b/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.cc
index a19ce36..d90d6d4 100644
--- a/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.cc
+++ b/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.cc
@@ -78,6 +78,27 @@ namespace igr
}
+ void plot_widget::on_savePlotBtn__clicked()
+ {
+ QPixmap plotPix = QPixmap::grabWidget(plot_);
+
+ QString plotfile = QFileDialog::getSaveFileName(this,
+ tr("Save plot."),
+ QString(),
+ tr("PNG (*.png)"));
+
+ if (!plotfile.endsWith(".png", Qt::CaseInsensitive))
+ plotfile.append(".png");
+
+ if (!plotPix.save(plotfile, "PNG", 100))
+ {
+ QMessageBox::critical(0, "Error saving plot!",
+ "Cannot write plot file. Make sure you have "
+ "write permissions.");
+ }
+ }
+
+
} // end of namespace igr::segmentation
} // end of namespace igr
diff --git a/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.hh
b/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.hh
index bdfce62..e9af350 100644
--- a/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.hh
+++ b/milena/sandbox/lazzara/igr/gui/segmentation2dt/src/plot_widget.hh
@@ -62,6 +62,7 @@ namespace igr
void on_zoomBestBtn__clicked();
void on_zoomOutBtn__clicked();
void on_zoomInBtn__clicked();
+ void on_savePlotBtn__clicked();
private: // Members
--
1.5.6.5