| 198 | } |
| 199 | |
| 200 | void QmitkFindSegmentationTaskDialog::ApplyFilter() |
| 201 | { |
| 202 | auto* table = m_Ui->tableWidget; |
| 203 | const int numberOfRows = table->rowCount(); |
| 204 | bool foundSomething = false; |
| 205 | |
| 206 | for (int row = 0; row < numberOfRows; ++row) |
| 207 | { |
| 208 | if (!this->ContainsNumber(row) || !this->ContainsName(row) || !this->HasStatus(row)) |
| 209 | { |
| 210 | table->hideRow(row); |
| 211 | continue; |
| 212 | } |
| 213 | |
| 214 | table->showRow(row); |
| 215 | |
| 216 | if (!foundSomething) |
| 217 | { |
| 218 | // Select the *first* finding to accelerate user interaction. For example, in a fresh dialog, typing |
| 219 | // '4', '2', '<Return>' will close the dialog and load task 42. In combination with the Ctrl+F shortcut |
| 220 | // for this dialog, no mouse interaction is necessary at all to jump to specific tasks. |
| 221 | table->selectRow(row); |
| 222 | foundSomething = true; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | if (!foundSomething) |
| 227 | table->clearSelection(); // Hidden rows do not automatically lose selection |
| 228 | } |
| 229 | |
| 230 | bool QmitkFindSegmentationTaskDialog::ContainsNumber(int row) const |
| 231 | { |
no test coverage detected