| 434 | } |
| 435 | |
| 436 | void QmitkPropertiesTableModel::Reset() |
| 437 | { |
| 438 | // remove all selected properties |
| 439 | while (!m_SelectedProperties.empty()) |
| 440 | { |
| 441 | this->RemoveSelectedProperty(m_SelectedProperties.size() - 1); |
| 442 | } |
| 443 | |
| 444 | std::vector<PropertyDataSet> allPredicates; |
| 445 | auto propertyList = m_PropertyList.Lock(); |
| 446 | |
| 447 | if (propertyList.IsNotNull()) |
| 448 | { |
| 449 | // first of all: collect all properties from the list |
| 450 | for (auto it = propertyList->GetMap()->begin(); it != propertyList->GetMap()->end(); it++) |
| 451 | { |
| 452 | allPredicates.push_back(*it); //% TODO |
| 453 | } |
| 454 | } |
| 455 | // make a subselection if a keyword is specified |
| 456 | if (!m_FilterKeyWord.empty()) |
| 457 | { |
| 458 | std::vector<PropertyDataSet> subSelection; |
| 459 | |
| 460 | for (auto it = allPredicates.begin(); it != allPredicates.end(); it++) |
| 461 | { |
| 462 | // add this to the selection if it is matched by the keyword |
| 463 | if ((*it).first.find(m_FilterKeyWord) != std::string::npos) |
| 464 | subSelection.push_back((*it)); |
| 465 | } |
| 466 | allPredicates.clear(); |
| 467 | allPredicates = subSelection; |
| 468 | } |
| 469 | |
| 470 | PropertyDataSet tmpPropertyDataSet; |
| 471 | // add all selected now to the Model |
| 472 | for (auto it = allPredicates.begin(); it != allPredicates.end(); it++) |
| 473 | { |
| 474 | tmpPropertyDataSet = *it; |
| 475 | this->AddSelectedProperty(tmpPropertyDataSet); |
| 476 | } |
| 477 | |
| 478 | // sort the list as indicated by m_SortDescending |
| 479 | this->sort(m_SortDescending); |
| 480 | |
| 481 | // model was reset |
| 482 | QAbstractTableModel::beginResetModel(); |
| 483 | QAbstractTableModel::endResetModel(); |
| 484 | } |
| 485 | |
| 486 | void QmitkPropertiesTableModel::SetFilterPropertiesKeyWord(std::string _FilterKeyWord) |
| 487 | { |
no test coverage detected