Build the command list parameters in a QString with HTML 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 */
| 4716 | @return the command list parameters, or "" if nothing |
| 4717 | */ |
| 4718 | void G4UIQt::updateHelpArea(const G4UIcommand* aCommand) |
| 4719 | { |
| 4720 | if (fParameterHelpLabel == nullptr) return; |
| 4721 | if (fParameterHelpTable == nullptr) return; |
| 4722 | |
| 4723 | fParameterHelpLabel->setTextInteractionFlags(Qt::NoTextInteraction); |
| 4724 | QString txt; |
| 4725 | if (aCommand == nullptr) return; |
| 4726 | |
| 4727 | G4String commandPath = aCommand->GetCommandPath(); |
| 4728 | G4String rangeString = aCommand->GetRange(); |
| 4729 | auto n_guidanceEntry = (G4int)aCommand->GetGuidanceEntries(); |
| 4730 | auto n_parameterEntry = (G4int)aCommand->GetParameterEntries(); |
| 4731 | |
| 4732 | if ((commandPath.empty()) && (rangeString.empty()) && (n_guidanceEntry == 0) && |
| 4733 | (n_parameterEntry == 0)) |
| 4734 | { |
| 4735 | return; |
| 4736 | } |
| 4737 | |
| 4738 | if ((commandPath.length() - 1) != '/') { |
| 4739 | txt += "<b>Command </b> " + QString((char*)(commandPath).data()) + "<br />"; |
| 4740 | } |
| 4741 | txt += "<b>Guidance :</b> "; |
| 4742 | QString tmpGuidance = ""; |
| 4743 | for (G4int i_thGuidance = 0; i_thGuidance < n_guidanceEntry; i_thGuidance++) { |
| 4744 | tmpGuidance = QString((char*)(aCommand->GetGuidanceLine(i_thGuidance)).data()); |
| 4745 | tmpGuidance = tmpGuidance.toHtmlEscaped(); |
| 4746 | tmpGuidance.replace("\n", "<br />"); |
| 4747 | txt += tmpGuidance + "<br />"; |
| 4748 | } |
| 4749 | if (! rangeString.empty()) { |
| 4750 | QString range = QString((char*)(rangeString).data()); |
| 4751 | range = range.toHtmlEscaped(); |
| 4752 | txt += "<b>Range of parameters : </b> " + range + "<br />"; |
| 4753 | } |
| 4754 | else { |
| 4755 | txt += "<br />"; |
| 4756 | } |
| 4757 | fParameterHelpLabel->setHtml(txt); |
| 4758 | |
| 4759 | if (n_parameterEntry > 0) { |
| 4760 | G4UIparameter* param; |
| 4761 | |
| 4762 | // Re-implementation of G4UIparameter.cc |
| 4763 | |
| 4764 | fParameterHelpTable->clear(); |
| 4765 | fParameterHelpTable->setRowCount(n_parameterEntry); |
| 4766 | fParameterHelpTable->setColumnCount(8); |
| 4767 | fParameterHelpTable->setHorizontalHeaderLabels( |
| 4768 | QStringList() << tr("") << tr("Parameter") << tr("Guidance") << tr("Type") << tr("Ommitable") |
| 4769 | << tr("Default") << tr("Range") << tr("Candidate")); |
| 4770 | fParameterHelpTable->setColumnWidth(2, 60); |
| 4771 | |
| 4772 | fParameterHelpTable->verticalHeader()->setVisible(false); |
| 4773 | fParameterHelpTable->setAlternatingRowColors(true); |
| 4774 | fParameterHelpTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); |
| 4775 | fParameterHelpTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); |
nothing calls this directly
no test coverage detected