| 57 | } |
| 58 | |
| 59 | void TreeView::hideColumns(const QStringList& header_names) |
| 60 | { |
| 61 | /* |
| 62 | * Suppressing warning toSet() deprecated till Qt 5.14 |
| 63 | */ |
| 64 | #pragma GCC diagnostic push |
| 65 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 66 | auto hset = header_names.toSet(); |
| 67 | #pragma GCC diagnostic pop |
| 68 | // add actions which show/hide columns |
| 69 | const auto& header = this->headerItem(); |
| 70 | |
| 71 | for (int i = 0; i < header->columnCount(); ++i) |
| 72 | { |
| 73 | if (hset.contains(header->text(i))) |
| 74 | { |
| 75 | setColumnHidden(i, true); |
| 76 | hset.remove(header->text(i)); |
| 77 | } |
| 78 | } |
| 79 | if (!hset.empty()) |
| 80 | { |
| 81 | throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "header_names contains a column name which is unknown: " + String(hset.values().join(", "))); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | QStringList TreeView::getHeaderNames(const WidgetHeader which) const |
| 86 | { |