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

Method streamModelToString

Modules/ModelFitUI/src/QmitkFitParameterWidget.cpp:88–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88std::string QmitkFitParameterWidget::streamModelToString() const
89{
90 std::ostringstream stream;
91 stream.imbue(std::locale("C"));
92
93 //head line
94 const auto colCount = this->m_InternalModel->columnCount();
95 for (int col = 0; col < colCount; ++col)
96 {
97 if (col != 0)
98 {
99 stream << ",";
100 }
101 stream << SanatizeString(m_InternalModel->headerData(col, Qt::Horizontal, Qt::DisplayRole).toString().toStdString());
102 }
103 stream << std::endl;
104
105 //content
106 const auto rowCount = this->m_InternalModel->rowCount();
107 for (int row = 0; row < rowCount; ++row)
108 {
109 QModelIndex index = this->m_InternalModel->index(row, 0);
110
111 const auto childCount = this->m_InternalModel->rowCount(index);
112
113 if (childCount == 0)
114 {
115 for (int col = 0; col < colCount; ++col)
116 {
117 if (col != 0)
118 {
119 stream << ",";
120 }
121 stream << SanatizeString(m_InternalModel->data(index.siblingAtColumn(col), Qt::DisplayRole).toString().toStdString());
122 }
123 stream << std::endl;
124 }
125 else
126 {
127 mitkThrow() << "Missing implementation for multiple fits.";
128 //TODO FIT REFACTOR
129 }
130 }
131
132 return stream.str();
133}
134
135void QmitkFitParameterWidget::OnClipboardResultsButtonClicked() const
136{

Callers 2

OnExportClickedMethod · 0.95

Calls 7

SanatizeStringFunction · 0.85
columnCountMethod · 0.45
toStringMethod · 0.45
headerDataMethod · 0.45
rowCountMethod · 0.45
indexMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected