43#include <qapplication.h>
44#include <qmessagebox.h>
49#include <qpushbutton.h>
52#include <qscrollbar.h>
56#include <qtextbrowser.h>
57#if QT_VERSION < 0x050600
58#include <qsignalmapper.h>
60#include <qtabwidget.h>
62#include <qstringlist.h>
63#include <qtextstream.h>
65#include <qmainwindow.h>
67#include <qlistwidget.h>
68#include <qtreewidget.h>
69#include <qheaderview.h>
71#include <qscrollarea.h>
73#include <qradiobutton.h>
74#include <qbuttongroup.h>
77#include <qcolordialog.h>
79#include <qfiledialog.h>
80#include <qdesktopwidget.h>
81#include <qtablewidget.h>
82#include <qcompleter.h>
83#include <qstandarditemmodel.h>
84#include <qboxlayout.h>
88#include "moc_G4UIQt.cpp"
92static G4bool exitSession =
true;
93static G4bool exitPause =
true;
122,fCoutTBTextArea(NULL)
127,fHistoryTBTableList(NULL)
128,fHelpTreeWidget(NULL)
130,fHistoryTBWidget(NULL)
131,fCoutDockWidget(NULL)
133,fSceneTreeWidget(NULL)
134,fViewerPropertiesWidget(NULL)
135,fPickInfosWidget(NULL)
137,fViewerTabWidget(NULL)
141,fParameterHelpLabel(NULL)
142,fParameterHelpTable(NULL)
145,fStringSeparator(
"__$$$@%%###__")
158,fHiddenLineRemovalIcon(NULL)
159,fHiddenLineAndSurfaceRemovalIcon(NULL)
160,fPerspectiveIcon(NULL)
166,fPickTargetIcon(NULL)
167#ifdef G4MULTITHREADED
168,fThreadsFilterComboBox(NULL)
170,fDefaultViewerFirstPageHTMLText(
"")
171,fViewerPropertiesDialog(NULL)
172,fPickInfosDialog(NULL)
173,fLastCompleteCommand(
"")
175,fRotateSelected(true)
177,fZoomInSelected(false)
178,fZoomOutSelected(false)
187 G4cout <<
"G4UIQt : Unable to init Qt. Aborted" <<
G4endl;
197 Q_FOREACH (QWidget *widget, QApplication::allWidgets()) {
198 if ((found==
false) && (widget->inherits(
"QMainWindow"))) {
208 G4cout <<
"G4UIQt : Found an external App with a QMainWindow already defined. Aborted" <<
G4endl;
215 for (
const auto& destination: {
"cout",
"cerr",
"warnings",
"errors"}) {
216 G4UIQtStyle defaultStyle;
217 defaultStyle.fixed =
true;
218 defaultStyle.highlight =
true;
219 fOutputStyles[destination] = defaultStyle;
222 fMainWindow =
new QMainWindow();
223 fMainWindow->setAttribute(Qt::WA_DeleteOnClose);
225 fMainWindow->setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
226 fMainWindow->setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
227 fMainWindow->setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
228 fMainWindow->setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );
230 CreateViewerWidget();
231 fMainWindow->addDockWidget(Qt::LeftDockWidgetArea, CreateUITabWidget());
232 fMainWindow->addDockWidget(Qt::BottomDockWidgetArea, CreateCoutTBWidget());
236 SetDefaultIconsToolbar();
240#ifdef G4MULTITHREADED
245 fMainWindow->setWindowTitle(QFileInfo( QCoreApplication::applicationFilePath() ).fileName());
246 fMainWindow->move(QPoint(50,50));
251 fMainWindow->resize(fUIDockWidget->width()+fCoutDockWidget->width()+20,
252 fUIDockWidget->height()+fCoutDockWidget->height()+20);
255 fCommandArea->setFocus(Qt::TabFocusReason);
259 qRegisterMetaType<QTextCursor>(
"QTextCursor");
265 #if QT_VERSION < 0x040200
268 fMainWindow->setVisible(
false);
282#ifdef G4MULTITHREADED
291 fDefaultIcons = aVal;
293#if QT_VERSION < 0x040200
294 if (!fMainWindow->isHidden()) {
296 if (!fMainWindow->isVisible()) {
303#if QT_VERSION < 0x040200
306 fToolbarApp->setVisible(
true);
310#if QT_VERSION < 0x040200
313 fToolbarApp->setVisible(
false);
320void G4UIQt::SetDefaultIconsToolbar(
324 if (fToolbarApp == NULL) {
325 fToolbarApp =
new QToolBar();
326 fToolbarApp->setIconSize (QSize(20,20));
327 fMainWindow->addToolBar(Qt::TopToolBarArea, fToolbarApp);
331 AddIcon(
"Open macro file",
"open",
"/control/execute");
332 AddIcon(
"Save viewer state",
"save",
"/vis/viewer/save");
335#if QT_VERSION < 0x050600
336 QSignalMapper *signalMapperViewerProperties =
new QSignalMapper(
this);
337 QAction *actionViewerProperties = fToolbarApp->addAction(QIcon(*fParamIcon),
"Viewer properties", signalMapperViewerProperties, SLOT(map()));
338 connect(signalMapperViewerProperties, SIGNAL(mapped(
G4int)),
this, SLOT(ViewerPropertiesIconCallback(
G4int)));
340 signalMapperViewerProperties->setMapping(actionViewerProperties, intVP);
342 fToolbarApp->addAction(QIcon(*fParamIcon),
"Viewer properties",
this, [
this](){ this->ViewerPropertiesIconCallback(0); });
348 AddIcon(
"Zoom out",
"zoom_out",
"");
349 AddIcon(
"Zoom in",
"zoom_in",
"");
350 AddIcon(
"Rotate",
"rotate",
"");
353 AddIcon(
"Hidden line removal",
"hidden_line_removal",
"");
354 AddIcon(
"Hidden line and hidden surface removal",
"hidden_line_and_surface_removal",
"");
355 AddIcon(
"Surfaces",
"solid",
"");
356 AddIcon(
"Wireframe",
"wireframe",
"");
359 AddIcon(
"Perspective",
"perspective",
"");
360 AddIcon(
"Orthographic",
"ortho",
"");
361 AddIcon(
"Run beam on",
"runBeamOn",
"/run/beamOn 1");
362 AddIcon(
"Exit Application",
"exit",
"exit");
367void G4UIQt::CreateIcons(
370 const char *
const save[]={
398 " +++++++++++++++++++++++++ ",
399 " +@##+$%%%%%%%%%%%%%%%&*$%&+ ",
400 " +=-;@>,,''',,,,,,,',,)&!,)+ ",
401 " +;-~@>,,,,,,,,,,,,,,,>$!,)+ ",
402 " +=-~@>,,,,,{]]]]]^,,,>*&$&+ ",
403 " +=-~@>,,,,,'{^{^^{,,,>*#=#+ ",
404 " +=-~@>,,,,,,,,,,,,,,,>@~/=+ ",
405 " +=-~@>,,,{{{''''{',,,>@~-=+ ",
406 " +=-~@>,,'^]]]]]]({,,,>@~-=+ ",
407 " +=-~@>,,,{{{{{{{{{,,,>@~-=+ ",
408 " +=-~@>,,,,,'{^{{^{,,,>@~-=+ ",
409 " +=-~@>,,,,,]]]]]]],,,>@~-=+ ",
410 " +=-~*>,,,,,,,,,,,,,,,>@~-=+ ",
411 " +=-~@>,,,,,,,,,,,,,,,>@~-=+ ",
412 " +=-/=$%%%%%%%%%%%%%%%$=/-=+ ",
413 " +=---;###############;---=+ ",
414 " +=---////////////////----=+ ",
415 " +=----------------///----=+ ",
416 " +=---=@##############@#--=+ ",
417 " +=---@+++++++++++*%))_+~-=+ ",
418 " +=---#+++++++++++&:,,>@~-=+ ",
419 " +=---#+++++++++++$',,>@~-=+ ",
420 " +=---#+++++++++++&!,,>@~-=+ ",
421 " +=/--#+++++++++++&',,>@~-=+ ",
422 " @;--#+++++++++++$',,>@~-=+ ",
423 " @;;@+++++++++++*)!>%@=;#+ ",
424 " @++++++++++++++*&**++@++ ",
429 fSaveIcon =
new QPixmap(save);
431 const char *
const search[] = {
443 "OOOOOOOOOOOOOOOOOOO",
444 "OOOOOOOOOOOOOOOOOOO",
445 "OOOOOOOo. .oOOOOOO",
448 "OOOOO. XOOOOX .OOOO",
451 "OOOOO. XOOOOo .OOOO",
455 "OOOOOOOOOOOOO. XOO",
456 "OOOOOOOOOOOOOO. XOO",
457 "OOOOOOOOOOOOOOOoOOO",
458 "OOOOOOOOOOOOOOOOOOO",
459 "OOOOOOOOOOOOOOOOOOO",
460 "OOOOOOOOOOOOOOOOOOO",
461 "OOOOOOOOOOOOOOOOOOO"
463 fSearchIcon =
new QPixmap(search);
465 const char *
const clear[] = {
477 "OOOOOOOOOOOOOOOOOOOO",
480 "OOOOOOOOOOOOOOOOOOOO",
481 "OOOOOOOOOOOOOOOOOOOO",
482 "OOOO XXXXXXXXXX OOOO",
483 "OOO XOOOOOOOOOO OOO",
484 "OOOOXOooOooOooO OOOO",
485 "OOOOXOooOooOooO OOOO",
486 "OOOOXOooOooOooO OOOO",
487 "OOOOXOooOooOooO OOOO",
488 "OOOOXOooOooOooO OOOO",
489 "OOOOXOooOooOooO OOOO",
490 "OOOOXOooOooOooO OOOO",
491 "OOOOXOooOooOooO OOOO",
492 "OOOOXOooOooOooO OOOO",
493 "OOOOXOooOooOooO OOOO",
494 "OOOOXOOOOOOOOOO OOOO",
495 "OOOOOooooooooooOOOOO",
496 "OOOOOO........OOOOOO"
499 fClearIcon =
new QPixmap(clear);
502 const char *
const open[]={
546 " {]^/((_({- %%%%%%%%%%% ",
547 " {(^_^^^^:<{{{{{{{{{{{{{[& ",
548 " {/_/(((((/]]]]]]]]]]]/]!# ",
549 " {/^(((((_^^^^^^^^^^^^^^:# ",
550 " {/^(((_^^____________^^}$ ",
551 " {/^(((((/////////////((!# ",
552 " {/^/^_:<|||||||||||||||@@****1 ",
553 " {/^/^(<[)||||||||||||||))!!}<; ",
554 " {/^_(:|234444444444444444432)1 ",
555 " {/_^/<)34444444444444444443}, ",
556 " {/^(2{:41111111111111111142|5 ",
557 " {3^3<:31111111111111111143}- ",
558 " {/^2<:31111111111111111441|' ",
559 " {_/<:41111111111111111143}, ",
560 " {(4<:31111111111111111144!# ",
561 " )4))44111111111111111144}, ",
562 " )2<:31111111111111111144{# ",
563 " @|:14444444444444444444}* ",
564 " ;@434444444444444444434<# ",
565 " ;[))))))))))))))))))))!~ ",
566 " ++++++++++++++++++++++;% ",
570 fOpenIcon =
new QPixmap(open);
573 const char *
const move[]={
606 " ')&$$$$*@@ @@*$$$$&)' ",
607 " ')&$$$$*@@ @@*$$$$&+' ",
624 fMoveIcon =
new QPixmap(move);
626 const char *
const rotate[]={
662 " --------!*{{{*&, ",
663 " -------=){*{{{>>{) ",
664 " ,!-----= ){& ,&{{@",
672 " !-!!======!!(((---! ",
673 " ='--------------! ",
688 fRotateIcon =
new QPixmap(rotate);
690 const char *
const pick[]={
706 "*********oo*********",
707 "*********oo*********",
708 "******$O. .O%******",
709 "****&o .O..O O*****",
710 "***&X @**oo**@ X****",
711 "***o $***oo***$ O***",
712 "**% @**********@ %**",
713 "**O.***********& +**",
714 "**.O*****@@*****o.**",
715 "oo .oo**@ #*&XX. oo",
716 "oo .oo**@ #*&oo. oO",
717 "**.O*****##*****oX**",
718 "**O ***********& +**",
719 "**% @****&&****+ &**",
720 "***O $***Xo***# +***",
721 "****X @&*Xo*&+ o****",
722 "*****O o..o +*****",
723 "******%+. X+&******",
724 "*********oo*********",
725 "*********oO*********"
727 fPickIcon =
new QPixmap(pick);
729 const char *
const zoom_in[]={
751 " ++.%%%+&&&*%%.++ ",
752 " .+#%%%%+&&&*%%.#+ ",
753 " ++..%%%+&&&*%%%.++ ",
754 " +#.+++++&&&*++++.+ ",
755 " @.+&&&&&&&&&&&&&+@ ",
756 " @#+&&&&&&&&&&&&&+@ ",
757 " @.+&&&&&&&&&&&&&+. ",
758 " +++@***+&&&****@+. ",
759 " ....++++&&&*++++.. ",
760 " ++.===+&&&*%=.++ ",
761 " @..==+&&&*=..@#& ",
762 " .@+#.+&&&@-+@@*@ ",
775 fZoomInIcon =
new QPixmap(zoom_in);
777 const char *
const zoom_out[]={
799 " ++.$$$$$$$$$$.++ ",
800 " .+#$$$$$$$$$$$.#+ ",
801 " ++..$$$$$$$$$$$.++ ",
802 " +#.+++++++++++++.+ ",
803 " @.+&&&&&&&&&&&&&+@ ",
804 " @#+&&&&&&&&&&&&&+@ ",
805 " @.+&&&&&&&&&&&&&+. ",
806 " +++@***********@+. ",
807 " ....++++++++++++.. ",
808 " ++.===$$$$$$=.++ ",
809 " @..===$$$$=..@#& ",
810 " .@+#.$$$..-+@@*@ ",
823 fZoomOutIcon =
new QPixmap(zoom_out);
825 const char *
const wireframe[]={
854 " +&********&@-***; ",
855 " +@@@&**&@@@@@@$ @*-&>&+ ",
856 " +*****&+ %*@ ,**'# ",
857 " @***)!~ @*{&*****+ ",
858 " @*!]***&+ +-*^**'~!*@ ",
859 " @*~ +@&**&@@@@@@&****&+ ~*@ ",
860 " @*@ +&********&-*= @*@ ",
861 " @*@ $%@-*-@$ @*@ @*@ ",
869 " @*@ =*-+ @*@ @*@ ",
870 " @*@ $%@@&****&@-*-+ @*@ ",
871 " @*@ $@&*****&@@&******&~~!*@ ",
872 " @*{/***&@@%$ $@-*-&*****+ ",
873 " @*)*)(-~ @*@ ~)**] ",
874 " +*******&@@@@+ %*_+]**] ",
875 " +@@@@@&******&@%+_*^**]# ",
884 fWireframeIcon =
new QPixmap(wireframe);
886 const char *
const solid[]={
924 " +-;>>>>>>>>>,')!~ ",
925 " {]@@-;>>>>>>>>>>>>^/(_= ",
926 " {:>>>>>>>>>>>>>>>>><//[)!= ",
927 " ]>>>>>>>>>>>>>>>>>><////[)} ",
928 " @>>>>>>>>>>>>>>>>>><//////| ",
929 " @>>>>>>>>>>>>>>>>>><//////| ",
930 " @>>>>>>>>>>>>>>>>>><//////| ",
931 " @>>>>>>>>>>>>>>>>>><//////| ",
932 " @>>>>>>>>>>>>>>>>>><//////| ",
933 " @>>>>>>>>>>>>>>>>>><//////| ",
934 " @>>>>>>>>>>>>>>>>>><//////| ",
935 " @>>>>>>>>>>>>>>>>>><//////| ",
936 " @>>>>>>>>>>>>>>>>>><//////| ",
937 " @>>>>>>>>>>>>>>>>>><//////| ",
938 " @>>>>>>>>>>>>>>>>>><//////| ",
939 " @>>>>>>>>>>>>>>>>>><//////| ",
940 " @>>>>>>>>>>>>>>>>>><//////| ",
941 " @>>>>>>>>>>>>>>>>>><//////| ",
942 " @>>>>>>>>>>>>>>>>>></////[1 ",
943 " @>>>>>>>>>>>>>>>>>><////[*2 ",
944 " {:>>>>>>>>>>>>>>>>><//[)12 ",
945 " +@@@@@-;>>>>>>>>>><[)13 ",
954 fSolidIcon =
new QPixmap(solid);
956 const char *
const hidden_line_removal[]={
976 " +#$$$$$$$$#@&$$$* ",
977 " =-@@#$$#@@@@@-= @$&#;>= ",
978 " =$$$$$#+ -$@ *$$%+ ",
979 " -$&@-= -$- #$$$= ",
995 " -$&@@@-= -$- =>;, ",
996 " =$$$$$$$#@@@-= -$'+#$$, ",
997 " =-@@@@#$$$$$$#@-+'$)$$#+ ",
1006 fHiddenLineRemovalIcon =
new QPixmap(hidden_line_removal);
1008 const char *
const hidden_line_and_surface_removal[]={
1054 " ++@%####&*=-#+;>, ",
1055 " +++++@'=)))))))!)~+{]^++ ",
1056 " +$%&*=)!!!!!!!!!)~+/(]_+++ ",
1057 " +#-))!!!!!!!!!!!)~+/(::<[+ ",
1058 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1059 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1060 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1061 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1062 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1063 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1064 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1065 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1066 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1067 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1068 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1069 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1070 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1071 " +#)!!!!!!!!!!!!!!}+/:::|1+ ",
1072 " +$#}}~23!!!!!!!!)~+/(]45, ",
1073 " +++++++@#}}~23!!)~+678++ ",
1074 " ++++++@#~90+a++ ",
1083 fHiddenLineAndSurfaceRemovalIcon =
new QPixmap(hidden_line_and_surface_removal);
1085 const char *
const perspective[]={
1095 " ................ ",
1096 " ....+++++++++++++++. ",
1097 " ...++++..+.........+++. ",
1098 " ..++..............++..+. ",
1099 " .+++++++++++++++++.. .+. ",
1100 " .+...............+. .+. ",
1101 " .+. .+. .+. .+. ",
1102 " .+. .+. .+. .+. ",
1103 " .+. .+. .+. .+. ",
1104 " .+. .+. .+. .+. ",
1105 " .+. .+. .+. .+. ",
1106 " .+. .+. .+. .+. ",
1107 " .+. .+. .+. .+. ",
1108 " .+. .+. .+. .+. ",
1109 " .+. .+......+....+. ",
1110 " .+. ..++++++.+.++++. ",
1111 " .+. .++.......+...+.. ",
1112 " .+. .++. .+..++. ",
1113 " .+. ..+.. .+..+. ",
1116 " .+++.............++. ",
1117 " .+++++++++++++++++. ",
1118 " ................... ",
1123 fPerspectiveIcon =
new QPixmap(perspective);
1125 const char *
const ortho[]={
1133 " ................... ",
1134 " ..@@@@@@@@@@@@@@@@@. ",
1135 " ..@@@.............@@@. ",
1136 " ..@@.@. ..@..@. ",
1137 " ..@@ ..@. .@@...@. ",
1138 " ..@@..............@@.. .@. ",
1139 " .@@@@@@@@@@@@@@@@@.. .@. ",
1140 " .@...............@. .@. ",
1141 " .@. .@. .@. .@. ",
1142 " .@. .@. .@. .@. ",
1143 " .@. .@. .@. .@. ",
1144 " .@. .@. .@. .@. ",
1145 " .@. .@. .@. .@. ",
1146 " .@. .@. .@. .@. ",
1147 " .@. .@. .@. .@. ",
1148 " .@. .@. .@. .@. ",
1149 " .@. .@. .@. .@. ",
1150 " .@. .@. .@. .@. ",
1151 " .@. .@........@......@. ",
1152 " .@. .@@@@@@@@@.@.@@@@@@. ",
1153 " .@. .@@+........@....@@.. ",
1154 " .@...@. .@...@... ",
1156 " .@@@.............@@@.. ",
1157 " .@@@@@@@@@@@@@@@@@... ",
1158 " ................... ",
1163 fOrthoIcon =
new QPixmap(ortho);
1165 const char *
const commandIcon[]={
1193 "66666666666666666666",
1194 "66%++++++++++++++&56",
1195 "6$ o..o......o..o *6",
1196 "6+o...o*<441;@.o..+6",
1197 "6+..o@1553<354$..o+6",
1198 "6+..o<5<@ .*54#o.+6",
1207 "6+..O25<@ X=54#o.+6",
1208 "6+.o.@1553<354$...@6",
1209 "6+o..oo*<44<;@o..o+6",
1210 "6$ .o..o.....o..o *6",
1211 "66%+++++OOOO+++++*66",
1212 "66666666666666666666"
1214 fCommandIcon =
new QPixmap(commandIcon);
1216 const char *
const dirIcon[]={
1244 "66666666666666666666",
1245 "66$oOOOOOOOOOOOOo%66",
1248 "6o =635533666$ o6",
1249 "6o -65:+ +165X o6",
1258 "6o -65:+ @265X o6",
1259 "6o =635543665# O6",
1262 "66$OOOoo....OOOOo%66",
1263 "66666666666666666666"}
1265 fDirIcon =
new QPixmap(dirIcon);
1268 const char *
const runIcon[]={
1305 "rrrrrrrr%<<2rrrrrrrr",
1306 "rrrrr5=$$$$===rrrrrr",
1307 "rrrr<##$$$$$---&rrrr",
1308 "rrr=###$$$$-----%rrr",
1309 "rr=####$$$$------&rr",
1310 "r2@####7##$-------rr",
1311 "r.@####048$-------Or",
1313 " .@@###w4eee5%$#@@@X",
1314 " .@@@..w4eeeeqo..@@X",
1316 " ..oooOe2eee6OOOooo ",
1317 "rOooOO+e2ew2+++++O+r",
1318 "r:oO+++e30,;;;;;++Or",
1319 "r :++;:9,>,,>>:;;1rr",
1320 "rr*1;:>,333333,>32rr",
1321 "rrr66,1367777637<rrr",
1322 "rrrr509799999905rrrr",
1323 "rrrrr=8wqwwww8-rrrrr",
1324 "rrrrrrrr4444rrrrrrrr"
1326 fRunIcon =
new QPixmap(runIcon);
1328 const char *
const paramIcon[]={
1367 "wwwwwwww5 5wwwwwwww",
1368 "wwwwwwww, ,wwwwwwww",
1369 "www&;ww7+ +9ww=-www",
1375 "5<+ .wwwwwww0. +<5",
1378 "5<+ .wwwwwww0X +<5",
1384 "www*>ww7+ +7ww=:www",
1385 "wwwwwwww1 1wwwwwwww",
1386 "wwwwwwww5 5wwwwwwww"
1388 fParamIcon =
new QPixmap(paramIcon);
1390 const char *
const exitIcon[]={
1456 " rMMMM# jMMM MMMMx ",
1457 " OMMMMk jMMM 8MMMM9 ",
1458 " xMMMM jMMM pMMMM ",
1459 " MMMM jMMM xMMM8 ",
1470 " <MMMMMp: $rMMMMMp ",
1471 " yMMMMMMMMMMMMMMk ",
1478 fExitIcon=
new QPixmap(exitIcon);
1484QWidget* G4UIQt::CreateHistoryTBWidget(
1487 fHistoryTBWidget =
new QWidget();
1489 QVBoxLayout *layoutHistoryTB =
new QVBoxLayout();
1490 fHistoryTBTableList =
new QListWidget();
1491 fHistoryTBTableList->setSelectionMode(QAbstractItemView::SingleSelection);
1492 connect(fHistoryTBTableList, SIGNAL(itemSelectionChanged()), SLOT(CommandHistoryCallback()));
1494 layoutHistoryTB->addWidget(fHistoryTBTableList);
1496 fHistoryTBWidget->setLayout(layoutHistoryTB);
1497 return fHistoryTBWidget;
1503QWidget* G4UIQt::CreateHelpTBWidget(
1506 fHelpTBWidget =
new QWidget();
1508 QWidget *helpWidget =
new QWidget();
1509 QHBoxLayout *helpLayout =
new QHBoxLayout();
1510 QVBoxLayout *vLayout =
new QVBoxLayout();
1511 fHelpVSplitter =
new QSplitter(Qt::Vertical);
1512 fHelpLine =
new QLineEdit();
1513 helpLayout->addWidget(
new QLabel(
"Search :"));
1514 helpLayout->addWidget(fHelpLine);
1515 connect( fHelpLine, SIGNAL( editingFinished () ),
this, SLOT( LookForHelpStringCallback() ) );
1520 fParameterHelpLabel =
new QTextEdit();
1521 fParameterHelpLabel->setReadOnly(
true);
1522 fParameterHelpTable =
new QTableWidget();
1526 if (fHelpTreeWidget) {
1527 fHelpVSplitter->addWidget(fHelpTreeWidget);
1529 fHelpVSplitter->addWidget(fParameterHelpLabel);
1530 fHelpVSplitter->addWidget(fParameterHelpTable);
1532 fParameterHelpLabel->setVisible(
false);
1533 fParameterHelpTable->setVisible(
false);
1534 QSizePolicy policy = QSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
1535 policy.setVerticalStretch(4);
1536 if (fHelpTreeWidget) {
1537 fHelpTreeWidget->setSizePolicy(policy);
1539 policy = QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
1540 policy.setVerticalStretch(1);
1541 fParameterHelpLabel->setSizePolicy(policy);
1542 fParameterHelpTable->setSizePolicy(policy);
1544 vLayout->addWidget(helpWidget);
1545 vLayout->addWidget(fHelpVSplitter,1);
1546 vLayout->setContentsMargins(5,5,5,5);
1548 helpWidget->setLayout(helpLayout);
1549 fHelpTBWidget->setLayout(vLayout);
1551 return fHelpTBWidget;
1560 QWidget* coutTBWidget =
new QWidget();
1562 QVBoxLayout *layoutCoutTB =
new QVBoxLayout();
1564 fCoutTBTextArea =
new QTextEdit();
1566 fCoutFilter =
new QLineEdit();
1567 fCoutFilter->setToolTip(
"Filter output by...");
1569#if QT_VERSION > 0x050100
1570 fCoutFilter->addAction(*fSearchIcon,QLineEdit::TrailingPosition);
1571 fCoutFilter->setStyleSheet (
"border-radius:7px;");
1573 QPushButton *coutTBFilterButton =
new QPushButton();
1574 coutTBFilterButton->setIcon(QIcon(*fSearchIcon));
1575 coutTBFilterButton->setStyleSheet (
"padding-left: 0px; border:0px;");
1576 fCoutFilter->setStyleSheet (
"padding-right: 0px;");
1579 QPushButton *coutTBClearButton =
new QPushButton();
1580 coutTBClearButton->setIcon(*fClearIcon);
1581 coutTBClearButton->setToolTip(
"Clear console output");
1582 coutTBClearButton->setStyleSheet (
"border-radius:7px;");
1583 connect(coutTBClearButton, SIGNAL(clicked()), SLOT(ClearButtonCallback()));
1584 connect(fCoutFilter, SIGNAL(textEdited (
const QString &)), SLOT(CoutFilterCallback(
const QString &)));
1586 QPushButton *coutTBSaveOutputButton =
new QPushButton();
1587 coutTBSaveOutputButton->setIcon(*fSaveIcon);
1588 coutTBSaveOutputButton->setToolTip(
"Save console output");
1589 coutTBSaveOutputButton->setStyleSheet (
"border-radius:7px;");
1590 connect(coutTBSaveOutputButton, SIGNAL(clicked()), SLOT(SaveOutputCallback()));
1592 fCoutTBTextArea->setReadOnly(
true);
1594 QWidget* coutButtonWidget =
new QWidget();
1595 QHBoxLayout* layoutCoutTBButtons =
new QHBoxLayout();
1597#ifdef G4MULTITHREADED
1599 fThreadsFilterComboBox =
new QComboBox();
1600 fThreadsFilterComboBox->setInsertPolicy(QComboBox::InsertAlphabetically);
1601 connect(fThreadsFilterComboBox, SIGNAL(activated(
G4int)),
this, SLOT(ThreadComboBoxCallback(
G4int)));
1603 UpdateCoutThreadFilter();
1605 fThreadsFilterComboBox->setToolTip(
"Thread selection in output");
1606 layoutCoutTBButtons->addWidget(
new QLabel(
" Threads:"));
1607 layoutCoutTBButtons->addWidget(fThreadsFilterComboBox);
1610 layoutCoutTBButtons->addWidget(fCoutFilter);
1611#if QT_VERSION <= 0x050100
1612 layoutCoutTBButtons->addWidget(coutTBFilterButton);
1614 layoutCoutTBButtons->addWidget(coutTBClearButton);
1615 layoutCoutTBButtons->addWidget(coutTBSaveOutputButton);
1616 coutButtonWidget->setLayout(layoutCoutTBButtons);
1619 layoutCoutTBButtons->setContentsMargins(3,3,3,0);
1621 layoutCoutTB->addWidget(coutButtonWidget);
1622 layoutCoutTB->addWidget(fCoutTBTextArea);
1624 coutTBWidget->setLayout(layoutCoutTB);
1626 fCoutTBTextArea->setMinimumSize(100,100);
1629 QWidget* commandLineWidget =
new QWidget();
1630 QHBoxLayout *layoutCommandLine =
new QHBoxLayout();
1634 fCommandLabel =
new QLabel(
"");
1635 fCommandArea =
new QLineEdit();
1639 fCommandArea->activateWindow();
1641 fCommandArea->setFocusPolicy ( Qt::StrongFocus );
1642 fCommandArea->setFocus(Qt::TabFocusReason);
1643 fCommandArea->setToolTip(
"Apply command");
1646 layoutCommandLine->addWidget(fCommandLabel);
1647 layoutCommandLine->addWidget(fCommandArea);
1650 connect(fCommandArea, SIGNAL(returnPressed()), SLOT(CommandEnteredCallback()));
1651 connect(fCommandArea, SIGNAL(textEdited(
const QString &)), SLOT(CommandEditedCallback(
const QString &)));
1654 commandLineWidget->setLayout(layoutCommandLine);
1655 commandLineWidget->setMinimumSize(50,50);
1657 layoutCoutTB->addWidget(commandLineWidget);
1660 fCoutDockWidget->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
1662 fCoutDockWidget->setWidget(coutTBWidget);
1663 return fCoutDockWidget;
1669QWidget* G4UIQt::CreateVisParametersTBWidget(
1681 fUITabWidget =
new QTabWidget();
1684 fUITabWidget->addTab(CreateSceneTreeWidget(),
"Scene tree");
1685 fUITabWidget->addTab(CreateHelpTBWidget(),
"Help");
1686 fUITabWidget->addTab(CreateHistoryTBWidget(),
"History");
1687 fUITabWidget->setCurrentWidget(fHelpTBWidget);
1689 fUITabWidget->setTabToolTip (0,
"Scene component tree. Only available in Stored mode");
1690 fUITabWidget->setTabToolTip (1,
"Help widget");
1691 fUITabWidget->setTabToolTip (2,
"All commands history");
1692 connect(fUITabWidget, SIGNAL(currentChanged(
G4int)), SLOT(ToolBoxActivated(
G4int)));
1694 fUIDockWidget =
new G4UIDockWidget (
"Scene tree, Help, History");
1695 fUIDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
1697 fUIDockWidget->setWidget(fUITabWidget);
1699 return fUIDockWidget;
1703QWidget* G4UIQt::CreateSceneTreeWidget(){
1705 fSceneTreeWidget =
new QWidget();
1706 QVBoxLayout* layout =
new QVBoxLayout();
1707 fSceneTreeWidget->setLayout(layout);
1709#if QT_VERSION < 0x040200
1710 fSceneTreeWidget->hide();
1712 fSceneTreeWidget->setVisible(
false);
1715 return fSceneTreeWidget;
1719void G4UIQt::CreateViewerWidget(){
1723 SetStartPage(std::string(
"<table width='100%'><tr><td width='30%'></td><td><div ")+
1724 "style='color: rgb(140, 31, 31); font-size: xx-large; font-family: Garamond, serif; padding-bottom: 0px; font-weight: normal'>Geant4: "+
1725 QApplication::applicationName ().toStdString()+
1726 "</div></td><td width='40%'> <br/><i>http://cern.ch/geant4/</i></td></tr></table>"+
1728 "<div style='background:#EEEEEE;'><b>Tooltips :</b><ul>"+
1729 "<li><b>Start a new viewer :</b><br />"+
1730 "<i>'/vis/open/...'<br />"+
1731 "For example '/vis/open OGL'</i></li>"+
1732 "<li><b>Execute a macro file :</b><br />"+
1733 "<i>'/control/execute my_macro_file'</i></li>"+
1736 "<div style='background:#EEEEEE;'><b>Documentation :</b><ul>"+
1737 "<li><b>Visualisation publication :</b><br />"+
1738 "<i><a href='http://www.worldscientific.com/doi/abs/10.1142/S1793962313400011'>The Geant4 Visualization System - A Multi-Driver Graphics System</b><br />, Allison, J. et al., International Journal of Modeling, Simulation, and Scientific Computing, Vol. 4, Suppl. 1 (2013) 1340001</a>:<br/> http://www.worldscientific.com/doi/abs/10.1142/S1793962313400011</i></li>"+
1741 "<div style='background:#EEEEEE;'><b>Getting Help :</b><ul>"+
1742 "<li><b>If problems arise, try <a href='https://cern.ch/geant4-forum'>browsing the user forum</a> to see whether or not your problem has already been encountered.<br /> If it hasn't, you can post it and Geant4 developers will do their best to find a solution. This is also a good place to<br /> discuss Geant4 topics in general.</b> https://cern.ch/geant4-forum"+
1743 "<li><b>Get a look at <a href='http://cern.ch/geant4/support'>Geant4 User support pages</a>: <i>http://cern.ch/geant4/support</i></b></li>"+
1749 if (fViewerTabWidget == NULL) {
1751 fMainWindow->setCentralWidget(fViewerTabWidget);
1752#if QT_VERSION < 0x040500
1754 fViewerTabWidget->setTabsClosable (
true);
1757#if QT_VERSION < 0x040200
1759 fViewerTabWidget->setUsesScrollButtons (
true);
1762#if QT_VERSION < 0x040500
1764 connect(fViewerTabWidget, SIGNAL(tabCloseRequested(
G4int)),
this, SLOT(TabCloseCallback(
int)));
1766 connect(fViewerTabWidget, SIGNAL(currentChanged(
G4int)), SLOT(UpdateTabWidget(
G4int)));
1770 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
1771 policy.setVerticalStretch(4);
1772 fViewerTabWidget->setSizePolicy(policy);
1774 fViewerTabWidget->setMinimumSize(40,40);
1783 return fSceneTreeWidget;
1791 if (!fViewerPropertiesDialog) {
1792 CreateViewerPropertiesDialog();
1794 return fViewerPropertiesWidget;
1802 if (!fPickInfosDialog) {
1803 CreatePickInfosDialog();
1805 return fPickInfosWidget;
1816 if (fViewerTabWidget == NULL) {
1819 fViewerTabWidget->addTab(aWidget,title.c_str());
1828 std::string fileName
1832 if (fViewerTabWidget == NULL) {
1837 if(UI==NULL)
return 0;
1838 std::ifstream file(UI->
FindMacroPath(fileName.c_str()).data());
1841 std::string content( (std::istreambuf_iterator<char>(file) ),
1842 (std::istreambuf_iterator<char>() ) );
1844 QTextEdit* text =
new QTextEdit();
1845 text->setAcceptRichText (
true);
1846 text->setContentsMargins(5,5,5,5);
1847 text->setText(QString(
"<pre>")+content.c_str()+
"</pre>");
1848 text->setReadOnly(
true);
1849 fViewerTabWidget->addTab(text,title.c_str());
1871 #if QT_VERSION < 0x050100
1872 #if QT_VERSION >= 0x050000
1873 QString message = QString(
1874 "This Qt version [")+qVersion ()+
"] has some issues with the OpenGL viewer.\n"+
1875 "To prevent problems, you are not allowed to open a Stored nor Immediate viewer.\n" +
1877 "Please upgrade to Qt version >= 5.1\n";
1879 QMessageBox::warning(fMainWindow, tr(
"Warning"),
1880 tr(message.toStdString().c_str()),
1887 if (fViewerTabWidget == NULL) {
1888 CreateViewerWidget();
1895 aWidget->setParent(fViewerTabWidget);
1898 fViewerTabWidget->addTab(aWidget,name);
1900 fViewerTabWidget->setCurrentIndex(fViewerTabWidget->count()-1);
1903 #if QT_VERSION < 0x040200
1918const std::string& text)
1921 fDefaultViewerFirstPageHTMLText = text;
1924 fStartPage =
new QTextBrowser();
1925 fStartPage->setContentsMargins(5,5,5,5);
1926 fStartPage->setReadOnly(
true);
1928 fStartPage->setOpenExternalLinks(
true);
1929 fStartPage->setHtml(fDefaultViewerFirstPageHTMLText.c_str());
1933void G4UIQt::UpdateTabWidget(
G4int tabNumber) {
1934 if ( fViewerTabWidget == NULL) {
1938 fViewerTabWidget->setCurrentIndex(tabNumber);
1943 #if QT_VERSION < 0x040200
1944 fViewerTabWidget->show();
1946 fViewerTabWidget->setVisible(
true);
1956void G4UIQt::ResizeTabWidget( QResizeEvent* e) {
1957 if ( fViewerTabWidget) {
1958 for (
G4int a=0;a<fViewerTabWidget->count() ;a++) {
1959 fViewerTabWidget->widget(a)->resize(e->size());
1972 exitSession =
false;
1974 QCoreApplication::sendPostedEvents () ;
1976 #if QT_VERSION < 0x040200
1977 fMainWindow->show();
1979 fMainWindow->setVisible(
true);
1982 if (fDefaultIcons) {
1983#if QT_VERSION < 0x040200
1984 fToolbarApp->show();
1986 fToolbarApp->setVisible(
true);
1990#if QT_VERSION < 0x040200
1991 fToolbarApp->hide();
1993 fToolbarApp->setVisible(
false);
2000 UpdateCommandCompleter();
2003 fHistoryTBTableList->installEventFilter(
this);
2004 fCommandArea->installEventFilter(
this);
2007 fCommandArea->setFocus();
2025 if (!aPrompt)
return;
2027 fCommandLabel->setText((
char*)aPrompt.data());
2036 fMainWindow->close();
2054 if (!aState)
return;
2056 if(aState==
"G4_pause> ") {
2057 SecondaryLoop (
"Pause, type continue to exit this state");
2060 if(aState==
"EndOfEvent") {
2062 SecondaryLoop (
"End of event, type continue to exit this state");
2072void G4UIQt::SecondaryLoop (
2076 if (!aPrompt)
return;
2082 ((QApplication*)interactorManager)->processEvents(QEventLoop::WaitForMoreEvents);
2083 if(exitPause==
true)
break;
2088#ifdef G4MULTITHREADED
2106 if(aString.empty())
return 0;
2108#ifdef G4MULTITHREADED
2120#ifdef G4MULTITHREADED
2123 std::cout << aString;
2134 for (
G4int i = 0; i < (
G4int)aString.length() - 1; ++i) {
2135 if (aString[i] ==
'\n') {
2136 aStringWithStyle +=
"<br>";
2137 }
else if (aString[i] ==
' ') {
2138 aStringWithStyle +=
" ";
2139 }
else if (aString[i] ==
'\t') {
2140 aStringWithStyle +=
" ";
2141 }
else if (aString[i] ==
'<') {
2142 aStringWithStyle +=
"<";
2144 aStringWithStyle += aString[i];
2147 if (fOutputStyles[
"cout"].fixed) {
2148 aStringWithStyle =
"<span style='font-family:courier;'>" + aStringWithStyle +
"</span>";
2150 aStringWithStyle =
"<span>" + aStringWithStyle +
"</span>";
2155 fG4OutputString.push_back(txt);
2157#ifdef G4MULTITHREADED
2158 QString result = FilterOutput(txt,fThreadsFilterComboBox->currentText(),fCoutFilter->text());
2160 QString result = FilterOutput(txt,
"",fCoutFilter->text());
2163 if (result.isEmpty()) {
2168 if (fOutputStyles[
"cout"].highlight) {
2171 result = QString(
"<span style='background:") + pal.link().color().name() +
";'> </span>"
2172 +
"<span style='background:" + pal.highlight().color().name() +
";'> " + result +
"</span>";
2177 fCoutTBTextArea->append(result);
2178 fCoutTBTextArea->ensureCursorVisible ();
2180#ifdef G4MULTITHREADED
2181 UpdateCoutThreadFilter();
2185 fLastErrMessage = aString;
2199 if (aString.empty())
return 0;
2201#ifdef G4MULTITHREADED
2207#ifdef G4MULTITHREADED
2210 std::cerr << aString;
2221 for (
G4int i = 0; i < (
G4int)aString.length() - 1; ++i) {
2222 if (aString[i] ==
'\n') {
2223 aStringWithStyle +=
"<br>";
2224 }
else if (aString[i] ==
' ') {
2225 aStringWithStyle +=
" ";
2226 }
else if (aString[i] ==
'\t') {
2227 aStringWithStyle +=
" ";
2228 }
else if (aString[i] ==
'<') {
2229 aStringWithStyle +=
"<";
2231 aStringWithStyle += aString[i];
2234 if (fOutputStyles[
"cerr"].fixed) {
2235 aStringWithStyle =
"<span style='font-family:courier;'>" + aStringWithStyle +
"</span>";
2237 aStringWithStyle =
"<span>" + aStringWithStyle +
"</span>";
2245 fG4OutputString.push_back(txt);
2247#ifdef G4MULTITHREADED
2248 QString result = FilterOutput(txt,fThreadsFilterComboBox->currentText(),fCoutFilter->text());
2250 QString result = FilterOutput(txt,
"",fCoutFilter->text());
2252 if (result.isEmpty()) {
2257 if (QString(aString.data()).trimmed() !=
"") {
2261 fLastErrMessage +=
"\n"+aString;
2262 QString criticalMessage = fLastErrMessage.data();
2263#if QT_VERSION < 0x050000
2264 criticalMessage = Qt::escape(criticalMessage);
2266 criticalMessage = criticalMessage.toHtmlEscaped();
2268 QMessageBox::critical(fMainWindow,
"Error",QString(fLastErrMessage));
2271 fCoutTBTextArea->append(QString(
"<font color=\"Red\">") +
2272 result + QString(
"</font>"));
2273 fCoutTBTextArea->ensureCursorVisible ();
2275 if (QString(aString.data()).trimmed() !=
"") {
2276 fLastErrMessage += aString;
2278#ifdef G4MULTITHREADED
2279 UpdateCoutThreadFilter();
2285G4String G4UIQt::GetThreadPrefix() {
2287#ifdef G4MULTITHREADED
2289 if(UI==NULL)
return "";
2297 return threadPrefix;
2301#ifdef G4MULTITHREADED
2302void G4UIQt::UpdateCoutThreadFilter() {
2304 if(UI==NULL)
return;
2307 if (fThreadsFilterComboBox->count() < 2) {
2308 if ( fThreadsFilterComboBox->findText(
"All", Qt::MatchExactly) == -1) {
2309 fThreadsFilterComboBox->addItem(
"All");
2312 if (fThreadsFilterComboBox->count() < 2) {
2313 if ( fThreadsFilterComboBox->findText(
"Master", Qt::MatchExactly) == -1) {
2314 fThreadsFilterComboBox->addItem(
"Master");
2320 if ( fThreadsFilterComboBox->findText(
prefix.data(), Qt::MatchExactly) == -1) {
2321 fThreadsFilterComboBox->addItem(
prefix.data());
2338 if (aName == NULL)
return;
2339 if (aLabel == NULL)
return;
2341 QMenu *fileMenu =
new QMenu(aLabel);
2342 fMainWindow->menuBar()->addMenu(fileMenu);
2357,
const char* aCommand
2360 if(aMenu==NULL)
return;
2361 if(aLabel==NULL)
return;
2362 if(aCommand==NULL)
return;
2366 if(parentTmp==NULL) {
2371 G4cout <<
"Menu name " << aMenu<<
" does not exist, please define it before using it."<<
G4endl;
2378 if(UI==NULL)
return;
2382 std::size_t cmdEndPos = cmd.find_first_of(
" \t");
2383 if(cmdEndPos!=std::string::npos) {
2384 cmd.erase(cmdEndPos);
2387 if(treeTop->
FindPath(cmd) == NULL) {
2389 cmd.substr(0,3) !=
"ls " &&
2392 cmd.substr(0,3) !=
"cd " &&
2394 cmd.substr(0,5) !=
"help " &&
2406 G4cout <<
"Warning: command '"<< cmd <<
"' does not exist, please define it before using it."<<
G4endl;
2411#if QT_VERSION < 0x050600
2412 QSignalMapper *signalMapper =
new QSignalMapper(
this);
2413 QAction *action = parentTmp->addAction(aLabel, signalMapper, SLOT(map()));
2415 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ButtonCallback(
const QString&)));
2416 signalMapper->setMapping(action, QString(aCommand));
2418 QString cmd_tmp = QString(aCommand);
2419 parentTmp->addAction(aLabel,
this, [
this, cmd_tmp](){ this->ButtonCallback(cmd_tmp); });
2429void G4UIQt::AddIcon(
const char* aLabel,
const char* aIconFile,
const char* aCommand,
const char* aFileName){
2430 if(aLabel==NULL)
return;
2432 if (aCommand==NULL) {
2433 if (std::string(aIconFile) ==
"user_icon") {
2438 G4bool userToolBar =
false;
2440 if (!fDefaultIcons) {
2443 if (std::string(aIconFile) ==
"user_icon") {
2446 pix =
new QPixmap(UImanager->
FindMacroPath(aFileName).data());
2447 if (pix->isNull()) {
2451 G4cout <<
"Warning: file '"<< aFileName <<
"' is incorrect or does not exist, this command will not be build"<<
G4endl;
2455 }
else if (std::string(aIconFile) ==
"open") {
2457 }
else if (std::string(aIconFile) ==
"save") {
2459 }
else if (std::string(aIconFile) ==
"move") {
2461 }
else if (std::string(aIconFile) ==
"rotate") {
2463 }
else if (std::string(aIconFile) ==
"pick") {
2465 }
else if (std::string(aIconFile) ==
"zoom_in") {
2467 }
else if (std::string(aIconFile) ==
"zoom_out") {
2469 }
else if (std::string(aIconFile) ==
"wireframe") {
2470 pix = fWireframeIcon;
2471 }
else if (std::string(aIconFile) ==
"solid") {
2473 }
else if (std::string(aIconFile) ==
"hidden_line_removal") {
2474 pix = fHiddenLineRemovalIcon;
2475 }
else if (std::string(aIconFile) ==
"hidden_line_and_surface_removal") {
2476 pix = fHiddenLineAndSurfaceRemovalIcon;
2477 }
else if (std::string(aIconFile) ==
"perspective") {
2478 pix = fPerspectiveIcon;
2479 }
else if (std::string(aIconFile) ==
"ortho") {
2481 }
else if (std::string(aIconFile) ==
"runBeamOn") {
2483 }
else if (std::string(aIconFile) ==
"exit") {
2490 G4cout <<
"Parameter"<< aIconFile <<
" not defined"<<
G4endl;
2494 QToolBar *currentToolbar = NULL;
2496 if (fToolbarUser == NULL) {
2497 fToolbarUser =
new QToolBar();
2498 fToolbarUser->setIconSize (QSize(20,20));
2499 fMainWindow->addToolBar(Qt::TopToolBarArea, fToolbarUser);
2501 currentToolbar = fToolbarUser;
2503 if (fToolbarApp == NULL) {
2504 fToolbarApp =
new QToolBar();
2505 fToolbarApp->setIconSize (QSize(20,20));
2506 fMainWindow->addToolBar(Qt::TopToolBarArea, fToolbarApp);
2508 currentToolbar = fToolbarApp;
2513 QList<QAction*> list = currentToolbar->actions();
2515 for (
G4int i = 0; i < list.size(); ++i) {
2516 if (list.at(i)->text() == QString(aLabel)) {
2518 if(UI==NULL)
return;
2521 G4cout <<
"Warning: A toolBar icon \""<< aLabel<<
"\" already exists with the same name!" <<
G4endl;
2526#if QT_VERSION < 0x050600
2527 QSignalMapper *signalMapper =
new QSignalMapper(
this);
2528 QAction *action = currentToolbar->addAction(QIcon(*pix),aLabel, signalMapper, SLOT(map()));
2531 if (std::string(aIconFile) ==
"open") {
2532 QString txt = aCommand + fStringSeparator + aLabel;
2533#if QT_VERSION < 0x050600
2534 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(OpenIconCallback(
const QString &)));
2535 signalMapper->setMapping(action, QString(txt));
2537 currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->OpenIconCallback(txt); });
2541 }
else if (std::string(aIconFile) ==
"save") {
2542 QString txt = aCommand + fStringSeparator + aLabel;
2543#if QT_VERSION < 0x050600
2544 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(SaveIconCallback(
const QString&)));
2545 signalMapper->setMapping(action, QString(txt));
2547 currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->SaveIconCallback(txt); });
2551 }
else if ((std::string(aIconFile) ==
"move") ||
2552 (std::string(aIconFile) ==
"rotate") ||
2553 (std::string(aIconFile) ==
"pick") ||
2554 (std::string(aIconFile) ==
"zoom_out") ||
2555 (std::string(aIconFile) ==
"zoom_in")) {
2556#if QT_VERSION < 0x050600
2557 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ChangeCursorAction(
const QString&)));
2558 signalMapper->setMapping(action, QString(aIconFile));
2560 QString txt = QString(aIconFile);
2561 QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->ChangeCursorAction(txt); });
2563 action->setCheckable(
TRUE);
2564 action->setChecked(
TRUE);
2565 action->setData(aIconFile);
2567 if (std::string(aIconFile) ==
"move") {
2570 if (std::string(aIconFile) ==
"rotate") {
2573 if (std::string(aIconFile) ==
"pick") {
2576 if (std::string(aIconFile) ==
"zoom_in") {
2579 if (std::string(aIconFile) ==
"zoom_out") {
2584 }
else if ((std::string(aIconFile) ==
"hidden_line_removal") ||
2585 (std::string(aIconFile) ==
"hidden_line_and_surface_removal") ||
2586 (std::string(aIconFile) ==
"solid") ||
2587 (std::string(aIconFile) ==
"wireframe")) {
2588#if QT_VERSION < 0x050600
2589 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ChangeSurfaceStyle(
const QString&)));
2590 signalMapper->setMapping(action, QString(aIconFile));
2592 QString txt = QString(aIconFile);
2593 QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->ChangeSurfaceStyle(txt); });
2595 action->setCheckable(
TRUE);
2596 action->setChecked(
TRUE);
2597 action->setData(aIconFile);
2599 if (std::string(aIconFile) ==
"hidden_line_removal") {
2602 if (std::string(aIconFile) ==
"hidden_line_and_surface_removal") {
2605 if (std::string(aIconFile) ==
"solid") {
2608 if (std::string(aIconFile) ==
"wireframe") {
2613 }
else if ((std::string(aIconFile) ==
"perspective") ||
2614 (std::string(aIconFile) ==
"ortho")) {
2615#if QT_VERSION < 0x050600
2616 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ChangePerspectiveOrtho(
const QString&)));
2617 signalMapper->setMapping(action, QString(aIconFile));
2619 QString txt = QString(aIconFile);
2620 QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->ChangePerspectiveOrtho(txt); });
2622 action->setCheckable(
TRUE);
2623 action->setChecked(
TRUE);
2624 action->setData(aIconFile);
2626 if (std::string(aIconFile) ==
"perspective") {
2629 if (std::string(aIconFile) ==
"ortho") {
2637 if(UI==NULL)
return;
2639 if (aCommand != NULL) {
2640 std::string str = aCommand;
2641 std::string::size_type pos = str.find(
" ");
2642 if (pos != std::string::npos)
2644 str = str.substr(0,pos).c_str();
2646 if(treeTop->
FindPath(str.c_str()) == NULL) {
2651 G4cout <<
"Warning: command '"<< aCommand <<
"' does not exist, please define it before using it."<<
G4endl;
2656#if QT_VERSION < 0x050600
2657 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ButtonCallback(
const QString&)));
2658 signalMapper->setMapping(action, QString(aCommand));
2660 QString txt = QString(aCommand);
2661 currentToolbar->addAction(QIcon(*pix), aCommand,
this, [
this, txt](){ this->ButtonCallback(txt); });
2673 G4String uiQtDestination(destination);
2674 G4UIQtStyle uiQtStyle;
2675 if (
G4String(style) ==
"fixed") uiQtStyle.fixed =
true;
else uiQtStyle.fixed =
false;
2676 if (
G4String(highlight) ==
"highlight") uiQtStyle.highlight =
true;
else uiQtStyle.highlight =
false;
2677 if (uiQtDestination ==
"all") {
2678 for (
auto& i: fOutputStyles) {
2679 i.second = uiQtStyle;
2682 fOutputStyles[uiQtDestination] = uiQtStyle;
2688 if ( fMainWindow->menuBar()->isNativeMenuBar() == aVal )
2692 fMainWindow->menuBar()->setNativeMenuBar(aVal);
2697 fMainWindow->menuBar()->clear();
2700void G4UIQt::ActivateCommand(
2704 if (!fHelpTreeWidget) {
2708 std::size_t i = newCommand.find(
" ");
2710 if( i != std::string::npos )
2712 G4String newValue = newCommand.substr(i+1,newCommand.length()-(i+1));
2716 if (targetCom !=
"") {
2717 OpenHelpTreeOnCommand(targetCom.data());
2720 fUITabWidget->setCurrentWidget(fHelpTBWidget);
2731void G4UIQt::InitHelpTreeAndVisParametersWidget()
2734 if (! fHelpTreeWidget ) {
2735 fHelpTreeWidget =
new QTreeWidget();
2739 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
2741 labels << QString(
"Command");
2742 fHelpTreeWidget->setHeaderLabels(labels);
2745 connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),
this, SLOT(HelpTreeClicCallback()));
2746 connect(fHelpTreeWidget, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,
int)),
this, SLOT(HelpTreeDoubleClicCallback()));
2755void G4UIQt::FillHelpTree()
2757 if (! fHelpTreeWidget ) {
2758 InitHelpTreeAndVisParametersWidget();
2761 QString searchText = fHelpLine->text();
2763 if (searchText ==
"") {
2770 if (fParameterHelpLabel) {
2771 fParameterHelpLabel->setText(
"Choose a command in the command tree");
2772 fParameterHelpTable->setVisible(
false);
2776#if QT_VERSION < 0x040200
2779 fHelpLine->setText(
"");
2784 if(UI==NULL)
return;
2788 QTreeWidgetItem * newItem = NULL;
2789 QString commandText =
"";
2790 for (
G4int a=0;a<treeSize;++a) {
2794 commandText = QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()).trimmed();
2797 for (
G4int b=0;b<fHelpTreeWidget->topLevelItemCount();++b) {
2799 newItem = FindTreeItem(fHelpTreeWidget->topLevelItem(b),commandText);
2802 if (newItem == NULL) {
2804 newItem =
new QTreeWidgetItem();
2805 newItem->setText(0,GetShortCommandPath(commandText));
2806 fHelpTreeWidget->addTopLevelItem(newItem);
2810 CreateHelpTree(newItem,treeTop->
GetTree(a+1));
2821void G4UIQt::CreateHelpTree(
2822 QTreeWidgetItem *aParent
2826 if (aParent == NULL)
return;
2827 if (aCommandTree == NULL)
return;
2831 QTreeWidgetItem * newItem;
2833 QString commandText =
"";
2837 commandText = QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()).trimmed();
2840 newItem = FindTreeItem(aParent,commandText);
2841 if (newItem == NULL) {
2842 newItem =
new QTreeWidgetItem();
2843 newItem->setText(0,GetShortCommandPath(commandText));
2844 aParent->addChild(newItem);
2846 CreateHelpTree(newItem,aCommandTree->
GetTree(a+1));
2853 QStringList stringList;
2857 newItem = FindTreeItem(aParent,commandText);
2858 if (newItem == NULL) {
2859 newItem =
new QTreeWidgetItem();
2860 newItem->setText(0,GetShortCommandPath(commandText));
2861 aParent->addChild(newItem);
2863#if QT_VERSION < 0x040202
2864 fHelpTreeWidget->setItemExpanded(newItem,
false);
2866 newItem->setExpanded(
false);
2880G4bool G4UIQt::CreateVisCommandGroupAndToolBox(
2887 QString commandText = QString((
char*)(aCommand->
GetCommandPath().data())).section(
"/",-aDepthLevel);
2889 if (commandText == NULL) {
2895 QWidget* newParentWidget = NULL;
2897 QString commandSection = commandText.left(commandText.indexOf(
"/"));
2899 if (aDepthLevel == 1) {
2900 QToolBox* currentParent =
dynamic_cast<QToolBox*
>(aParent);
2901 if (currentParent != 0){
2904 for (
G4int a=0; a<currentParent->count(); ++a) {
2905 if (currentParent->itemText(a) == commandSection) {
2907 newParentWidget = currentParent->widget(a);
2913 newParentWidget =
new QGroupBox();
2914 newParentWidget->setLayout(
new QVBoxLayout());
2915 if (currentParent != 0){
2916 currentParent->addItem(newParentWidget,commandSection);
2918 if (!aParent->layout()) {
2919 aParent->setLayout(
new QVBoxLayout());
2921 aParent->layout()->addWidget(newParentWidget);
2924 if (commandText.indexOf(
"/") == -1) {
2929 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
2930 guidance += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
2932 newParentWidget->setToolTip(guidance);
2935 QScrollArea* sc =
dynamic_cast<QScrollArea*
>(newParentWidget->parent()->parent());
2937 sc->ensureWidgetVisible(newParentWidget);
2944 QGroupBox* currentParent =
dynamic_cast<QGroupBox*
>(aParent);
2945 if (currentParent != 0){
2949 if (aDepthLevel == 2){
2950 QToolBox* parentToolBox =
dynamic_cast<QToolBox*
>(currentParent->parent()->parent()->parent());
2951 if (parentToolBox != 0) {
2955 for (
G4int a=0; a<aParent->layout()->count(); ++a) {
2956 QGroupBox* gb =
dynamic_cast<QGroupBox*
>(aParent->layout()->itemAt(a)->widget());
2958 if (gb->title() == commandSection) {
2960 newParentWidget = gb;
2968 newParentWidget =
new QGroupBox();
2969 newParentWidget->setLayout(
new QVBoxLayout());
2970 if (!aParent->layout()) {
2971 aParent->setLayout(
new QVBoxLayout());
2973 aParent->layout()->addWidget(newParentWidget);
2979 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
2980 guidance += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
2982 newParentWidget->setToolTip(guidance);
2987 if (commandText.indexOf(
"/") == -1) {
2988 if (CreateCommandWidget(aCommand, newParentWidget,isDialog)) {
2992 CreateVisCommandGroupAndToolBox(aCommand,newParentWidget, aDepthLevel-1,isDialog);
3007 if (aCommand == NULL) {
3014 if( n_parameterEntry > 0 ) {
3018 QWidget* paramWidget =
new QWidget();
3019 QGridLayout* gridLayout =
new QGridLayout();
3020 paramWidget->setLayout(gridLayout);
3023 unsigned int nbColorParameter = 0;
3024 G4bool isStillColorParameter =
false;
3025 G4bool isColorDialogAdded =
false;
3026 QLabel* redLabel = NULL;
3027 QLabel* greenLabel = NULL;
3028 QString redDefaultStr =
"";
3029 QString greenDefaultStr =
"";
3030 QString blueDefaultStr =
"";
3031 QWidget* redInput = NULL;
3032 QWidget* greenInput = NULL;
3034 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3037 QLabel* label =
new QLabel(QString((
char*)(param->
GetParameterName()).data()));
3039 if ((label->text() ==
"red") || (label->text() ==
"red_or_string")){
3040 nbColorParameter ++;
3041 isStillColorParameter =
true;
3042 }
else if ((label->text() ==
"green") && isStillColorParameter) {
3043 nbColorParameter ++;
3044 }
else if ((label->text() ==
"blue") && isStillColorParameter) {
3045 nbColorParameter ++;
3046 }
else if (!isColorDialogAdded) {
3049 if (nbColorParameter == 1) {
3050 gridLayout->addWidget(redLabel,i_thParameter-1,0);
3051 gridLayout->addWidget(redInput,i_thParameter-1,1);
3052 }
else if (nbColorParameter == 2) {
3053 gridLayout->addWidget(redLabel,i_thParameter-2,0);
3054 gridLayout->addWidget(redInput,i_thParameter-2,1);
3055 gridLayout->addWidget(greenLabel,i_thParameter-1,0);
3056 gridLayout->addWidget(greenInput,i_thParameter-1,1);
3058 nbColorParameter = 0;
3061 QWidget* input = NULL;
3063 input =
new QLineEdit();
3065 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
3067 if (((label->text() ==
"red") || (label->text() ==
"red_or_string")) && isStillColorParameter) {
3069 }
else if ((label->text() ==
"green") && isStillColorParameter) {
3071 }
else if ((label->text() ==
"green") && isStillColorParameter) {
3076 input =
new QWidget();
3077 QHBoxLayout* layout =
new QHBoxLayout();
3078 input->setLayout(layout);
3080 QButtonGroup* buttons =
new QButtonGroup();
3081 QRadioButton* radioOff =
new QRadioButton(
"0");
3082 QRadioButton* radioOn =
new QRadioButton(
"1");
3083 buttons->addButton(radioOn);
3084 buttons->addButton(radioOff);
3085 layout->addWidget(radioOn);
3086 layout->addWidget(radioOff);
3089 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
3090 if (defaultValue ==
"0") {
3091 radioOff->setChecked(
true);
3092 }
else if (defaultValue ==
"1") {
3093 radioOn->setChecked(
true);
3096 input =
new QComboBox();
3098 QStringList list = candidates.split (
" ");
3101 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
3102 for (
int a=0; a<list.size(); a++) {
3103 dynamic_cast<QComboBox*
>(input)->addItem(list.at(a));
3104 if (list.at(a) == defaultValue) {
3105 dynamic_cast<QComboBox*
>(input)->setCurrentIndex(a);
3110 input =
new QLineEdit();
3112 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
3115 input =
new QWidget();
3116 QHBoxLayout* layout =
new QHBoxLayout();
3117 input->setLayout(layout);
3119 QButtonGroup* buttons =
new QButtonGroup();
3120 QRadioButton* radioOff =
new QRadioButton(
"off");
3121 QRadioButton* radioOn =
new QRadioButton(
"on");
3122 buttons->addButton(radioOn);
3123 buttons->addButton(radioOff);
3124 layout->addWidget(radioOn);
3125 layout->addWidget(radioOff);
3128 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
3129 if (defaultValue ==
"off") {
3130 radioOff->setChecked(
true);
3131 }
else if (defaultValue ==
"on") {
3132 radioOn->setChecked(
true);
3136 input =
new QLineEdit();
3137 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
3140 txt +=
"\nParameter : " + QString((
char*)(param->
GetParameterName()).data()) +
"\n";
3144 txt +=
" Parameter type : " + QString(QChar(param->
GetParameterType())) +
"\n";
3146 txt +=
" Omittable : True\n";
3148 txt +=
" Omittable : False\n";
3151 txt +=
" Default value : taken from the current value\n";
3153 txt +=
" Default value : " + QString((
char*)(param->
GetDefaultValue()).data())+
"\n";
3156 txt +=
" Parameter range : " + QString((
char*)(param->
GetParameterRange()).data())+
"\n";
3162 if (isStillColorParameter && (nbColorParameter != 0)) {
3163 if ((label->text() ==
"red") || (label->text() ==
"red_or_string")) {
3166 }
else if (label->text() ==
"green") {
3169 }
else if (label->text() ==
"blue") {
3175 if ((redDefaultStr !=
"") && (redDefaultStr !=
"") && (redDefaultStr !=
"")) {
3176 qc.setRgbF(redDefaultStr.toDouble(),
3177 greenDefaultStr.toDouble(),
3178 blueDefaultStr.toDouble());
3180 QPixmap pixmap = QPixmap(QSize(16, 16));
3182 QPainter painter(&pixmap);
3183 painter.setPen(Qt::black);
3184 painter.drawRect(0,0,15,15);
3186 input =
new QPushButton(
"Change color");
3187 dynamic_cast<QPushButton*
>(input)->setIcon(pixmap);
3188 dynamic_cast<QPushButton*
>(input)->setAccessibleName(redDefaultStr+
" "+greenDefaultStr+
" "+blueDefaultStr);
3189 label =
new QLabel(
"Choose color");
3193 gridLayout->addWidget(label,i_thParameter-nbColorParameter,0);
3194 input->setToolTip(
"Select the current color");
3195 gridLayout->addWidget(input,i_thParameter-nbColorParameter,1);
3198#if QT_VERSION < 0x050600
3199 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3200 signalMapper->setMapping(input,input);
3201 connect(input, SIGNAL(clicked()), signalMapper, SLOT(map()));
3202 connect(signalMapper, SIGNAL(mapped(QWidget*)),
this, SLOT(ChangeColorCallback(QWidget*)));
3204 connect(
dynamic_cast<QPushButton*
>(input), &QPushButton::clicked , [
this, input](){ this->ChangeColorCallback(input);});
3206 isColorDialogAdded =
true;
3207 isStillColorParameter =
false;
3210 gridLayout->addWidget(label,i_thParameter-nbColorParameter,0);
3211 input->setToolTip(txt);
3212 gridLayout->addWidget(input,i_thParameter-nbColorParameter,1);
3218 gridLayout->addWidget(name,n_parameterEntry-nbColorParameter,0);
3220 QPushButton* applyButton =
new QPushButton(
"Apply");
3223 gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,1);
3225#if QT_VERSION < 0x050600
3226 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3227 signalMapper->setMapping(applyButton, paramWidget);
3228 connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
3229 connect(signalMapper, SIGNAL(mapped(QWidget*)),
this, SLOT(VisParameterCallback(QWidget*)));
3231 connect(applyButton, &QPushButton::clicked , [
this, paramWidget](){ this->VisParameterCallback(paramWidget);});
3236 applyButton->setAutoDefault(
TRUE );
3237 applyButton->setDefault(
TRUE );
3239 QPushButton* cancelButton =
new QPushButton( tr(
"&Cancel" ));
3240 cancelButton->setAutoDefault(
TRUE );
3241 gridLayout->addWidget(cancelButton,n_parameterEntry-nbColorParameter,1);
3242 gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,0);
3244#if QT_VERSION < 0x050600
3245 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3246 signalMapper->setMapping(applyButton, paramWidget);
3247 connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
3248 connect(signalMapper, SIGNAL(mapped(QWidget*)),
this, SLOT(VisParameterCallback(QWidget*)));
3250 connect(applyButton, &QPushButton::clicked , [
this, paramWidget](){ this->VisParameterCallback(paramWidget);});
3253 QWidget * parentCheck = aParent;
3254 QDialog* parentDialog = NULL;
3256 while ((parentCheck->parentWidget()) != NULL) {
3257 parentCheck = parentCheck->parentWidget();
3258 parentDialog =
dynamic_cast<QDialog*
>(parentCheck);
3260 connect( applyButton, SIGNAL( clicked() ), parentDialog, SLOT( accept() ) );
3261 connect( cancelButton, SIGNAL( clicked() ), parentDialog, SLOT( reject() ) );
3270 if (!aParent->layout()) {
3271 aParent->setLayout(
new QVBoxLayout());
3273 aParent->layout()->addWidget(paramWidget);
3284QTreeWidgetItem* G4UIQt::FindTreeItem(
3285 QTreeWidgetItem *aParent
3286,
const QString& aCommand
3289 if (aParent == NULL)
return NULL;
3292 QString myCommand = aCommand;
3294 if (myCommand.lastIndexOf(
"/") == (myCommand.size()-1)) {
3295 myCommand = myCommand.left(myCommand.size()-1);
3298 if (GetLongCommandPath(aParent) == myCommand)
3301 QTreeWidgetItem * tmp = NULL;
3302 for (
G4int a=0;a<aParent->childCount();++a) {
3304 tmp = FindTreeItem(aParent->child(a),myCommand);
3318QString G4UIQt::GetCommandList (
3324 if (aCommand == NULL)
3332 if ((commandPath ==
"") &&
3333 (rangeString ==
"") &&
3334 (n_guidanceEntry == 0) &&
3335 (n_parameterEntry == 0)) {
3339 if((commandPath.length()-1)!=
'/') {
3340 txt +=
"Command " + QString((
char*)(commandPath).data()) +
"\n";
3342 txt +=
"Guidance :\n";
3344 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3345 txt += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
3347 if( ! rangeString.empty() ) {
3348 txt +=
" Range of parameters : " + QString((
char*)(rangeString).data()) +
"\n";
3350 if( n_parameterEntry > 0 ) {
3355 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3357 txt +=
"\nParameter : " + QString((
char*)(param->
GetParameterName()).data()) +
"\n";
3360 txt +=
" Parameter type : " + QString(QChar(param->
GetParameterType())) +
"\n";
3362 txt +=
" Omittable : True\n";
3364 txt +=
" Omittable : False\n";
3367 txt +=
" Default value : taken from the current value\n";
3369 txt +=
" Default value : " + QString((
char*)(param->
GetDefaultValue()).data())+
"\n";
3372 txt +=
" Parameter range : " + QString((
char*)(param->
GetParameterRange()).data())+
"\n";
3390void G4UIQt::updateHelpArea (
3394 if (!fParameterHelpLabel)
3396 if (!fParameterHelpTable)
3399 fParameterHelpLabel->setTextInteractionFlags(Qt::NoTextInteraction);
3401 if (aCommand == NULL)
3409 if ((commandPath ==
"") &&
3410 (rangeString ==
"") &&
3411 (n_guidanceEntry == 0) &&
3412 (n_parameterEntry == 0)) {
3416 if((commandPath.length()-1)!=
'/') {
3417 txt +=
"<b>Command </b> " + QString((
char*)(commandPath).data()) +
"<br />";
3419 txt +=
"<b>Guidance :</b> ";
3420 QString tmpGuidance =
"";
3421 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3422 tmpGuidance = QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data());
3423#if QT_VERSION < 0x050000
3424 tmpGuidance = Qt::escape(tmpGuidance);
3426 tmpGuidance = tmpGuidance.toHtmlEscaped();
3428 tmpGuidance.replace(
"\n",
"<br />");
3429 txt += tmpGuidance +
"<br />";
3431 if( ! rangeString.empty() ) {
3432 QString range = QString((
char*)(rangeString).data());
3433#if QT_VERSION < 0x050000
3434 range = Qt::escape(range);
3436 range = range.toHtmlEscaped();
3439 txt +=
"<b>Range of parameters : </b> " + range +
"<br />";
3443 fParameterHelpLabel->setHtml(txt);
3445 if( n_parameterEntry > 0 ) {
3450 fParameterHelpTable->clear();
3451 fParameterHelpTable->setRowCount(n_parameterEntry);
3452 fParameterHelpTable->setColumnCount(8);
3453 fParameterHelpTable->setHorizontalHeaderLabels(QStringList() <<
3462 fParameterHelpTable->setColumnWidth(2,60);
3464 fParameterHelpTable->verticalHeader()->setVisible(
false);
3465 fParameterHelpTable->setAlternatingRowColors (
true);
3466#if QT_VERSION < 0x050000
3467 fParameterHelpTable->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
3468 fParameterHelpTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
3470 fParameterHelpTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
3471 fParameterHelpTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
3473 fParameterHelpTable->setWordWrap(
true);
3475 QTableWidgetItem* t = fParameterHelpTable->horizontalHeaderItem(1);
3476 QFont fnt = t->font();
3477 G4int size = fnt.pointSize();
3478 fnt.setPointSize(size-2);
3480 for(
G4int a=0; a<n_parameterEntry; a++ ) {
3482 fParameterHelpTable->setItem(a, 0,
new QTableWidgetItem(QString::number(a+1)));
3484 fParameterHelpTable->setItem(a, 1,
new QTableWidgetItem(QString((
char*)(param->
GetParameterName()).data())));
3486 fParameterHelpTable->setItem(a, 2,
new QTableWidgetItem(QString((
char*)(param->
GetParameterGuidance()).data())));
3488 fParameterHelpTable->setItem(a, 3,
new QTableWidgetItem(QString(QChar(param->
GetParameterType()))));
3491 fParameterHelpTable->setItem(a, 4,
new QTableWidgetItem(QString(
"True")));
3493 fParameterHelpTable->setItem(a, 4,
new QTableWidgetItem(QString(
"False")));
3496 fParameterHelpTable->setItem(a, 5,
new QTableWidgetItem(QString(
"taken from the current value")));
3498 fParameterHelpTable->setItem(a, 5,
new QTableWidgetItem(QString((
char*)(param->
GetDefaultValue()).data())));
3501 fParameterHelpTable->setItem(a, 6,
new QTableWidgetItem(QString((
char*)(param->
GetParameterRange()).data())));
3504 fParameterHelpTable->setItem(a, 7,
new QTableWidgetItem(QString((
char*)(param->
GetParameterCandidates()).data())));
3507 for (
G4int b=0; b<8; ++b) {
3508 QTableWidgetItem* tmp = fParameterHelpTable->item(a,b);
3510 tmp->setToolTip(tmp->text());
3511 tmp->setFlags(Qt::NoItemFlags);
3514 fParameterHelpTable->resizeRowToContents(a);
3516 for (
G4int c=0; c<8; ++c) {
3518 fParameterHelpTable->resizeColumnToContents(c);
3521 fParameterHelpLabel->setVisible(
true);
3522 fParameterHelpTable->setVisible(
true);
3533G4bool G4UIQt::IsGUICommand(
3537 if (aCommand == NULL)
3542 if( n_parameterEntry > 0 ) {
3547 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3569G4bool G4UIQt::GetHelpChoice(
3584G4bool G4UIQt::eventFilter(
3589 G4bool tabKeyPress =
false;
3590 G4bool moveCommandCursor =
false;
3591 if (aObj == NULL)
return false;
3592 if (aEvent == NULL)
return false;
3594 if (aObj == fHistoryTBTableList) {
3595 if (aEvent->type() == QEvent::KeyPress) {
3596 fCommandArea->setFocus();
3600 if (aObj == fCompleter->popup()) {
3601 if (aEvent->type() == QEvent::KeyPress) {
3602 QKeyEvent *e =
static_cast<QKeyEvent*
>(aEvent);
3603 if (e->key() == (Qt::Key_Tab)) {
3606 }
else if ( aEvent->type() == QEvent::Hide ) {
3608 QString c = fCommandArea->text();
3609 fLastCompleteCommand = c.left(c.indexOf(
"<"));
3613 if (aObj == fCommandArea) {
3614 if (aEvent->type() == QEvent::KeyPress) {
3615 QKeyEvent *e =
static_cast<QKeyEvent*
>(aEvent);
3616 if ((e->key() == (Qt::Key_Down)) ||
3617 (e->key() == (Qt::Key_PageDown)) ||
3618 (e->key() == (Qt::Key_Up)) ||
3619 (e->key() == (Qt::Key_PageUp))) {
3620 G4int selection = fHistoryTBTableList->currentRow();
3621 if (fHistoryTBTableList->count()) {
3622 if (selection == -1) {
3623 selection = fHistoryTBTableList->count()-1;
3625 if (e->key() == (Qt::Key_Down)) {
3626 if (selection <(fHistoryTBTableList->count()-1))
3628 }
else if (e->key() == (Qt::Key_PageDown)) {
3629 selection = fHistoryTBTableList->count()-1;
3630 }
else if (e->key() == (Qt::Key_Up)) {
3633 }
else if (e->key() == (Qt::Key_PageUp)) {
3637 fHistoryTBTableList->clearSelection();
3638#if QT_VERSION < 0x040202
3639 fHistoryTBTableList->setItemSelected(fHistoryTBTableList->item(selection),
true);
3641 fHistoryTBTableList->item(selection)->setSelected(
true);
3643 fHistoryTBTableList->setCurrentItem(fHistoryTBTableList->item(selection));
3645 moveCommandCursor =
true;
3646 }
else if (e->key() == (Qt::Key_Tab)) {
3648 }
else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_A)) {
3649 fCommandArea->home(
false);
3651 }
else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_E)) {
3652 fCommandArea->end(
false);
3655 }
else if (aEvent->type() == QEvent::Paint) {
3656 if (fLastCompleteCommand !=
"") {
3657 fCommandArea->setText(fLastCompleteCommand);
3658 fLastCompleteCommand =
"";
3662 if (tabKeyPress ==
true) {
3664 fCommandArea->setText((
char*)(ss.data()));
3665 fCommandArea->setFocus();
3674 if (moveCommandCursor ==
true) {
3675 fCommandArea->setCursorPosition ( fCommandArea->text().length() );
3676 fCommandArea->setCursorPosition (4);
3679 res = QObject::eventFilter(aObj, aEvent);
3685void G4UIQt::UpdateCommandCompleter() {
3686 if (!fCommandArea)
return;
3689 fCommandArea->setCompleter(NULL);
3691 if (fCompleter->popup()) {
3692 fCompleter->popup()->removeEventFilter(
this);
3696 QStandardItemModel* model = CreateCompleterModel(
"/");
3697 fCompleter =
new QCompleter(model);
3704 int Ndir= aTree-> GetTreeEntry();
3705 fCompleter->setMaxVisibleItems(Ndir);
3707 fCommandArea->setCompleter(fCompleter);
3708 fCompleter->popup()->installEventFilter(
this);
3712QStandardItemModel* G4UIQt::CreateCompleterModel(
G4String aCmd) {
3714 QList< QStandardItem*> dirModelList;
3715 QList< QStandardItem*> commandModelList;
3716 QList< QStandardItem*> subDirModelList;
3717 QList< QStandardItem*> subCommandModelList;
3728 auto jpre= pName.rfind(
'/');
3729 if(jpre != G4String::npos) pName.erase(jpre+1);
3734 G4int Ndir= aTree-> GetTreeEntry();
3735 G4int Ncmd= aTree-> GetCommandEntry();
3738 for(
G4int idir=1; idir<=Ndir; ++idir) {
3739 G4String fpdir= aTree-> GetTree(idir)-> GetPathName();
3741 if( fpdir.find(remainingPath, 0) == 0) {
3743 matchingPath = fpdir;
3750 QStandardItem* item1 =
new QStandardItem(fpdir.data());
3751 QIcon i = QIcon(*fDirIcon);
3753 item1->setIcon(QIcon(*fDirIcon));
3754 dirModelList.append(item1);
3757 QStandardItemModel* subModel = CreateCompleterModel(fpdir.data());
3758 for (
G4int a=0; a< subModel->rowCount(); ++a) {
3761 QStandardItem* tempItem =
new QStandardItem(subModel->item(a)->text());
3762 tempItem->setIcon(subModel->item(a)->icon());
3763 tempItem->setToolTip(subModel->item(a)->toolTip());
3764 tempItem->setData(subModel->item(a)->data());
3767 if (tempItem->data() == 1) {
3769 subDirModelList.append(tempItem);
3772 else if (tempItem->data() == 0) {
3773 subCommandModelList.append(tempItem);
3780 G4int n_parameterEntry;
3782 G4int n_guidanceEntry;
3785 std::string tooltip;
3788 for(
G4int icmd=1; icmd<=Ncmd; ++icmd){
3791 command = aTree-> GetCommand(icmd);
3792 G4String longCommandName= aTree-> GetPathName() +
3793 command -> GetCommandName();
3800 if( longCommandName.find(remainingPath, 0) ==0) {
3802 matchingPath= longCommandName +
" ";
3804 strtmp= longCommandName +
" ";
3809 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3810 tooltip += std::string((command->
GetGuidanceLine(i_thGuidance)).data());
3811 if (i_thGuidance < n_guidanceEntry-1 ) {
3817 for(
G4int a=0; a<n_parameterEntry; a++ ) {
3828 QStandardItem* item =
new QStandardItem(
G4String(longCommandName + params).data());
3830 item->setIcon(QIcon(*fCommandIcon));
3831 item->setToolTip(tooltip.c_str());
3833 commandModelList.append(item);
3838 QStandardItemModel* model =
new QStandardItemModel();
3840 model->setColumnCount(1);
3843 for (
G4int a= 0; a< dirModelList.size(); ++a) {
3844 model->appendRow(dirModelList.at(a));
3846 for (
G4int a= 0; a< subDirModelList.size(); ++a) {
3847 model->appendRow(subDirModelList.at(a));
3849 for (
G4int a= 0; a< commandModelList.size(); ++a) {
3850 model->appendRow(commandModelList.at(a));
3852 for (
G4int a= 0; a< subCommandModelList.size(); ++a) {
3853 model->appendRow(subCommandModelList.at(a));
3868void G4UIQt::ShowHelpCallback (
3877void G4UIQt::ClearButtonCallback (
3880 fCoutTBTextArea->clear();
3881 fG4OutputString.clear();
3886void G4UIQt::ExitSession (
3892void G4UIQt::ExitHelp(
3900void G4UIQt::CommandEnteredCallback (
3904 fCommandArea->setText(fCommandArea->text().trimmed());
3905#if QT_VERSION < 0x050F00
3907 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),QString::SkipEmptyParts);
3910 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),Qt::SkipEmptyParts);
3914 for (
G4int a=0; a< list.size(); ++a) {
3915 QString txt (list[a].trimmed());
3917 fHistoryTBTableList->addItem(txt);
3918 fHistoryTBTableList->clearSelection();
3919 fHistoryTBTableList->setCurrentItem(NULL);
3920 fCommandArea->setText(
"");
3922 if (interactorManager) {
3926 G4String command = txt.toStdString().c_str();
3927 if (command.substr(0,4) !=
"help") {
3930 ActivateCommand(command);
3935 fCommandArea->setFocus();
3941 UpdateCommandCompleter();
3943 if(exitSession==
true)
3952void G4UIQt::CommandEditedCallback(
const QString &)
3954#if QT_VERSION < 0x050F00
3956 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),QString::SkipEmptyParts);
3959 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),Qt::SkipEmptyParts);
3962 if (list.size() > 1) {
3963 for (
G4int a=0; a<list.size()-1; ++a) {
3965 fCommandArea->setText(list[a]);
3967 CommandEnteredCallback();
3970 fCommandArea->setText(list[list.size()-1]);
3977void G4UIQt::VisParameterCallback(QWidget* widget){
3978 if (widget == NULL) {
3983 QGridLayout* grid =
dynamic_cast<QGridLayout*
>(widget->layout());
3988#if QT_VERSION < 0x040400
3989 QWidget*
name = grid->itemAt(grid->columnCount()*(grid->rowCount()-2))->widget();
3991 QWidget*
name = grid->itemAtPosition(grid->rowCount()-1,0)->widget();
3993 if (
dynamic_cast<QLabel*
>(name) == 0) {
3996 command += (
dynamic_cast<QLabel*
>(
name))->text()+
" ";
3998 for (
G4int a=0;a<grid->rowCount()-1; ++a) {
3999#if QT_VERSION < 0x040400
4000 QWidget* widgetTmp = grid->itemAt(a*grid->columnCount()+1)->widget();
4002 QWidget* widgetTmp = grid->itemAtPosition(a,1)->widget();
4006 if (widgetTmp != NULL) {
4008 if (
dynamic_cast<QLineEdit*
>(widgetTmp) != 0) {
4009 command += (
dynamic_cast<QLineEdit*
>(widgetTmp))->text()+
" ";
4011 }
else if (
dynamic_cast<QComboBox*
>(widgetTmp) != 0){
4012 command += (
dynamic_cast<QComboBox*
>(widgetTmp))->itemText((
dynamic_cast<QComboBox*
>(widgetTmp))->currentIndex())+
" ";
4015 }
else if (
dynamic_cast<QPushButton*
>(widgetTmp) != 0){
4016 command += widgetTmp->accessibleName()+
" ";
4019 }
else if (
dynamic_cast<QWidget*
>(widgetTmp) != 0){
4020 if (widgetTmp->layout()->count() > 0){
4021 if (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()) != 0) {
4022 QAbstractButton * checked = (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()))->group()->checkedButton();
4024 command += (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()))->group()->checkedButton()->text()+
" ";
4032 if (command !=
"") {
4046void G4UIQt::ButtonCallback (
4047 const QString& aCommand
4053 if(UI==NULL)
return;
4060 if (IsGUICommand(command)) {
4061 QDialog* menuParameterDialog =
new QDialog();
4063 if (CreateVisCommandGroupAndToolBox(command,menuParameterDialog,1,
true)) {
4064 menuParameterDialog->setWindowTitle (aCommand);
4065 menuParameterDialog->setSizePolicy (QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
4068 menuParameterDialog->exec();
4071 delete menuParameterDialog;
4080 if(exitSession==
true)
4088void G4UIQt::HelpTreeClicCallback (
4091 QTreeWidgetItem* item = NULL;
4092 if (!fHelpTreeWidget)
4095 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
4098 item = list.first();
4103 if(UI==NULL)
return;
4106 std::string itemText = GetLongCommandPath(item).toStdString();
4109 if (item->childCount() > 0) {
4115 updateHelpArea(command);
4121 fParameterHelpLabel->setVisible(
true);
4122 fParameterHelpLabel->setText(path->
GetTitle().data());
4123 fParameterHelpTable->setVisible(
false);
4130void G4UIQt::HelpTreeDoubleClicCallback (
4133 HelpTreeClicCallback();
4135 QTreeWidgetItem* item = NULL;
4136 if (!fHelpTreeWidget)
4139 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
4142 item = list.first();
4146 fCommandArea->clear();
4147 fCommandArea->setText(GetLongCommandPath(item));
4154void G4UIQt::CommandHistoryCallback(
4157 QListWidgetItem* item = NULL;
4158 if (!fHistoryTBTableList)
4162 QList<QListWidgetItem *> list =fHistoryTBTableList->selectedItems();
4165 item = list.first();
4168 fCommandArea->setText(item->text());
4172void G4UIQt::ThreadComboBoxCallback(
G4int) {
4173 CoutFilterCallback(
"");
4177void G4UIQt::CoutFilterCallback(
4180 FilterAllOutputTextArea();
4182 fCoutTBTextArea->repaint();
4183 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
4188void G4UIQt::SaveOutputCallback(){
4189 QString fileName = QFileDialog::getSaveFileName(fMainWindow,
"Save console output as...", fLastOpenPath,
"Save output as...");
4190 if (fileName !=
"") {
4192 QFile data(fileName);
4193 if (data.open(QFile::WriteOnly | QFile::Truncate)) {
4194 QTextStream out(&data);
4195 out << fCoutTBTextArea->toPlainText();
4203QString G4UIQt::FilterOutput(
4205,
const QString& currentThread
4206,
const QString& filter
4209#ifdef G4MULTITHREADED
4210 if ((currentThread ==
"All") ||
4211 (currentThread == output.
fThread)) {
4213 if (currentThread ==
"") {
4215 if (output.
fText.contains(QRegExp(filter))) {
4216 return output.
fText;
4223void G4UIQt::FilterAllOutputTextArea() {
4225 QString currentThread =
"";
4226#ifdef G4MULTITHREADED
4227 currentThread = fThreadsFilterComboBox->currentText();
4228 if (currentThread ==
"Master") {
4232 QString filter = fCoutFilter->text();
4233 G4String previousOutputStream =
"";
4238 fCoutTBTextArea->clear();
4240 for (
unsigned int a=0; a<fG4OutputString.size(); a++) {
4242 if (FilterOutput(out,currentThread,filter) !=
"") {
4251 pref =
"<font color=\"DarkYellow\">";
4254 pref =
"<font color=\"Red\">";
4258 fCoutTBTextArea->append(pref + out.
fText + post);
4268void G4UIQt::LookForHelpStringCallback(
4271 fHelpLine->setText(fHelpLine->text().trimmed());
4272 QString searchText = fHelpLine->text();
4274 fParameterHelpLabel->setText(
"");
4275 fParameterHelpTable->setVisible(
false);
4276 if (searchText ==
"") {
4278 fHelpTreeWidget->clear();
4284 OpenHelpTreeOnCommand(searchText);
4289void G4UIQt::OpenHelpTreeOnCommand(
4290 const QString & searchText
4295 if(UI==NULL)
return;
4301 fHelpTreeWidget->clear();
4307#if QT_VERSION < 0x050F00
4309 QMap<G4int,QString> commandResultMap;
4310 QMap<G4int,QString> commandChildResultMap;
4311 for (
G4int a=0;a<treeSize;++a) {
4313 tmp = GetCommandList (command).count(searchText,Qt::CaseInsensitive);
4315 commandResultMap.insertMulti(tmp,QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()));
4318 commandChildResultMap = LookForHelpStringInChildTree(treeTop->
GetTree(a+1),searchText);
4320 if (!commandChildResultMap.empty()) {
4321 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4322 while (i != commandChildResultMap.constEnd()) {
4323 commandResultMap.insertMulti(i.key(),i.value());
4326 commandChildResultMap.clear();
4331 QMultiMap<G4int,QString> commandResultMap;
4332 QMultiMap<G4int,QString> commandChildResultMap;
4333 for (
G4int a=0;a<treeSize;++a) {
4335 tmp = GetCommandList (command).count(searchText,Qt::CaseInsensitive);
4337 commandResultMap.insert(tmp,QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()));
4340 commandChildResultMap = LookForHelpStringInChildTree(treeTop->
GetTree(a+1),searchText);
4342 if (!commandChildResultMap.empty()) {
4343 QMap<G4int,QString>::const_iterator i = commandChildResultMap.constBegin();
4344 while (i != commandChildResultMap.constEnd()) {
4345 commandResultMap.insert(i.key(),i.value());
4348 commandChildResultMap.clear();
4354 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
4355 fHelpTreeWidget->setColumnCount(2);
4357 labels << QString(
"Command") << QString(
"Match");
4358 fHelpTreeWidget->setHeaderLabels(labels);
4360 if (commandResultMap.empty()) {
4361 fParameterHelpLabel->setText(
"No match found");
4362 fParameterHelpTable->setVisible(
false);
4366 QMap<G4int,QString>::const_iterator i = commandResultMap.constEnd();
4370 QString progressChar =
"|";
4371 QString progressStr =
"|";
4373 QTreeWidgetItem * newItem;
4376 if (i == commandResultMap.constBegin()) {
4379 for(
G4int a=0;a<
G4int(i.key()*multValue);++a) {
4380 progressStr += progressChar;
4382 newItem =
new QTreeWidgetItem();
4383 QString commandStr = i.value().trimmed();
4385 if (commandStr.indexOf(
"/") == 0) {
4386 commandStr = commandStr.right(commandStr.size()-1);
4389 newItem->setText(0,commandStr);
4390 newItem->setText(1,progressStr);
4391 fHelpTreeWidget->addTopLevelItem(newItem);
4392#if QT_VERSION < 0x040200
4394 newItem->setForeground ( 1, QBrush(Qt::blue) );
4399 fHelpTreeWidget->resizeColumnToContents (0);
4400 fHelpTreeWidget->sortItems(1,Qt::DescendingOrder);
4404#if QT_VERSION < 0x050F00
4406QMap<G4int,QString> G4UIQt::LookForHelpStringInChildTree(
4408,
const QString & text
4411 QMap<G4int,QString> commandResultMap;
4412 if (aCommandTree == NULL)
return commandResultMap;
4415 QMap<G4int,QString> commandChildResultMap;
4418 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4420 commandResultMap.insertMulti(tmp,QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()));
4423 commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->
GetTree(a+1),text);
4424 if (!commandChildResultMap.empty()) {
4426 QMap<G4int,QString>::const_iterator i = commandChildResultMap.constBegin();
4427 while (i != commandChildResultMap.constEnd()) {
4428 commandResultMap.insertMulti(i.key(),i.value());
4431 commandChildResultMap.clear();
4437 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4442 return commandResultMap;
4446QMultiMap<G4int,QString> G4UIQt::LookForHelpStringInChildTree(
4448,
const QString & text
4451 QMultiMap<G4int,QString> commandResultMap;
4452 if (aCommandTree == NULL)
return commandResultMap;
4455 QMultiMap<G4int,QString> commandChildResultMap;
4458 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4460 commandResultMap.insert(tmp,QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()));
4463 commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->
GetTree(a+1),text);
4464 if (!commandChildResultMap.empty()) {
4466 QMap<G4int,QString>::const_iterator i = commandChildResultMap.constBegin();
4467 while (i != commandChildResultMap.constEnd()) {
4468 commandResultMap.insert(i.key(),i.value());
4471 commandChildResultMap.clear();
4477 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4482 return commandResultMap;
4487QString G4UIQt::GetShortCommandPath(
4491 if (commandPath.indexOf(
"/") == 0) {
4492 commandPath = commandPath.right(commandPath.size()-1);
4495 commandPath = commandPath.right(commandPath.size()-commandPath.lastIndexOf(
"/",-2)-1);
4497 if (commandPath.lastIndexOf(
"/") == (commandPath.size()-1)) {
4498 commandPath = commandPath.left(commandPath.size()-1);
4505QString G4UIQt::GetLongCommandPath(
4506 QTreeWidgetItem* item
4509 if (item == NULL)
return "";
4512 QString itemText =
"";
4513 itemText = item->text(0);
4515 while (item->parent() != NULL) {
4516 itemText = item->parent()->text(0)+
"/"+itemText;
4517 item = item->parent();
4519 itemText =
"/"+itemText;
4525void G4UIQt::ChangeColorCallback(QWidget* widget) {
4526 if (widget == NULL) {
4530 QPushButton* button =
dynamic_cast<QPushButton*
>(widget);
4534 QString value = button->accessibleName();
4537 old.setRgbF(value.section(
" ",0,1).toDouble(),
4538 value.section(
" ",1,2).toDouble(),
4539 value.section(
" ",2,3).toDouble());
4540#if QT_VERSION < 0x040500
4542 QColor color = QColor(QColorDialog::getRgba (old.rgba(),&a,fUITabWidget));
4544 QColor color = QColorDialog::getColor(old,
4547 QColorDialog::ShowAlphaChannel);
4551 if (color.isValid()) {
4553 QPixmap pixmap = QPixmap(QSize(16, 16));
4554 pixmap.fill (color);
4555 QPainter painter(&pixmap);
4556 painter.setPen(Qt::black);
4557 painter.drawRect(0,0,15,15);
4559 button->setAccessibleName(QString::number(color.redF())+
" "+
4560 QString::number(color.greenF())+
" "+
4561 QString::number(color.blueF())+
" "
4563 button->setIcon(pixmap);
4570void G4UIQt::ChangeCursorAction(
const QString& action) {
4574 fMoveSelected =
true;
4575 fPickSelected =
true;
4576 fRotateSelected =
true;
4577 fZoomInSelected =
true;
4578 fZoomOutSelected =
true;
4580 if (fToolbarApp == NULL)
return;
4581 QList<QAction *> list = fToolbarApp->actions ();
4582 for (
int i = 0; i < list.size(); ++i) {
4583 if (list.at(i)->data().toString () == action) {
4584 list.at(i)->setChecked(
TRUE);
4585 if (list.at(i)->data().toString () ==
"pick") {
4587 CreatePickInfosDialog();
4589 fPickInfosDialog->show();
4590 fPickInfosDialog->raise();
4591 fPickInfosDialog->activateWindow();
4593 }
else if (list.at(i)->data().toString () ==
"move") {
4594 fMoveSelected =
false;
4595 list.at(i)->setChecked(
FALSE);
4596 }
else if (list.at(i)->data().toString () ==
"pick") {
4597 fPickSelected =
false;
4598 list.at(i)->setChecked(
FALSE);
4600 if (fPickInfosDialog) {
4601 fPickInfosDialog->hide();
4603 }
else if (list.at(i)->data().toString () ==
"rotate") {
4604 fRotateSelected =
false;
4605 list.at(i)->setChecked(
FALSE);
4606 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4607 fZoomInSelected =
false;
4608 list.at(i)->setChecked(
FALSE);
4609 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4610 fZoomOutSelected =
false;
4611 list.at(i)->setChecked(
FALSE);
4624void G4UIQt::ChangeSurfaceStyle(
const QString& action) {
4628 if (fToolbarApp == NULL)
return;
4629 QList<QAction *> list = fToolbarApp->actions ();
4630 for (
G4int i = 0; i < list.size(); ++i) {
4631 if (list.at(i)->data().toString () == action) {
4632 list.at(i)->setChecked(
TRUE);
4633 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4634 list.at(i)->setChecked(
FALSE);
4635 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4636 list.at(i)->setChecked(
FALSE);
4637 }
else if (list.at(i)->data().toString () ==
"solid") {
4638 list.at(i)->setChecked(
FALSE);
4639 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4640 list.at(i)->setChecked(
FALSE);
4645 if (action ==
"hidden_line_removal") {
4649 }
else if (action ==
"hidden_line_and_surface_removal") {
4653 }
else if (action ==
"solid") {
4657 }
else if (action ==
"wireframe") {
4664void G4UIQt::OpenIconCallback(
const QString& aParam) {
4666 QString aCommand = aParam.left(aParam.indexOf(fStringSeparator));
4667 QString aLabel = aParam.mid(aParam.indexOf(fStringSeparator)+fStringSeparator.length());
4669 QString nomFich = QFileDialog::getOpenFileName(fMainWindow, aLabel, fLastOpenPath,
"Macro files (*.mac);;Geant4 files( *.mac *.g4* *.in);;All (*.*)");
4670 if (nomFich !=
"") {
4673 fLastOpenPath = dir.absoluteFilePath(nomFich);
4678void G4UIQt::SaveIconCallback(
const QString& aParam) {
4680 QString aCommand = aParam.left(aParam.indexOf(fStringSeparator));
4681 QString aLabel = aParam.mid(aParam.indexOf(fStringSeparator)+fStringSeparator.length());
4683 QString nomFich = QFileDialog::getSaveFileName(fMainWindow, aLabel, fLastOpenPath,
"Macro files (*.mac)");
4684 if (nomFich !=
"") {
4687 fLastOpenPath = dir.absoluteFilePath(nomFich);
4692void G4UIQt::CreateViewerPropertiesDialog() {
4694 if (fViewerPropertiesDialog != NULL) {
4697 fViewerPropertiesDialog =
new QDialog();
4699 fViewerPropertiesDialog->setWindowTitle(
"Viewer properties");
4700 fViewerPropertiesDialog->setSizePolicy (QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
4702 if (!fViewerPropertiesWidget) {
4703 fViewerPropertiesWidget =
new QWidget();
4704 QVBoxLayout* layoutPropertiesWidget =
new QVBoxLayout();
4705 fViewerPropertiesWidget->setLayout(layoutPropertiesWidget);
4707 CreateEmptyViewerPropertiesWidget();
4710 QVBoxLayout* layoutDialog =
new QVBoxLayout();
4712 layoutDialog->addWidget(fViewerPropertiesWidget);
4713 layoutDialog->setContentsMargins(0,0,0,0);
4714 fViewerPropertiesDialog->setLayout(layoutDialog);
4718void G4UIQt::CreatePickInfosDialog() {
4720 if (fPickInfosDialog != NULL) {
4723 fPickInfosDialog =
new QDialog();
4725 fPickInfosDialog->setWindowTitle(
"Pick infos");
4726 fPickInfosDialog->setSizePolicy (QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
4728 if (!fPickInfosWidget) {
4729 fPickInfosWidget =
new QWidget();
4730 QVBoxLayout* layoutPickInfos =
new QVBoxLayout();
4731 fPickInfosWidget->setLayout(layoutPickInfos);
4733 CreateEmptyPickInfosWidget();
4736 QVBoxLayout* layoutDialog =
new QVBoxLayout();
4738 layoutDialog->addWidget(fPickInfosWidget);
4739 layoutDialog->setContentsMargins(0,0,0,0);
4740 fPickInfosDialog->setLayout(layoutDialog);
4741 fPickInfosDialog->setWindowFlags(Qt::WindowStaysOnTopHint);
4746void G4UIQt::CreateEmptyViewerPropertiesWidget() {
4747 if(!fViewerPropertiesWidget)
return;
4748 if(!fViewerPropertiesWidget->layout())
return;
4749 QLayoutItem * wItem;
4750 if (fViewerPropertiesWidget->layout()->count()) {
4751 while ((wItem = fViewerPropertiesWidget->layout()->takeAt(0)) != 0) {
4752 delete wItem->widget();
4757 QLabel* label =
new QLabel(
"No viewer - Please open a viewer first");
4758 fViewerPropertiesWidget->layout()->addWidget(label);
4759 fViewerPropertiesDialog->setWindowTitle(
"No viewer");
4760 fViewerPropertiesDialog->setVisible(
false);
4764void G4UIQt::CreateEmptyPickInfosWidget() {
4765 QLayoutItem * wItem;
4766 if (fPickInfosWidget->layout()->count()) {
4767 while ((wItem = fPickInfosWidget->layout()->takeAt(0)) != 0) {
4768 delete wItem->widget();
4773 QLabel* label =
new QLabel(
"Click on the object you want to pick");
4774 fPickInfosWidget->layout()->addWidget(label);
4775 fPickInfosDialog->setWindowTitle(
"Nothing to pick");
4779void G4UIQt::ViewerPropertiesIconCallback(
G4int) {
4781 CreateViewerPropertiesDialog();
4783 fViewerPropertiesDialog->show();
4784 fViewerPropertiesDialog->raise();
4785 fViewerPropertiesDialog->activateWindow();
4789void G4UIQt::ChangePerspectiveOrtho(
const QString& action) {
4793 if (fToolbarApp == NULL)
return;
4794 QList<QAction *> list = fToolbarApp->actions ();
4795 QString checked =
"";
4796 for (
G4int i = 0; i < list.size(); ++i) {
4797 if (list.at(i)->data().toString () == action) {
4798 list.at(i)->setChecked(
TRUE);
4799 checked = list.at(i)->data().toString ();
4800 }
else if (list.at(i)->data().toString () ==
"perspective") {
4801 list.at(i)->setChecked(
FALSE);
4802 }
else if (list.at(i)->data().toString () ==
"ortho") {
4803 list.at(i)->setChecked(
FALSE);
4807 if ((action ==
"ortho") && (checked ==
"ortho")) {
4809 }
else if ((action ==
"perspective") && (checked ==
"perspective")) {
4818 fMoveSelected =
true;
4819 fRotateSelected =
false;
4820 fPickSelected =
false;
4821 fZoomInSelected =
false;
4822 fZoomOutSelected =
false;
4824 if (fToolbarApp == NULL)
return;
4825 QList<QAction *> list = fToolbarApp->actions ();
4826 for (
G4int i = 0; i < list.size(); ++i) {
4827 if (list.at(i)->data().toString () ==
"move") {
4828 list.at(i)->setChecked(
TRUE);
4829 }
else if (list.at(i)->data().toString () ==
"rotate") {
4830 list.at(i)->setChecked(
FALSE);
4831 }
else if (list.at(i)->data().toString () ==
"pick") {
4832 list.at(i)->setChecked(
FALSE);
4833 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4834 list.at(i)->setChecked(
FALSE);
4835 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4836 list.at(i)->setChecked(
FALSE);
4844 fRotateSelected =
true;
4845 fMoveSelected =
false;
4846 fPickSelected =
false;
4847 fZoomInSelected =
false;
4848 fZoomOutSelected =
false;
4850 if (fToolbarApp == NULL)
return;
4851 QList<QAction *> list = fToolbarApp->actions ();
4852 for (
G4int i = 0; i < list.size(); ++i) {
4853 if (list.at(i)->data().toString () ==
"rotate") {
4854 list.at(i)->setChecked(
TRUE);
4855 }
else if (list.at(i)->data().toString () ==
"move") {
4856 list.at(i)->setChecked(
FALSE);
4857 }
else if (list.at(i)->data().toString () ==
"pick") {
4858 list.at(i)->setChecked(
FALSE);
4859 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4860 list.at(i)->setChecked(
FALSE);
4861 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4862 list.at(i)->setChecked(
FALSE);
4870 fPickSelected =
true;
4871 fMoveSelected =
false;
4872 fRotateSelected =
false;
4873 fZoomInSelected =
false;
4874 fZoomOutSelected =
false;
4876 QToolBar* bar = fToolbarApp;
4877 if (!fDefaultIcons) {
4882 QList<QAction *> list = bar->actions ();
4883 for (
G4int i = 0; i < list.size(); ++i) {
4884 if (list.at(i)->data().toString () ==
"pick") {
4885 list.at(i)->setChecked(
TRUE);
4886 }
else if (list.at(i)->data().toString () ==
"move") {
4887 list.at(i)->setChecked(
FALSE);
4888 }
else if (list.at(i)->data().toString () ==
"rotate") {
4889 list.at(i)->setChecked(
FALSE);
4890 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4891 list.at(i)->setChecked(
FALSE);
4892 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4893 list.at(i)->setChecked(
FALSE);
4901 fZoomInSelected =
true;
4902 fMoveSelected =
false;
4903 fRotateSelected =
false;
4904 fPickSelected =
false;
4905 fZoomOutSelected =
false;
4907 QToolBar* bar = fToolbarApp;
4908 if (!fDefaultIcons) {
4913 QList<QAction *> list = bar->actions ();
4914 for (
G4int i = 0; i < list.size(); ++i) {
4915 if (list.at(i)->data().toString () ==
"zoom_in") {
4916 list.at(i)->setChecked(
TRUE);
4917 }
else if (list.at(i)->data().toString () ==
"move") {
4918 list.at(i)->setChecked(
FALSE);
4919 }
else if (list.at(i)->data().toString () ==
"rotate") {
4920 list.at(i)->setChecked(
FALSE);
4921 }
else if (list.at(i)->data().toString () ==
"pick") {
4922 list.at(i)->setChecked(
FALSE);
4923 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4924 list.at(i)->setChecked(
FALSE);
4932 fZoomOutSelected =
true;
4933 fMoveSelected =
false;
4934 fRotateSelected =
false;
4935 fPickSelected =
false;
4936 fZoomInSelected =
false;
4938 QToolBar* bar = fToolbarApp;
4939 if (!fDefaultIcons) {
4944 QList<QAction *> list = bar->actions ();
4945 for (
G4int i = 0; i < list.size(); ++i) {
4946 if (list.at(i)->data().toString () ==
"zoom_out") {
4947 list.at(i)->setChecked(
TRUE);
4948 }
else if (list.at(i)->data().toString () ==
"move") {
4949 list.at(i)->setChecked(
FALSE);
4950 }
else if (list.at(i)->data().toString () ==
"rotate") {
4951 list.at(i)->setChecked(
FALSE);
4952 }
else if (list.at(i)->data().toString () ==
"pick") {
4953 list.at(i)->setChecked(
FALSE);
4954 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4955 list.at(i)->setChecked(
FALSE);
4964 QToolBar* bar = fToolbarApp;
4965 if (!fDefaultIcons) {
4970 QList<QAction *> list = bar->actions ();
4971 for (
G4int i = 0; i < list.size(); ++i) {
4972 if (list.at(i)->data().toString () ==
"solid") {
4973 list.at(i)->setChecked(
TRUE);
4974 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4975 list.at(i)->setChecked(
FALSE);
4976 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4977 list.at(i)->setChecked(
FALSE);
4978 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4979 list.at(i)->setChecked(
FALSE);
4988 QToolBar* bar = fToolbarApp;
4989 if (!fDefaultIcons) {
4994 QList<QAction *> list = bar->actions ();
4995 for (
G4int i = 0; i < list.size(); ++i) {
4996 if (list.at(i)->data().toString () ==
"wireframe") {
4997 list.at(i)->setChecked(
TRUE);
4998 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4999 list.at(i)->setChecked(
FALSE);
5000 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
5001 list.at(i)->setChecked(
FALSE);
5002 }
else if (list.at(i)->data().toString () ==
"solid") {
5003 list.at(i)->setChecked(
FALSE);
5012 QToolBar* bar = fToolbarApp;
5013 if (!fDefaultIcons) {
5019 QList<QAction *> list = bar->actions ();
5020 for (
G4int i = 0; i < list.size(); ++i) {
5021 if (list.at(i)->data().toString () ==
"hidden_line_removal") {
5022 list.at(i)->setChecked(
TRUE);
5023 }
else if (list.at(i)->data().toString () ==
"solid") {
5024 list.at(i)->setChecked(
FALSE);
5025 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
5026 list.at(i)->setChecked(
FALSE);
5027 }
else if (list.at(i)->data().toString () ==
"wireframe") {
5028 list.at(i)->setChecked(
FALSE);
5037 QToolBar* bar = fToolbarApp;
5038 if (!fDefaultIcons) {
5044 QList<QAction *> list = bar->actions ();
5045 for (
G4int i = 0; i < list.size(); ++i) {
5046 if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
5047 list.at(i)->setChecked(
TRUE);
5048 }
else if (list.at(i)->data().toString () ==
"solid") {
5049 list.at(i)->setChecked(
FALSE);
5050 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
5051 list.at(i)->setChecked(
FALSE);
5052 }
else if (list.at(i)->data().toString () ==
"wireframe") {
5053 list.at(i)->setChecked(
FALSE);
5062 QToolBar* bar = fToolbarApp;
5063 if (!fDefaultIcons) {
5069 QList<QAction *> list = bar->actions ();
5070 for (
G4int i = 0; i < list.size(); ++i) {
5071 if (list.at(i)->data().toString () ==
"perspective") {
5072 list.at(i)->setChecked(
TRUE);
5073 }
else if (list.at(i)->data().toString () ==
"ortho") {
5074 list.at(i)->setChecked(
FALSE);
5084 QToolBar* bar = fToolbarApp;
5085 if (!fDefaultIcons) {
5091 QList<QAction *> list = bar->actions ();
5092 for (
G4int i = 0; i < list.size(); ++i) {
5093 if (list.at(i)->data().toString () ==
"ortho") {
5094 list.at(i)->setChecked(
TRUE);
5095 }
else if (list.at(i)->data().toString () ==
"perspective") {
5096 list.at(i)->setChecked(
FALSE);
5107):QTabWidget(aParent)
5108 ,fTabSelected(false)
5110,fPreferedSizeX(sizeX+6)
5111,fPreferedSizeY(sizeY+58)
5113 setMinimumSize(100,100);
5114 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
5115 setSizePolicy(policy);
5120 ,fTabSelected(false)
5136 if (!
GetOutputList().contains(QString(
" ")+outputStream+
" ")) {
5144#if QT_VERSION < 0x040500
5145void G4UIQt::TabCloseCallback(
G4int){
5147void G4UIQt::TabCloseCallback(
G4int a){
5149#if QT_VERSION < 0x040500
5151 if (fViewerTabWidget == NULL)
return;
5154 QWidget* temp = fViewerTabWidget->widget(a);
5156 fViewerTabWidget->removeTab (a);
5160 for (
G4int c=0; c<fViewerTabWidget->count(); ++c) {
5161 if (fViewerTabWidget->tabText(c).contains(
"viewer")) {
5167 CreateEmptyViewerPropertiesWidget();
5175void G4UIQt::ToolBoxActivated(
G4int a){
5177 if (fUITabWidget->widget(a) == fHelpTBWidget) {
5180 }
else if (fUITabWidget->widget(a) == fSceneTreeWidget) {
5181#if QT_VERSION < 0x040200
5182 fSceneTreeWidget->show();
5184 fSceneTreeWidget->setVisible(
true);
5195 if (currentWidget()) {
5197 if ( isTabSelected()) {
5201 QString text = tabText (currentIndex());
5203 if (fLastCreated == -1) {
5204 QTextEdit* edit =
dynamic_cast<QTextEdit*
>(currentWidget());
5206 QString paramSelect = QString(
"/vis/viewer/select ")+text;
5215 setTabSelected(
false);
5227 setFloating (
false);
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4String GetFullPrefixString() const
G4String GetPrefixString() const
static G4Qt * getInstance()
void FlushAndWaitExecution()
static G4StateManager * GetStateManager()
G4UIOutputString(QString text, G4String thread="", G4String outputstream="info")
void SetIconPickSelected()
G4bool AddTabWidget(QWidget *, QString)
QWidget * GetViewerPropertiesWidget()
void SetIconOrthoSelected()
void SetStartPage(const std::string &)
G4bool AddViewerTabFromFile(std::string fileName, std::string title)
virtual void PauseSessionStart(const G4String &)
void SetIconZoomInSelected()
QWidget * GetSceneTreeWidget()
void SetIconZoomOutSelected()
void SetIconHLRSelected()
void SetIconPerspectiveSelected()
virtual G4int ReceiveG4cout(const G4String &)
virtual G4int ReceiveG4cerr(const G4String &)
G4UIsession * SessionStart()
QWidget * GetPickInfosWidget()
void SetIconSolidSelected()
void DefaultIcons(G4bool aVal)
void NativeMenu(G4bool aVal)
void SetIconRotateSelected()
void AddButton(const char *, const char *, const char *)
void AddMenu(const char *, const char *)
void AddIcon(const char *userLabel, const char *iconFile, const char *command, const char *file_name="")
void SetIconWireframeSelected()
void SetIconMoveSelected()
G4bool AddViewerTab(QWidget *w, std::string title)
void SetIconHLHSRSelected()
void OutputStyle(const char *, const char *, const char *)
G4int GetCommandEntry() const
const G4UIcommand * GetGuidance() const
G4UIcommand * GetCommand(G4int i)
const G4String & GetPathName() const
G4int GetTreeEntry() const
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * FindCommandTree(const char *commandPath)
const G4String GetTitle() const
G4String GetFirstMatchedString(const G4String &, const G4String &) const
G4UIcommand * FindPath(const char *commandPath) const
std::size_t GetParameterEntries() const
const G4String & GetGuidanceLine(G4int i) const
G4UIparameter * GetParameter(G4int i) const
const G4String & GetCommandPath() const
std::size_t GetGuidanceEntries() const
const G4String & GetRange() const
void SetCoutDestination(G4UIsession *const value)
G4UIcommandTree * GetTree() const
G4int ApplyCommand(const char *aCommand)
bool IsLastCommandOutputTreated()
G4int GetVerboseLevel() const
G4String FindMacroPath(const G4String &fname) const
static G4UImanager * GetUIpointer()
G4MTcoutDestination * GetThreadCout()
void SetSession(G4UIsession *const value)
void SetG4UIWindow(G4UIsession *const value)
void SetLastCommandOutputTreated()
const G4String & GetParameterCandidates() const
const G4String & GetParameterGuidance() const
G4bool IsOmittable() const
const G4String & GetParameterRange() const
G4bool GetCurrentAsDefault() const
char GetParameterType() const
const G4String & GetParameterName() const
const G4String & GetDefaultValue() const
G4String ModifyToFullPathCommand(const char *aCommandLine) const
G4String Complete(const G4String &)
void TerminalHelp(const G4String &)
void ApplyShellCommand(const G4String &, G4bool &, G4bool &)
void AddInteractor(G4String, G4Interactor)
G4Interactor GetInteractor(G4String)
void EnableSecondaryLoop()
G4Interactor GetMainInteractor()
void DisableSecondaryLoop()
static G4MTGLOB_DLL G4coutDestination * masterG4coutDestination
const char * name(G4int ptype)
void strip(G4String &str, char ch=' ')
Remove leading and trailing characters from string.
G4bool contains(const G4String &str, std::string_view ss)
Check if a string contains a given substring.
G4String lstrip_copy(G4String str, char ch=' ')
Return copy of string with leading characters removed.