MCPcopy Create free account
hub / github.com/Geant4/geant4 / LookForHelpStringInChildTree

Method LookForHelpStringInChildTree

source/interfaces/implementation/src/G4UIQt.cc:5607–5630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5605
5606
5607QMultiMap<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
5633G4double G4UIQt::ComputeStringMatchScore(const QString& string, const QString& searchText)

Callers

nothing calls this directly

Calls 8

GetTreeEntryMethod · 0.80
GetCommandEntryMethod · 0.80
QStringClass · 0.50
GetTreeMethod · 0.45
clearMethod · 0.45
GetCommandMethod · 0.45
dataMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected