| 4126 | */ |
| 4127 | |
| 4128 | void 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 |
nothing calls this directly
no test coverage detected