Build the command list parameters in a QString Reimplement partialy the G4UIparameter.cc @param aCommand : command to list parameters @see G4UIparameter::List() @see G4UIcommand::List() @return the command list parameters, or "" if nothing */
| 4647 | @return the command list parameters, or "" if nothing |
| 4648 | */ |
| 4649 | QString G4UIQt::GetCommandList(const G4UIcommand* aCommand) |
| 4650 | { |
| 4651 | QString txt = ""; |
| 4652 | if (aCommand == nullptr) return txt; |
| 4653 | |
| 4654 | G4String commandPath = aCommand->GetCommandPath(); |
| 4655 | G4String rangeString = aCommand->GetRange(); |
| 4656 | auto n_guidanceEntry = (G4int)aCommand->GetGuidanceEntries(); |
| 4657 | auto n_parameterEntry = (G4int)aCommand->GetParameterEntries(); |
| 4658 | |
| 4659 | if ((commandPath.empty()) && (rangeString.empty()) && (n_guidanceEntry == 0) && |
| 4660 | (n_parameterEntry == 0)) |
| 4661 | { |
| 4662 | return txt; |
| 4663 | } |
| 4664 | |
| 4665 | if ((commandPath.length() - 1) != '/') { |
| 4666 | txt += "Command " + QString((char*)(commandPath).data()) + "\n"; |
| 4667 | } |
| 4668 | txt += "Guidance :\n"; |
| 4669 | |
| 4670 | for (G4int i_thGuidance = 0; i_thGuidance < n_guidanceEntry; i_thGuidance++) { |
| 4671 | txt += QString((char*)(aCommand->GetGuidanceLine(i_thGuidance)).data()) + "\n"; |
| 4672 | } |
| 4673 | if (! rangeString.empty()) { |
| 4674 | txt += " Range of parameters : " + QString((char*)(rangeString).data()) + "\n"; |
| 4675 | } |
| 4676 | if (n_parameterEntry > 0) { |
| 4677 | G4UIparameter* param; |
| 4678 | |
| 4679 | // Re-implementation of G4UIparameter.cc |
| 4680 | |
| 4681 | for (G4int i_thParameter = 0; i_thParameter < n_parameterEntry; i_thParameter++) { |
| 4682 | param = aCommand->GetParameter(i_thParameter); |
| 4683 | txt += "\nParameter : " + QString((char*)(param->GetParameterName()).data()) + "\n"; |
| 4684 | if (! param->GetParameterGuidance().empty()) |
| 4685 | txt += QString((char*)(param->GetParameterGuidance()).data()) + "\n"; |
| 4686 | txt += " Parameter type : " + QString(QChar(param->GetParameterType())) + "\n"; |
| 4687 | if (param->IsOmittable()) { |
| 4688 | txt += " Omittable : True\n"; |
| 4689 | } |
| 4690 | else { |
| 4691 | txt += " Omittable : False\n"; |
| 4692 | } |
| 4693 | if (param->GetCurrentAsDefault()) { |
| 4694 | txt += " Default value : taken from the current value\n"; |
| 4695 | } |
| 4696 | else if (! param->GetDefaultValue().empty()) { |
| 4697 | txt += " Default value : " + QString((char*)(param->GetDefaultValue()).data()) + "\n"; |
| 4698 | } |
| 4699 | if (! param->GetParameterRange().empty()) { |
| 4700 | txt += " Parameter range : " + QString((char*)(param->GetParameterRange()).data()) + "\n"; |
| 4701 | } |
| 4702 | if (! param->GetParameterCandidates().empty()) { |
| 4703 | txt += |
| 4704 | " Candidates : " + QString((char*)(param->GetParameterCandidates()).data()) + "\n"; |
| 4705 | } |
| 4706 | } |
nothing calls this directly
no test coverage detected