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

Method ApplyFilter

Modules/SegmentationUI/src/QmitkFindSegmentationTaskDialog.cpp:200–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void 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
230bool QmitkFindSegmentationTaskDialog::ContainsNumber(int row) const
231{

Callers 1

Calls 4

ContainsNumberMethod · 0.95
ContainsNameMethod · 0.95
HasStatusMethod · 0.95
rowCountMethod · 0.45

Tested by

no test coverage detected