| 5605 | |
| 5606 | |
| 5607 | QMultiMap<G4double, QString> G4UIQt::LookForHelpStringInChildTree( |
| 5608 | G4UIcommandTree* aCommandTree, const QString& searchText) |
| 5609 | { |
| 5610 | QMultiMap<G4double, QString> commandResultMap; |
| 5611 | if (aCommandTree == nullptr) return commandResultMap; |
| 5612 | |
| 5613 | // Loop over sub trees |
| 5614 | QMultiMap<G4double, QString> commandChildResultMap; |
| 5615 | for (G4int i = 0; i < aCommandTree->GetTreeEntry(); ++i) { |
| 5616 | commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->GetTree(i + 1), searchText); |
| 5617 | commandResultMap += commandChildResultMap; |
| 5618 | commandChildResultMap.clear(); |
| 5619 | } |
| 5620 | |
| 5621 | // Loop over the commands and compute match score |
| 5622 | for (G4int i = 0; i < aCommandTree->GetCommandEntry(); ++i) { |
| 5623 | const G4UIcommand* command = aCommandTree->GetCommand(i + 1); |
| 5624 | if (command == nullptr) continue; |
| 5625 | G4double score = ComputeStringMatchScore(QString(command->GetCommandPath().data()), searchText); |
| 5626 | if (score > 0) commandResultMap.insert(score, QString(command->GetCommandPath().data())); |
| 5627 | } |
| 5628 | |
| 5629 | return commandResultMap; |
| 5630 | } |
| 5631 | |
| 5632 | |
| 5633 | G4double G4UIQt::ComputeStringMatchScore(const QString& string, const QString& searchText) |
nothing calls this directly
no test coverage detected