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

Method FillHelpTree

source/interfaces/implementation/src/G4UIQt.cc:4128–4174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4126 */
4127
4128void G4UIQt::FillHelpTree()
4129{
4130 if (fHelpTreeWidget == nullptr) {
4131 InitHelpTreeAndVisParametersWidget();
4132 }
4133
4134 QString searchText = fHelpLine->text();
4135
4136 if (searchText == "") {
4137 fHelpTreeWidget->clear();
4138 } else {
4139 return;
4140 }
4141
4142 if (fParameterHelpLabel != nullptr) {
4143 fParameterHelpLabel->setText("Choose a command in the command tree");
4144 fParameterHelpTable->setVisible(false);
4145 }
4146
4147 G4UImanager* UI = G4UImanager::GetUIpointer();
4148 if (UI == nullptr) return;
4149 G4UIcommandTree* treeTop = UI->GetTree();
4150
4151 G4int treeSize = treeTop->GetTreeEntry();
4152 QTreeWidgetItem* newItem = nullptr;
4153 QString commandText = "";
4154 for (G4int a = 0; a < treeSize; ++a) {
4155 // Creating new item
4156 newItem = nullptr;
4157
4158 commandText = QString((char*)(treeTop->GetTree(a + 1)->GetPathName()).data()).trimmed();
4159
4160 // if already exist, don't create it !
4161 for (G4int b = 0; b < fHelpTreeWidget->topLevelItemCount(); ++b) {
4162 if (newItem == nullptr) newItem = FindTreeItem(fHelpTreeWidget->topLevelItem(b), commandText);
4163 }
4164
4165 if (newItem == nullptr) {
4166 newItem = new QTreeWidgetItem();
4167 newItem->setText(0, GetShortCommandPath(commandText));
4168 fHelpTreeWidget->addTopLevelItem(newItem);
4169 }
4170
4171 // look for childs
4172 CreateHelpTree(newItem, treeTop->GetTree(a + 1));
4173 }
4174}
4175
4176/** Fill the Help Tree Widget
4177 @param aParent : parent item to fill

Callers

nothing calls this directly

Calls 7

setVisibleMethod · 0.80
GetTreeEntryMethod · 0.80
QStringClass · 0.50
textMethod · 0.45
clearMethod · 0.45
GetTreeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected