| 167 | } |
| 168 | |
| 169 | void TableView::hideColumns(const QStringList& header_names) |
| 170 | { |
| 171 | /* |
| 172 | * Suppressing warning toSet() deprecated till Qt 5.14 |
| 173 | */ |
| 174 | #pragma GCC diagnostic push |
| 175 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 176 | auto hset = header_names.toSet(); |
| 177 | #pragma GCC diagnostic pop |
| 178 | // add actions which show/hide columns |
| 179 | for (int i = 0; i != columnCount(); ++i) |
| 180 | { |
| 181 | QTableWidgetItem* ti = horizontalHeaderItem(i); |
| 182 | if (ti == nullptr) |
| 183 | { |
| 184 | continue; |
| 185 | } |
| 186 | if (hset.contains(ti->text())) |
| 187 | { |
| 188 | setColumnHidden(i, true); |
| 189 | hset.remove(ti->text()); |
| 190 | } |
| 191 | } |
| 192 | if (!hset.empty()) |
| 193 | { |
| 194 | throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "header_names contains a column name which is unknown: " + String(hset.values().join(", "))); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | void TableView::appendRow() |
| 199 | { |