MCPcopy Create free account
hub / github.com/MITK/MITK / OnExportClicked

Method OnExportClicked

Modules/ModelFitUI/src/QmitkFitParameterWidget.cpp:141–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void QmitkFitParameterWidget::OnExportClicked() const
142{
143 QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save fit parameter to csv file"));
144
145 if (fileName.isEmpty())
146 {
147 QMessageBox::critical(nullptr, tr("No file selected!"),
148 tr("Cannot export pixel dump. Please selected a file."));
149 }
150 else
151 {
152 std::ofstream file;
153
154 std::ios_base::openmode iOpenFlag = std::ios_base::out | std::ios_base::trunc;
155 file.open(fileName.toStdString().c_str(), iOpenFlag);
156
157 if (!file.is_open())
158 {
159 QMessageBox::critical(nullptr, tr("Cannot create/open selected file!"),
160 tr("Cannot open or create the selected file. Export will be aborted. Selected file name: ") +
161 fileName);
162 return;
163 }
164
165 file << this->streamModelToString();
166
167 file.close();
168 }
169
170}

Callers

nothing calls this directly

Calls 3

streamModelToStringMethod · 0.95
closeMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected