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

Method OnExportClicked

Modules/ModelFitUI/src/QmitkFitPlotDataWidget.cpp:109–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void 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}

Callers

nothing calls this directly

Calls 3

StreamModelToStringMethod · 0.95
closeMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected