This callback is activated when user selected a item in the help tree */
| 5365 | /** This callback is activated when user selected a item in the help tree |
| 5366 | */ |
| 5367 | void G4UIQt::HelpTreeClicCallback() |
| 5368 | { |
| 5369 | QTreeWidgetItem* item = nullptr; |
| 5370 | if (fHelpTreeWidget == nullptr) return; |
| 5371 | |
| 5372 | QList<QTreeWidgetItem*> list = fHelpTreeWidget->selectedItems(); |
| 5373 | if (list.isEmpty()) return; |
| 5374 | item = list.first(); |
| 5375 | if (item == nullptr) return; |
| 5376 | |
| 5377 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
| 5378 | if (UI == nullptr) return; |
| 5379 | G4UIcommandTree* treeTop = UI->GetTree(); |
| 5380 | |
| 5381 | std::string itemText = GetLongCommandPath(item).toStdString(); |
| 5382 | |
| 5383 | // check if it is a command path |
| 5384 | if (item->childCount() > 0) { |
| 5385 | itemText += "/"; |
| 5386 | } |
| 5387 | G4UIcommand* command = treeTop->FindPath(itemText.c_str()); |
| 5388 | |
| 5389 | if (command != nullptr) { |
| 5390 | updateHelpArea(command); |
| 5391 | } |
| 5392 | else { // this is a command |
| 5393 | G4UIcommandTree* path = treeTop->FindCommandTree(itemText.c_str()); |
| 5394 | if (path != nullptr) { |
| 5395 | // this is not a command, this is a sub directory |
| 5396 | // We display the Title |
| 5397 | fParameterHelpLabel->setVisible(true); |
| 5398 | fParameterHelpLabel->setText(path->GetTitle().data()); |
| 5399 | fParameterHelpTable->setVisible(false); |
| 5400 | } |
| 5401 | } |
| 5402 | } |
| 5403 | |
| 5404 | /** This callback is activated when user double clic on a item in the help tree |
| 5405 | */ |
nothing calls this directly
no test coverage detected