| 107 | } |
| 108 | |
| 109 | void QmitkFitPlotDataWidget::OnExportClicked() const |
| 110 | { |
| 111 | QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save plot data to csv file")); |
| 112 | |
| 113 | if (fileName.isEmpty()) |
| 114 | { |
| 115 | QMessageBox::critical(nullptr, tr("No file selected!"), |
| 116 | tr("Cannot export pixel dump. Please selected a file.")); |
| 117 | } |
| 118 | else |
| 119 | { |
| 120 | std::ofstream file; |
| 121 | |
| 122 | std::ios_base::openmode iOpenFlag = std::ios_base::out | std::ios_base::trunc; |
| 123 | file.open(fileName.toStdString().c_str(), iOpenFlag); |
| 124 | |
| 125 | if (!file.is_open()) |
| 126 | { |
| 127 | QMessageBox::critical(nullptr, tr("Cannot create/open selected file!"), |
| 128 | tr("Cannot open or create the selected file. Export will be aborted. Selected file name: ") + |
| 129 | fileName); |
| 130 | return; |
| 131 | } |
| 132 | |
| 133 | file << this->StreamModelToString(); |
| 134 | |
| 135 | file.close(); |
| 136 | } |
| 137 | |
| 138 | } |
nothing calls this directly
no test coverage detected