Callback call when "enter" clicked on the command zone. If command has no parameters :send the command to geant4 Else, open a dialog for parameters input @param aCommand */
| 5328 | @param aCommand |
| 5329 | */ |
| 5330 | void G4UIQt::ButtonCallback(const QString& aCommand) |
| 5331 | { |
| 5332 | G4String ss = G4StrUtil::lstrip_copy(G4String(aCommand.toStdString().c_str())); |
| 5333 | |
| 5334 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
| 5335 | if (UI == nullptr) return; |
| 5336 | G4UIcommandTree* treeTop = UI->GetTree(); |
| 5337 | |
| 5338 | G4UIcommand* command = treeTop->FindPath(ss); |
| 5339 | |
| 5340 | if (command != nullptr) { |
| 5341 | // if is GUI, then open a dialog |
| 5342 | if (IsGUICommand(command)) { |
| 5343 | auto menuParameterDialog = new QDialog(); |
| 5344 | |
| 5345 | if (CreateVisCommandGroupAndToolBox(command, menuParameterDialog, 1, true)) { |
| 5346 | menuParameterDialog->setWindowTitle(aCommand); |
| 5347 | menuParameterDialog->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); |
| 5348 | |
| 5349 | // exec this dialog, apply the command automaticaly, and return |
| 5350 | menuParameterDialog->exec(); |
| 5351 | return; |
| 5352 | } |
| 5353 | delete menuParameterDialog; |
| 5354 | } |
| 5355 | } |
| 5356 | |
| 5357 | ApplyShellCommand(ss, exitSession, exitPause); |
| 5358 | |
| 5359 | // Rebuild help tree |
| 5360 | FillHelpTree(); |
| 5361 | |
| 5362 | if (exitSession) SessionTerminate(); |
| 5363 | } |
| 5364 | |
| 5365 | /** This callback is activated when user selected a item in the help tree |
| 5366 | */ |