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

Method CreateHelpTree

source/interfaces/implementation/src/G4UIQt.cc:4180–4219  ·  view source on GitHub ↗

Fill the Help Tree Widget @param aParent : parent item to fill @param aCommandTree : commandTree node associate with this part of the Tree */

Source from the content-addressed store, hash-verified

4178 @param aCommandTree : commandTree node associate with this part of the Tree
4179*/
4180void G4UIQt::CreateHelpTree(QTreeWidgetItem* aParent, G4UIcommandTree* aCommandTree)
4181{
4182 if (aParent == nullptr) return;
4183 if (aCommandTree == nullptr) return;
4184
4185 // Creating new item
4186 QTreeWidgetItem* newItem;
4187
4188 QString commandText = "";
4189 // Get the Sub directories
4190 for (G4int a = 0; a < aCommandTree->GetTreeEntry(); ++a) {
4191 commandText = QString((char*)(aCommandTree->GetTree(a + 1)->GetPathName()).data()).trimmed();
4192
4193 // if already exist, don't create it !
4194 newItem = FindTreeItem(aParent, commandText);
4195 if (newItem == nullptr) {
4196 newItem = new QTreeWidgetItem();
4197 newItem->setText(0, GetShortCommandPath(commandText));
4198 aParent->addChild(newItem);
4199 }
4200 CreateHelpTree(newItem, aCommandTree->GetTree(a + 1));
4201 }
4202
4203 // Get the Commands
4204
4205 for (G4int a = 0; a < aCommandTree->GetCommandEntry(); ++a) {
4206 QStringList stringList;
4207 commandText =
4208 QString((char*)(aCommandTree->GetCommand(a + 1)->GetCommandPath()).data()).trimmed();
4209
4210 // if already exist, don't create it !
4211 newItem = FindTreeItem(aParent, commandText);
4212 if (newItem == nullptr) {
4213 newItem = new QTreeWidgetItem();
4214 newItem->setText(0, GetShortCommandPath(commandText));
4215 aParent->addChild(newItem);
4216 newItem->setExpanded(false);
4217 }
4218 }
4219}
4220
4221/**
4222 Add the following command to the corresponding groupbox

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected