Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -97,9 +97,9 @@ G4UIExecutive::G4UIExecutive(G4int argc, char** argv, const G4String& type)
|
||||
|
||||
// 3rd priority : refer $HOME/.g4session
|
||||
if (selected == kNone) {
|
||||
G4String appinput = argv[0];
|
||||
const G4String& appinput = argv[0];
|
||||
G4String appname = "";
|
||||
size_t islash = appinput.find_last_of("/\\");
|
||||
std::size_t islash = appinput.find_last_of("/\\");
|
||||
if (islash == G4String::npos)
|
||||
appname = appinput;
|
||||
else
|
||||
@@ -224,7 +224,7 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
|
||||
while (fsession.good()) {
|
||||
if (fsession.eof()) break;
|
||||
fsession.getline(linebuf, BUFSIZE);
|
||||
G4String aline = G4StrUtil::strip_copy(linebuf);
|
||||
const G4String& aline = G4StrUtil::strip_copy(linebuf);
|
||||
if (aline[0] == '#') continue;
|
||||
if (aline.empty()) continue;
|
||||
if (iline == 1)
|
||||
@@ -235,7 +235,7 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
|
||||
G4String aname = aline.substr(0, idx);
|
||||
idx = aline.find_first_not_of(' ', idx);
|
||||
if (idx == G4String::npos) break;
|
||||
G4String sname = aline.substr(idx, aline.size() - idx);
|
||||
const G4String& sname = aline.substr(idx, aline.size() - idx);
|
||||
sessionMap[aname] = sname;
|
||||
}
|
||||
iline++;
|
||||
@@ -247,7 +247,7 @@ void G4UIExecutive::SelectSessionByFile(const G4String& appname)
|
||||
if (it != sessionMap.end())
|
||||
stype = sessionMap[appname];
|
||||
else
|
||||
stype = default_session;
|
||||
stype = std::move(default_session);
|
||||
G4StrUtil::to_lower(stype);
|
||||
|
||||
// select session...
|
||||
|
||||
@@ -1687,7 +1687,8 @@ void G4UIQt::SceneTreeItemDoubleClicked(QTreeWidgetItem* item)
|
||||
if (sceneTreeItem->GetType() != G4SceneTreeItem::touchable) return;
|
||||
|
||||
auto oldQColor = ConvertG4ColourToQColor(sceneTreeItem->GetVisAttributes().GetColour());
|
||||
auto newQColor = QColorDialog::getColor(oldQColor, fNewSceneTreeItemTreeWidget, "", QColorDialog::ShowAlphaChannel);
|
||||
auto newQColor = QColorDialog::getColor
|
||||
(oldQColor, fNewSceneTreeItemTreeWidget, "", QColorDialog::ShowAlphaChannel);
|
||||
if (!newQColor.isValid()) return;
|
||||
if (newQColor == oldQColor) return;
|
||||
|
||||
@@ -1698,6 +1699,16 @@ void G4UIQt::SceneTreeItemDoubleClicked(QTreeWidgetItem* item)
|
||||
auto uiMan = G4UImanager::GetUIpointer();
|
||||
uiMan->ApplyCommand("/vis/set/touchable" + sceneTreeItem->GetPVPath());
|
||||
uiMan->ApplyCommand("/vis/touchable/set/colour " + oss.str());
|
||||
|
||||
// Normally the sceneTreeItem will be updated when the scene is processed after the above
|
||||
// commands, but if the user sets the opacity to zero, G4PhysicalVolumeModel does not
|
||||
// transmit it (this is because some users set the opacity to zero to make a volume
|
||||
// invisible - perhaps they should use the visibility flag, but hey-ho).
|
||||
// By design, the sceneTreeItem remains, so it can still be interacted with, but
|
||||
// the colour will not be updated, so we do it here.
|
||||
if (newColour.GetAlpha() == 0.) {
|
||||
sceneTreeItem->AccessVisAttributes().SetColour(newColour);
|
||||
}
|
||||
}
|
||||
|
||||
void G4UIQt::SceneTreeItemExpanded(QTreeWidgetItem* item)
|
||||
@@ -1901,7 +1912,7 @@ void G4UIQt::NewSceneTreeItemTreeWidget::ActWithAnInteger
|
||||
{
|
||||
G4bool ok = true;
|
||||
auto newValue = QInputDialog::getInt(this, action.c_str(), action.c_str(),
|
||||
0, 0, 999, 1, &ok);
|
||||
0, 0, 9999999, 1, &ok);
|
||||
if (ok) {
|
||||
auto uiMan = G4UImanager::GetUIpointer();
|
||||
uiMan->ApplyCommand("/vis/set/touchable" + sceneTreeItem->GetPVPath());
|
||||
@@ -2420,7 +2431,7 @@ G4UIsession* G4UIQt::SessionStart()
|
||||
/** Display the prompt in the prompt area
|
||||
@param aPrompt : string to display as the promt label
|
||||
*/
|
||||
void G4UIQt::Prompt(G4String aPrompt)
|
||||
void G4UIQt::Prompt(const G4String& aPrompt)
|
||||
{
|
||||
if (aPrompt == nullptr) return;
|
||||
|
||||
@@ -2460,7 +2471,7 @@ void G4UIQt::PauseSessionStart(const G4String& aState)
|
||||
Begin the secondary loop
|
||||
@param a_prompt : label to display as the prompt label
|
||||
*/
|
||||
void G4UIQt::SecondaryLoop(G4String aPrompt)
|
||||
void G4UIQt::SecondaryLoop(const G4String& aPrompt)
|
||||
{
|
||||
if (aPrompt == nullptr) return;
|
||||
|
||||
@@ -4078,7 +4089,7 @@ void G4UIQt::UpdateCommandCompleter()
|
||||
fCompleter->popup()->installEventFilter(this);
|
||||
}
|
||||
|
||||
QStandardItemModel* G4UIQt::CreateCompleterModel(G4String aCmd)
|
||||
QStandardItemModel* G4UIQt::CreateCompleterModel(const G4String& aCmd)
|
||||
{
|
||||
QList<QStandardItem*> dirModelList;
|
||||
QList<QStandardItem*> commandModelList;
|
||||
@@ -4529,7 +4540,7 @@ QString G4UIQt::FilterOutput(
|
||||
const G4UIOutputString& output, const QString& currentThread, const QString& filter)
|
||||
{
|
||||
#ifdef G4MULTITHREADED
|
||||
if ((currentThread == "All") || (currentThread == output.fThread)) {
|
||||
if ((currentThread == "All") || (currentThread == output.fThread.data())) {
|
||||
#else
|
||||
if (currentThread == "") {
|
||||
#endif
|
||||
@@ -4795,7 +4806,7 @@ QMultiMap<G4int, QString> G4UIQt::LookForHelpStringInChildTree(
|
||||
}
|
||||
#endif
|
||||
|
||||
QString G4UIQt::GetShortCommandPath(QString commandPath)
|
||||
QString G4UIQt::GetShortCommandPath(QString& commandPath)
|
||||
{
|
||||
if (commandPath.indexOf("/") == 0) {
|
||||
commandPath = commandPath.right(commandPath.size() - 1);
|
||||
@@ -5449,7 +5460,7 @@ G4QTabWidget::G4QTabWidget()
|
||||
{}
|
||||
#endif
|
||||
|
||||
G4UIOutputString::G4UIOutputString(QString text, G4String origine, G4String outputStream)
|
||||
G4UIOutputString::G4UIOutputString(const QString& text, const G4String& origine, const G4String& outputStream)
|
||||
: fText(text), fThread(origine)
|
||||
{
|
||||
if (! GetOutputList().contains(QString(" ") + outputStream + " ")) {
|
||||
@@ -5549,7 +5560,7 @@ void G4QTabWidget::paintEvent(QPaintEvent*)
|
||||
}
|
||||
#endif
|
||||
|
||||
G4UIDockWidget::G4UIDockWidget(QString txt) : QDockWidget(txt) {}
|
||||
G4UIDockWidget::G4UIDockWidget(const QString& txt) : QDockWidget(txt) {}
|
||||
|
||||
void G4UIDockWidget::closeEvent(QCloseEvent* aEvent)
|
||||
{
|
||||
|
||||
@@ -1034,14 +1034,14 @@ G4String G4UIWin32::GetHelpTreeToolTips(HTREEITEM item)
|
||||
|
||||
/****************************************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
G4String G4UIWin32::ConvertNewLines(G4String a_string)
|
||||
G4String G4UIWin32::ConvertNewLines(const G4String& a_string)
|
||||
{
|
||||
// Geant4 uses UNIX's style for new lines (\n)
|
||||
// we must convert them to Windows' style (\r\n)
|
||||
G4String str = std::move(a_string);
|
||||
size_t index = str.find("\n", 0);
|
||||
G4String str = a_string;
|
||||
std::size_t index = str.find("\n", 0);
|
||||
while (index < str.length()) {
|
||||
str.replace(index, 2, "\r\n");
|
||||
str.replace(index, 1, "\r\n");
|
||||
// Advance index forward so the next iteration doesn't pick it up as well.
|
||||
index = str.find("\n", index + 2);
|
||||
}
|
||||
@@ -1306,9 +1306,9 @@ HTREEITEM G4UIWin32::AddItemToHelpTree(LPTSTR lpszItem, HTREEITEM aParent)
|
||||
|
||||
/****************************************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
G4String G4UIWin32::GetShortCommandPath(G4String commandPath)
|
||||
G4String G4UIWin32::GetShortCommandPath(const G4String& commandPath)
|
||||
{
|
||||
G4String str = std::move(commandPath);
|
||||
G4String str = commandPath;
|
||||
|
||||
if (str.find_last_of("/") == (str.size() - 1)) str = str.erase(str.size() - 1, 1);
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ G4UIsession* G4UIXm::SessionStart()
|
||||
return this;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4UIXm::Prompt(G4String aPrompt)
|
||||
void G4UIXm::Prompt(const G4String& aPrompt)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
@@ -204,7 +204,7 @@ void G4UIXm::PauseSessionStart(const G4String& a_state)
|
||||
}
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4UIXm::SecondaryLoop(G4String a_prompt)
|
||||
void G4UIXm::SecondaryLoop(const G4String& a_prompt)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user