30#ifdef G4UI_BUILD_QT_SESSION
45#include <qapplication.h>
46#include <qmessagebox.h>
51#include <qpushbutton.h>
54#include <qscrollbar.h>
58#if QT_VERSION < 0x050600
59#include <qsignalmapper.h>
61#include <qtabwidget.h>
63#include <qstringlist.h>
64#include <qtextstream.h>
66#include <qmainwindow.h>
68#include <qlistwidget.h>
69#include <qtreewidget.h>
70#include <qheaderview.h>
72#include <qscrollarea.h>
74#include <qradiobutton.h>
75#include <qbuttongroup.h>
78#include <qcolordialog.h>
80#include <qfiledialog.h>
81#include <qdesktopwidget.h>
82#include <qtablewidget.h>
83#include <qcompleter.h>
84#include <qstandarditemmodel.h>
85#include <qboxlayout.h>
89#include "moc_G4UIQt.cpp"
93static G4bool exitSession =
true;
94static G4bool exitPause =
true;
123,fCoutTBTextArea(NULL)
128,fHistoryTBTableList(NULL)
129,fHelpTreeWidget(NULL)
131,fHistoryTBWidget(NULL)
132,fCoutDockWidget(NULL)
134,fSceneTreeWidget(NULL)
135,fViewerPropertiesWidget(NULL)
136,fPickInfosWidget(NULL)
138,fViewerTabWidget(NULL)
142,fParameterHelpLabel(NULL)
143,fParameterHelpTable(NULL)
146,fStringSeparator(
"__$$$@%%###__")
159,fHiddenLineRemovalIcon(NULL)
160,fHiddenLineAndSurfaceRemovalIcon(NULL)
161,fPerspectiveIcon(NULL)
167,fPickTargetIcon(NULL)
168#ifdef G4MULTITHREADED
169,fThreadsFilterComboBox(NULL)
171,fDefaultViewerFirstPageHTMLText(
"")
172,fViewerPropertiesDialog(NULL)
173,fPickInfosDialog(NULL)
174,fLastCompleteCommand(
"")
176,fRotateSelected(true)
178,fZoomInSelected(false)
179,fZoomOutSelected(false)
182 G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(
char*)
"Qt");
183 if (!(QApplication*)interactorManager->GetMainInteractor()) {
188 G4cout <<
"G4UIQt : Unable to init Qt. Aborted" <<
G4endl;
198 Q_FOREACH (QWidget *widget, QApplication::allWidgets()) {
199 if ((found==
false) && (widget->inherits(
"QMainWindow"))) {
209 G4cout <<
"G4UIQt : Found an external App with a QMainWindow already defined. Aborted" <<
G4endl;
215 fMainWindow =
new QMainWindow();
216 fMainWindow->setAttribute(Qt::WA_DeleteOnClose);
218 fMainWindow->setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
219 fMainWindow->setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
220 fMainWindow->setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
221 fMainWindow->setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );
223 CreateViewerWidget();
224 fMainWindow->addDockWidget(Qt::LeftDockWidgetArea, CreateUITabWidget());
225 fMainWindow->addDockWidget(Qt::BottomDockWidgetArea, CreateCoutTBWidget());
229 SetDefaultIconsToolbar();
233#ifdef G4MULTITHREADED
235 masterG4coutDestination =
this;
238 fMainWindow->setWindowTitle(QFileInfo( QCoreApplication::applicationFilePath() ).fileName());
239 fMainWindow->move(QPoint(50,50));
244 fMainWindow->resize(fUIDockWidget->width()+fCoutDockWidget->width()+20,
245 fUIDockWidget->height()+fCoutDockWidget->height()+20);
248 fCommandArea->setFocus(Qt::TabFocusReason);
252 qRegisterMetaType<QTextCursor>(
"QTextCursor");
255 AddTabWidget(fStartPage,
"Useful tips");
258 #if QT_VERSION < 0x040200
261 fMainWindow->setVisible(
false);
275#ifdef G4MULTITHREADED
276 masterG4coutDestination = 0;
282void G4UIQt::DefaultIcons(
bool aVal)
284 fDefaultIcons = aVal;
286#if QT_VERSION < 0x040200
287 if (!fMainWindow->isHidden()) {
289 if (!fMainWindow->isVisible()) {
296#if QT_VERSION < 0x040200
299 fToolbarApp->setVisible(
true);
303#if QT_VERSION < 0x040200
306 fToolbarApp->setVisible(
false);
313void G4UIQt::SetDefaultIconsToolbar(
317 if (fToolbarApp == NULL) {
318 fToolbarApp =
new QToolBar();
319 fToolbarApp->setIconSize (QSize(20,20));
320 fMainWindow->addToolBar(Qt::TopToolBarArea, fToolbarApp);
324 AddIcon(
"Open macro file",
"open",
"/control/execute");
325 AddIcon(
"Save viewer state",
"save",
"/vis/viewer/save");
328#if QT_VERSION < 0x050600
329 QSignalMapper *signalMapperViewerProperties =
new QSignalMapper(
this);
330 QAction *actionViewerProperties = fToolbarApp->addAction(QIcon(*fParamIcon),
"Viewer properties", signalMapperViewerProperties, SLOT(map()));
331 connect(signalMapperViewerProperties, SIGNAL(mapped(
int)),
this, SLOT(ViewerPropertiesIconCallback(
int)));
333 signalMapperViewerProperties->setMapping(actionViewerProperties, intVP);
335 fToolbarApp->addAction(QIcon(*fParamIcon),
"Viewer properties",
this, [=](){ this->ViewerPropertiesIconCallback(0); });
339 AddIcon(
"Move",
"move",
"");
340 AddIcon(
"Pick",
"pick",
"");
341 AddIcon(
"Zoom out",
"zoom_out",
"");
342 AddIcon(
"Zoom in",
"zoom_in",
"");
343 AddIcon(
"Rotate",
"rotate",
"");
346 AddIcon(
"Hidden line removal",
"hidden_line_removal",
"");
347 AddIcon(
"Hidden line and hidden surface removal",
"hidden_line_and_surface_removal",
"");
348 AddIcon(
"Surfaces",
"solid",
"");
349 AddIcon(
"Wireframe",
"wireframe",
"");
352 AddIcon(
"Perspective",
"perspective",
"");
353 AddIcon(
"Orthographic",
"ortho",
"");
354 AddIcon(
"Run beam on",
"runBeamOn",
"/run/beamOn 1");
359void G4UIQt::CreateIcons(
362 const char *
const save[]={
390 " +++++++++++++++++++++++++ ",
391 " +@##+$%%%%%%%%%%%%%%%&*$%&+ ",
392 " +=-;@>,,''',,,,,,,',,)&!,)+ ",
393 " +;-~@>,,,,,,,,,,,,,,,>$!,)+ ",
394 " +=-~@>,,,,,{]]]]]^,,,>*&$&+ ",
395 " +=-~@>,,,,,'{^{^^{,,,>*#=#+ ",
396 " +=-~@>,,,,,,,,,,,,,,,>@~/=+ ",
397 " +=-~@>,,,{{{''''{',,,>@~-=+ ",
398 " +=-~@>,,'^]]]]]]({,,,>@~-=+ ",
399 " +=-~@>,,,{{{{{{{{{,,,>@~-=+ ",
400 " +=-~@>,,,,,'{^{{^{,,,>@~-=+ ",
401 " +=-~@>,,,,,]]]]]]],,,>@~-=+ ",
402 " +=-~*>,,,,,,,,,,,,,,,>@~-=+ ",
403 " +=-~@>,,,,,,,,,,,,,,,>@~-=+ ",
404 " +=-/=$%%%%%%%%%%%%%%%$=/-=+ ",
405 " +=---;###############;---=+ ",
406 " +=---////////////////----=+ ",
407 " +=----------------///----=+ ",
408 " +=---=@##############@#--=+ ",
409 " +=---@+++++++++++*%))_+~-=+ ",
410 " +=---#+++++++++++&:,,>@~-=+ ",
411 " +=---#+++++++++++$',,>@~-=+ ",
412 " +=---#+++++++++++&!,,>@~-=+ ",
413 " +=/--#+++++++++++&',,>@~-=+ ",
414 " @;--#+++++++++++$',,>@~-=+ ",
415 " @;;@+++++++++++*)!>%@=;#+ ",
416 " @++++++++++++++*&**++@++ ",
421 fSaveIcon =
new QPixmap(save);
423 const char *
const search[] = {
435 "OOOOOOOOOOOOOOOOOOO",
436 "OOOOOOOOOOOOOOOOOOO",
437 "OOOOOOOo. .oOOOOOO",
440 "OOOOO. XOOOOX .OOOO",
443 "OOOOO. XOOOOo .OOOO",
447 "OOOOOOOOOOOOO. XOO",
448 "OOOOOOOOOOOOOO. XOO",
449 "OOOOOOOOOOOOOOOoOOO",
450 "OOOOOOOOOOOOOOOOOOO",
451 "OOOOOOOOOOOOOOOOOOO",
452 "OOOOOOOOOOOOOOOOOOO",
453 "OOOOOOOOOOOOOOOOOOO"
455 fSearchIcon =
new QPixmap(search);
457 const char *
const clear[] = {
469 "OOOOOOOOOOOOOOOOOOOO",
472 "OOOOOOOOOOOOOOOOOOOO",
473 "OOOOOOOOOOOOOOOOOOOO",
474 "OOOO XXXXXXXXXX OOOO",
475 "OOO XOOOOOOOOOO OOO",
476 "OOOOXOooOooOooO OOOO",
477 "OOOOXOooOooOooO OOOO",
478 "OOOOXOooOooOooO OOOO",
479 "OOOOXOooOooOooO OOOO",
480 "OOOOXOooOooOooO OOOO",
481 "OOOOXOooOooOooO OOOO",
482 "OOOOXOooOooOooO OOOO",
483 "OOOOXOooOooOooO OOOO",
484 "OOOOXOooOooOooO OOOO",
485 "OOOOXOooOooOooO OOOO",
486 "OOOOXOOOOOOOOOO OOOO",
487 "OOOOOooooooooooOOOOO",
488 "OOOOOO........OOOOOO"
491 fClearIcon =
new QPixmap(clear);
494 const char *
const open[]={
538 " {]^/((_({- %%%%%%%%%%% ",
539 " {(^_^^^^:<{{{{{{{{{{{{{[& ",
540 " {/_/(((((/]]]]]]]]]]]/]!# ",
541 " {/^(((((_^^^^^^^^^^^^^^:# ",
542 " {/^(((_^^____________^^}$ ",
543 " {/^(((((/////////////((!# ",
544 " {/^/^_:<|||||||||||||||@@****1 ",
545 " {/^/^(<[)||||||||||||||))!!}<; ",
546 " {/^_(:|234444444444444444432)1 ",
547 " {/_^/<)34444444444444444443}, ",
548 " {/^(2{:41111111111111111142|5 ",
549 " {3^3<:31111111111111111143}- ",
550 " {/^2<:31111111111111111441|' ",
551 " {_/<:41111111111111111143}, ",
552 " {(4<:31111111111111111144!# ",
553 " )4))44111111111111111144}, ",
554 " )2<:31111111111111111144{# ",
555 " @|:14444444444444444444}* ",
556 " ;@434444444444444444434<# ",
557 " ;[))))))))))))))))))))!~ ",
558 " ++++++++++++++++++++++;% ",
562 fOpenIcon =
new QPixmap(open);
565 const char *
const move[]={
598 " ')&$$$$*@@ @@*$$$$&)' ",
599 " ')&$$$$*@@ @@*$$$$&+' ",
616 fMoveIcon =
new QPixmap(move);
618 const char *
const rotate[]={
654 " --------!*{{{*&, ",
655 " -------=){*{{{>>{) ",
656 " ,!-----= ){& ,&{{@",
664 " !-!!======!!(((---! ",
665 " ='--------------! ",
680 fRotateIcon =
new QPixmap(rotate);
682 const char *
const pick[]={
698 "*********oo*********",
699 "*********oo*********",
700 "******$O. .O%******",
701 "****&o .O..O O*****",
702 "***&X @**oo**@ X****",
703 "***o $***oo***$ O***",
704 "**% @**********@ %**",
705 "**O.***********& +**",
706 "**.O*****@@*****o.**",
707 "oo .oo**@ #*&XX. oo",
708 "oo .oo**@ #*&oo. oO",
709 "**.O*****##*****oX**",
710 "**O ***********& +**",
711 "**% @****&&****+ &**",
712 "***O $***Xo***# +***",
713 "****X @&*Xo*&+ o****",
714 "*****O o..o +*****",
715 "******%+. X+&******",
716 "*********oo*********",
717 "*********oO*********"
719 fPickIcon =
new QPixmap(pick);
721 const char *
const zoom_in[]={
743 " ++.%%%+&&&*%%.++ ",
744 " .+#%%%%+&&&*%%.#+ ",
745 " ++..%%%+&&&*%%%.++ ",
746 " +#.+++++&&&*++++.+ ",
747 " @.+&&&&&&&&&&&&&+@ ",
748 " @#+&&&&&&&&&&&&&+@ ",
749 " @.+&&&&&&&&&&&&&+. ",
750 " +++@***+&&&****@+. ",
751 " ....++++&&&*++++.. ",
752 " ++.===+&&&*%=.++ ",
753 " @..==+&&&*=..@#& ",
754 " .@+#.+&&&@-+@@*@ ",
767 fZoomInIcon =
new QPixmap(zoom_in);
769 const char *
const zoom_out[]={
791 " ++.$$$$$$$$$$.++ ",
792 " .+#$$$$$$$$$$$.#+ ",
793 " ++..$$$$$$$$$$$.++ ",
794 " +#.+++++++++++++.+ ",
795 " @.+&&&&&&&&&&&&&+@ ",
796 " @#+&&&&&&&&&&&&&+@ ",
797 " @.+&&&&&&&&&&&&&+. ",
798 " +++@***********@+. ",
799 " ....++++++++++++.. ",
800 " ++.===$$$$$$=.++ ",
801 " @..===$$$$=..@#& ",
802 " .@+#.$$$..-+@@*@ ",
815 fZoomOutIcon =
new QPixmap(zoom_out);
817 const char *
const wireframe[]={
846 " +&********&@-***; ",
847 " +@@@&**&@@@@@@$ @*-&>&+ ",
848 " +*****&+ %*@ ,**'# ",
849 " @***)!~ @*{&*****+ ",
850 " @*!]***&+ +-*^**'~!*@ ",
851 " @*~ +@&**&@@@@@@&****&+ ~*@ ",
852 " @*@ +&********&-*= @*@ ",
853 " @*@ $%@-*-@$ @*@ @*@ ",
861 " @*@ =*-+ @*@ @*@ ",
862 " @*@ $%@@&****&@-*-+ @*@ ",
863 " @*@ $@&*****&@@&******&~~!*@ ",
864 " @*{/***&@@%$ $@-*-&*****+ ",
865 " @*)*)(-~ @*@ ~)**] ",
866 " +*******&@@@@+ %*_+]**] ",
867 " +@@@@@&******&@%+_*^**]# ",
876 fWireframeIcon =
new QPixmap(wireframe);
878 const char *
const solid[]={
916 " +-;>>>>>>>>>,')!~ ",
917 " {]@@-;>>>>>>>>>>>>^/(_= ",
918 " {:>>>>>>>>>>>>>>>>><//[)!= ",
919 " ]>>>>>>>>>>>>>>>>>><////[)} ",
920 " @>>>>>>>>>>>>>>>>>><//////| ",
921 " @>>>>>>>>>>>>>>>>>><//////| ",
922 " @>>>>>>>>>>>>>>>>>><//////| ",
923 " @>>>>>>>>>>>>>>>>>><//////| ",
924 " @>>>>>>>>>>>>>>>>>><//////| ",
925 " @>>>>>>>>>>>>>>>>>><//////| ",
926 " @>>>>>>>>>>>>>>>>>><//////| ",
927 " @>>>>>>>>>>>>>>>>>><//////| ",
928 " @>>>>>>>>>>>>>>>>>><//////| ",
929 " @>>>>>>>>>>>>>>>>>><//////| ",
930 " @>>>>>>>>>>>>>>>>>><//////| ",
931 " @>>>>>>>>>>>>>>>>>><//////| ",
932 " @>>>>>>>>>>>>>>>>>><//////| ",
933 " @>>>>>>>>>>>>>>>>>><//////| ",
934 " @>>>>>>>>>>>>>>>>>></////[1 ",
935 " @>>>>>>>>>>>>>>>>>><////[*2 ",
936 " {:>>>>>>>>>>>>>>>>><//[)12 ",
937 " +@@@@@-;>>>>>>>>>><[)13 ",
946 fSolidIcon =
new QPixmap(solid);
948 const char *
const hidden_line_removal[]={
968 " +#$$$$$$$$#@&$$$* ",
969 " =-@@#$$#@@@@@-= @$&#;>= ",
970 " =$$$$$#+ -$@ *$$%+ ",
971 " -$&@-= -$- #$$$= ",
987 " -$&@@@-= -$- =>;, ",
988 " =$$$$$$$#@@@-= -$'+#$$, ",
989 " =-@@@@#$$$$$$#@-+'$)$$#+ ",
998 fHiddenLineRemovalIcon =
new QPixmap(hidden_line_removal);
1000 const char *
const hidden_line_and_surface_removal[]={
1046 " ++@%####&*=-#+;>, ",
1047 " +++++@'=)))))))!)~+{]^++ ",
1048 " +$%&*=)!!!!!!!!!)~+/(]_+++ ",
1049 " +#-))!!!!!!!!!!!)~+/(::<[+ ",
1050 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1051 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1052 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1053 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1054 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1055 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1056 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1057 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1058 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1059 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1060 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1061 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1062 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1063 " +#)!!!!!!!!!!!!!!}+/:::|1+ ",
1064 " +$#}}~23!!!!!!!!)~+/(]45, ",
1065 " +++++++@#}}~23!!)~+678++ ",
1066 " ++++++@#~90+a++ ",
1075 fHiddenLineAndSurfaceRemovalIcon =
new QPixmap(hidden_line_and_surface_removal);
1077 const char *
const perspective[]={
1087 " ................ ",
1088 " ....+++++++++++++++. ",
1089 " ...++++..+.........+++. ",
1090 " ..++..............++..+. ",
1091 " .+++++++++++++++++.. .+. ",
1092 " .+...............+. .+. ",
1093 " .+. .+. .+. .+. ",
1094 " .+. .+. .+. .+. ",
1095 " .+. .+. .+. .+. ",
1096 " .+. .+. .+. .+. ",
1097 " .+. .+. .+. .+. ",
1098 " .+. .+. .+. .+. ",
1099 " .+. .+. .+. .+. ",
1100 " .+. .+. .+. .+. ",
1101 " .+. .+......+....+. ",
1102 " .+. ..++++++.+.++++. ",
1103 " .+. .++.......+...+.. ",
1104 " .+. .++. .+..++. ",
1105 " .+. ..+.. .+..+. ",
1108 " .+++.............++. ",
1109 " .+++++++++++++++++. ",
1110 " ................... ",
1115 fPerspectiveIcon =
new QPixmap(perspective);
1117 const char *
const ortho[]={
1125 " ................... ",
1126 " ..@@@@@@@@@@@@@@@@@. ",
1127 " ..@@@.............@@@. ",
1128 " ..@@.@. ..@..@. ",
1129 " ..@@ ..@. .@@...@. ",
1130 " ..@@..............@@.. .@. ",
1131 " .@@@@@@@@@@@@@@@@@.. .@. ",
1132 " .@...............@. .@. ",
1133 " .@. .@. .@. .@. ",
1134 " .@. .@. .@. .@. ",
1135 " .@. .@. .@. .@. ",
1136 " .@. .@. .@. .@. ",
1137 " .@. .@. .@. .@. ",
1138 " .@. .@. .@. .@. ",
1139 " .@. .@. .@. .@. ",
1140 " .@. .@. .@. .@. ",
1141 " .@. .@. .@. .@. ",
1142 " .@. .@. .@. .@. ",
1143 " .@. .@........@......@. ",
1144 " .@. .@@@@@@@@@.@.@@@@@@. ",
1145 " .@. .@@+........@....@@.. ",
1146 " .@...@. .@...@... ",
1148 " .@@@.............@@@.. ",
1149 " .@@@@@@@@@@@@@@@@@... ",
1150 " ................... ",
1155 fOrthoIcon =
new QPixmap(ortho);
1157 const char *
const commandIcon[]={
1185 "66666666666666666666",
1186 "66%++++++++++++++&56",
1187 "6$ o..o......o..o *6",
1188 "6+o...o*<441;@.o..+6",
1189 "6+..o@1553<354$..o+6",
1190 "6+..o<5<@ .*54#o.+6",
1199 "6+..O25<@ X=54#o.+6",
1200 "6+.o.@1553<354$...@6",
1201 "6+o..oo*<44<;@o..o+6",
1202 "6$ .o..o.....o..o *6",
1203 "66%+++++OOOO+++++*66",
1204 "66666666666666666666"
1206 fCommandIcon =
new QPixmap(commandIcon);
1208 const char *
const dirIcon[]={
1236 "66666666666666666666",
1237 "66$oOOOOOOOOOOOOo%66",
1240 "6o =635533666$ o6",
1241 "6o -65:+ +165X o6",
1250 "6o -65:+ @265X o6",
1251 "6o =635543665# O6",
1254 "66$OOOoo....OOOOo%66",
1255 "66666666666666666666"}
1257 fDirIcon =
new QPixmap(dirIcon);
1260 const char *
const runIcon[]={
1297 "rrrrrrrr%<<2rrrrrrrr",
1298 "rrrrr5=$$$$===rrrrrr",
1299 "rrrr<##$$$$$---&rrrr",
1300 "rrr=###$$$$-----%rrr",
1301 "rr=####$$$$------&rr",
1302 "r2@####7##$-------rr",
1303 "r.@####048$-------Or",
1305 " .@@###w4eee5%$#@@@X",
1306 " .@@@..w4eeeeqo..@@X",
1308 " ..oooOe2eee6OOOooo ",
1309 "rOooOO+e2ew2+++++O+r",
1310 "r:oO+++e30,;;;;;++Or",
1311 "r :++;:9,>,,>>:;;1rr",
1312 "rr*1;:>,333333,>32rr",
1313 "rrr66,1367777637<rrr",
1314 "rrrr509799999905rrrr",
1315 "rrrrr=8wqwwww8-rrrrr",
1316 "rrrrrrrr4444rrrrrrrr"
1318 fRunIcon =
new QPixmap(runIcon);
1320 const char *
const paramIcon[]={
1359 "wwwwwwww5 5wwwwwwww",
1360 "wwwwwwww, ,wwwwwwww",
1361 "www&;ww7+ +9ww=-www",
1367 "5<+ .wwwwwww0. +<5",
1370 "5<+ .wwwwwww0X +<5",
1376 "www*>ww7+ +7ww=:www",
1377 "wwwwwwww1 1wwwwwwww",
1378 "wwwwwwww5 5wwwwwwww"
1380 fParamIcon =
new QPixmap(paramIcon);
1387QWidget* G4UIQt::CreateHistoryTBWidget(
1390 fHistoryTBWidget =
new QWidget();
1392 QVBoxLayout *layoutHistoryTB =
new QVBoxLayout();
1393 fHistoryTBTableList =
new QListWidget();
1394 fHistoryTBTableList->setSelectionMode(QAbstractItemView::SingleSelection);
1395 connect(fHistoryTBTableList, SIGNAL(itemSelectionChanged()), SLOT(CommandHistoryCallback()));
1397 layoutHistoryTB->addWidget(fHistoryTBTableList);
1399 fHistoryTBWidget->setLayout(layoutHistoryTB);
1400 return fHistoryTBWidget;
1406QWidget* G4UIQt::CreateHelpTBWidget(
1409 fHelpTBWidget =
new QWidget();
1411 QWidget *helpWidget =
new QWidget();
1412 QHBoxLayout *helpLayout =
new QHBoxLayout();
1413 QVBoxLayout *vLayout =
new QVBoxLayout();
1414 fHelpVSplitter =
new QSplitter(Qt::Vertical);
1415 fHelpLine =
new QLineEdit();
1416 helpLayout->addWidget(
new QLabel(
"Search :"));
1417 helpLayout->addWidget(fHelpLine);
1418 connect( fHelpLine, SIGNAL( editingFinished () ),
this, SLOT( LookForHelpStringCallback() ) );
1423 fParameterHelpLabel =
new QTextEdit();
1424 fParameterHelpLabel->setReadOnly(
true);
1425 fParameterHelpTable =
new QTableWidget();
1429 if (fHelpTreeWidget) {
1430 fHelpVSplitter->addWidget(fHelpTreeWidget);
1432 fHelpVSplitter->addWidget(fParameterHelpLabel);
1433 fHelpVSplitter->addWidget(fParameterHelpTable);
1435 fParameterHelpLabel->setVisible(
false);
1436 fParameterHelpTable->setVisible(
false);
1437 QSizePolicy policy = QSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
1438 policy.setVerticalStretch(4);
1439 if (fHelpTreeWidget) {
1440 fHelpTreeWidget->setSizePolicy(policy);
1442 policy = QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
1443 policy.setVerticalStretch(1);
1444 fParameterHelpLabel->setSizePolicy(policy);
1445 fParameterHelpTable->setSizePolicy(policy);
1447 vLayout->addWidget(helpWidget);
1448 vLayout->addWidget(fHelpVSplitter,1);
1449 vLayout->setContentsMargins(5,5,5,5);
1451 helpWidget->setLayout(helpLayout);
1452 fHelpTBWidget->setLayout(vLayout);
1454 return fHelpTBWidget;
1460G4UIDockWidget* G4UIQt::CreateCoutTBWidget(
1463 QWidget* coutTBWidget =
new QWidget();
1465 QVBoxLayout *layoutCoutTB =
new QVBoxLayout();
1467 fCoutTBTextArea =
new QTextEdit();
1469 fCoutFilter =
new QLineEdit();
1470 fCoutFilter->setToolTip(
"Filter output by...");
1472#if QT_VERSION > 0x050100
1473 fCoutFilter->addAction(*fSearchIcon,QLineEdit::TrailingPosition);
1474 fCoutFilter->setStyleSheet (
"border-radius:7px;");
1476 QPushButton *coutTBFilterButton =
new QPushButton();
1477 coutTBFilterButton->setIcon(QIcon(*fSearchIcon));
1478 coutTBFilterButton->setStyleSheet (
"padding-left: 0px; border:0px;");
1479 fCoutFilter->setStyleSheet (
"padding-right: 0px;");
1482 QPushButton *coutTBClearButton =
new QPushButton();
1483 coutTBClearButton->setIcon(*fClearIcon);
1484 coutTBClearButton->setToolTip(
"Clear console output");
1485 coutTBClearButton->setStyleSheet (
"border-radius:7px;");
1486 connect(coutTBClearButton, SIGNAL(clicked()), SLOT(ClearButtonCallback()));
1487 connect(fCoutFilter, SIGNAL(textEdited (
const QString &)), SLOT(CoutFilterCallback(
const QString &)));
1489 QPushButton *coutTBSaveOutputButton =
new QPushButton();
1490 coutTBSaveOutputButton->setIcon(*fSaveIcon);
1491 coutTBSaveOutputButton->setToolTip(
"Save console output");
1492 coutTBSaveOutputButton->setStyleSheet (
"border-radius:7px;");
1493 connect(coutTBSaveOutputButton, SIGNAL(clicked()), SLOT(SaveOutputCallback()));
1495 fCoutTBTextArea->setReadOnly(
true);
1497 QWidget* coutButtonWidget =
new QWidget();
1498 QHBoxLayout* layoutCoutTBButtons =
new QHBoxLayout();
1500#ifdef G4MULTITHREADED
1502 fThreadsFilterComboBox =
new QComboBox();
1503 fThreadsFilterComboBox->setInsertPolicy(QComboBox::InsertAlphabetically);
1504 connect(fThreadsFilterComboBox, SIGNAL(activated(
int)),
this, SLOT(ThreadComboBoxCallback(
int)));
1506 UpdateCoutThreadFilter();
1508 fThreadsFilterComboBox->setToolTip(
"Thread selection in output");
1509 layoutCoutTBButtons->addWidget(
new QLabel(
" Threads:"));
1510 layoutCoutTBButtons->addWidget(fThreadsFilterComboBox);
1513 layoutCoutTBButtons->addWidget(fCoutFilter);
1514#if QT_VERSION <= 0x050100
1515 layoutCoutTBButtons->addWidget(coutTBFilterButton);
1517 layoutCoutTBButtons->addWidget(coutTBClearButton);
1518 layoutCoutTBButtons->addWidget(coutTBSaveOutputButton);
1519 coutButtonWidget->setLayout(layoutCoutTBButtons);
1522 layoutCoutTBButtons->setContentsMargins(3,3,3,0);
1524 layoutCoutTB->addWidget(coutButtonWidget);
1525 layoutCoutTB->addWidget(fCoutTBTextArea);
1527 coutTBWidget->setLayout(layoutCoutTB);
1529 fCoutTBTextArea->setMinimumSize(100,100);
1532 QWidget* commandLineWidget =
new QWidget();
1533 QHBoxLayout *layoutCommandLine =
new QHBoxLayout();
1537 fCommandLabel =
new QLabel(
"");
1538 fCommandArea =
new QLineEdit();
1542 fCommandArea->activateWindow();
1544 fCommandArea->setFocusPolicy ( Qt::StrongFocus );
1545 fCommandArea->setFocus(Qt::TabFocusReason);
1546 fCommandArea->setToolTip(
"Apply command");
1549 layoutCommandLine->addWidget(fCommandLabel);
1550 layoutCommandLine->addWidget(fCommandArea);
1553 connect(fCommandArea, SIGNAL(returnPressed()), SLOT(CommandEnteredCallback()));
1554 connect(fCommandArea, SIGNAL(textEdited(
const QString &)), SLOT(CommandEditedCallback(
const QString &)));
1557 commandLineWidget->setLayout(layoutCommandLine);
1558 commandLineWidget->setMinimumSize(50,50);
1560 layoutCoutTB->addWidget(commandLineWidget);
1562 fCoutDockWidget =
new G4UIDockWidget (
"Output");
1563 fCoutDockWidget->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
1565 fCoutDockWidget->setWidget(coutTBWidget);
1566 return fCoutDockWidget;
1572QWidget* G4UIQt::CreateVisParametersTBWidget(
1581G4UIDockWidget* G4UIQt::CreateUITabWidget(
1584 fUITabWidget =
new QTabWidget();
1587 fUITabWidget->addTab(CreateSceneTreeWidget(),
"Scene tree");
1588 fUITabWidget->addTab(CreateHelpTBWidget(),
"Help");
1589 fUITabWidget->addTab(CreateHistoryTBWidget(),
"History");
1590 fUITabWidget->setCurrentWidget(fHelpTBWidget);
1592 fUITabWidget->setTabToolTip (0,
"Scene component tree. Only available in Stored mode");
1593 fUITabWidget->setTabToolTip (1,
"Help widget");
1594 fUITabWidget->setTabToolTip (2,
"All commands history");
1595 connect(fUITabWidget, SIGNAL(currentChanged(
int)), SLOT(ToolBoxActivated(
int)));
1597 fUIDockWidget =
new G4UIDockWidget (
"Scene tree, Help, History");
1598 fUIDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
1600 fUIDockWidget->setWidget(fUITabWidget);
1602 return fUIDockWidget;
1606QWidget* G4UIQt::CreateSceneTreeWidget(){
1608 fSceneTreeWidget =
new QWidget();
1609 QVBoxLayout* layout =
new QVBoxLayout();
1610 fSceneTreeWidget->setLayout(layout);
1612#if QT_VERSION < 0x040200
1613 fSceneTreeWidget->hide();
1615 fSceneTreeWidget->setVisible(
false);
1618 return fSceneTreeWidget;
1622void G4UIQt::CreateViewerWidget(){
1626 SetStartPage(std::string(
"<table width='100%'><tr><td width='30%'></td><td><div ")+
1627 "style='color: rgb(140, 31, 31); font-size: xx-large; font-family: Garamond, serif; padding-bottom: 0px; font-weight: normal'>Geant4: "+
1628 QApplication::applicationName ().toStdString()+
1629 "</div></td><td width='40%'> <br/><i>http://cern.ch/geant4/</i></td></tr></table>"+
1631 "<div style='background:#EEEEEE;'><b>Tooltips :</b><ul>"+
1632 "<li><b>Start a new viewer :</b><br />"+
1633 "<i>'/vis/open/...'<br />"+
1634 "For example '/vis/open OGL'</i></li>"+
1635 "<li><b>Execute a macro file :</b><br />"+
1636 "<i>'/control/execute my_macro_file'</i></li>"+
1639 "<div style='background:#EEEEEE;'><b>Documentation :</b><ul>"+
1640 "<li><b>Visualisation publication :</b><br />"+
1641 "<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>"+
1644 "<div style='background:#EEEEEE;'><b>Getting Help :</b><ul>"+
1645 "<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"+
1646 "<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>"+
1652 if (fViewerTabWidget == NULL) {
1653 fViewerTabWidget =
new G4QTabWidget();
1654 fMainWindow->setCentralWidget(fViewerTabWidget);
1655#if QT_VERSION < 0x040500
1657 fViewerTabWidget->setTabsClosable (
true);
1660#if QT_VERSION < 0x040200
1662 fViewerTabWidget->setUsesScrollButtons (
true);
1665#if QT_VERSION < 0x040500
1667 connect(fViewerTabWidget, SIGNAL(tabCloseRequested(
int)),
this, SLOT(TabCloseCallback(
int)));
1669 connect(fViewerTabWidget, SIGNAL(currentChanged (
int ) ), SLOT(UpdateTabWidget(
int)));
1673 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
1674 policy.setVerticalStretch(4);
1675 fViewerTabWidget->setSizePolicy(policy);
1677 fViewerTabWidget->setMinimumSize(40,40);
1683QWidget* G4UIQt::GetSceneTreeWidget(
1686 return fSceneTreeWidget;
1691QWidget* G4UIQt::GetViewerPropertiesWidget(
1694 if (!fViewerPropertiesDialog) {
1695 CreateViewerPropertiesDialog();
1697 return fViewerPropertiesWidget;
1702QWidget* G4UIQt::GetPickInfosWidget(
1705 if (!fPickInfosDialog) {
1706 CreatePickInfosDialog();
1708 return fPickInfosWidget;
1714bool G4UIQt::AddViewerTab(
1719 if (fViewerTabWidget == NULL) {
1722 fViewerTabWidget->addTab(aWidget,title.c_str());
1730bool G4UIQt::AddViewerTabFromFile(
1731 std::string fileName
1735 if (fViewerTabWidget == NULL) {
1740 if(UI==NULL)
return 0;
1744 std::string content( (std::istreambuf_iterator<char>(file) ),
1745 (std::istreambuf_iterator<char>() ) );
1747 QTextEdit* text =
new QTextEdit();
1748 text->setAcceptRichText (
true);
1749 text->setContentsMargins(5,5,5,5);
1750 text->setText(QString(
"<pre>")+content.c_str()+
"</pre>");
1751 text->setReadOnly(
true);
1752 fViewerTabWidget->addTab(text,title.c_str());
1763bool G4UIQt::AddTabWidget(
1774 #if QT_VERSION < 0x050100
1775 #if QT_VERSION >= 0x050000
1776 QString message = QString(
1777 "This Qt version [")+qVersion ()+
"] has some issues with the OpenGL viewer.\n"+
1778 "To prevent problems, you are not allowed to open a Stored nor Immediate viewer.\n" +
1780 "Please upgrade to Qt version >= 5.1\n";
1782 QMessageBox::warning(fMainWindow, tr(
"Warning"),
1783 tr(message.toStdString().c_str()),
1790 if (fViewerTabWidget == NULL) {
1791 CreateViewerWidget();
1798 aWidget->setParent(fViewerTabWidget);
1801 fViewerTabWidget->addTab(aWidget,name);
1803 fViewerTabWidget->setCurrentIndex(fViewerTabWidget->count()-1);
1806 #if QT_VERSION < 0x040200
1807 fViewerTabWidget->setLastTabCreated(fViewerTabWidget->currentIndex());
1809 fViewerTabWidget->setLastTabCreated(fViewerTabWidget->currentIndex());
1820void G4UIQt::SetStartPage(
1821const std::string& text)
1824 fDefaultViewerFirstPageHTMLText = text;
1827 fStartPage =
new QTextEdit();
1828 fStartPage->setAcceptRichText (
true);
1829 fStartPage->setContentsMargins(5,5,5,5);
1830 fStartPage->setReadOnly(
true);
1832 fStartPage->setText(fDefaultViewerFirstPageHTMLText.c_str());
1836void G4UIQt::UpdateTabWidget(
int tabNumber) {
1837 if ( fViewerTabWidget == NULL) {
1838 fViewerTabWidget =
new G4QTabWidget;
1841 fViewerTabWidget->setCurrentIndex(tabNumber);
1844 fViewerTabWidget->setTabSelected(
false);
1846 #if QT_VERSION < 0x040200
1847 fViewerTabWidget->show();
1849 fViewerTabWidget->setVisible(
true);
1853 fViewerTabWidget->setTabSelected(
true);
1859void G4UIQt::ResizeTabWidget( QResizeEvent* e) {
1860 if ( fViewerTabWidget) {
1861 for (
G4int a=0;a<fViewerTabWidget->count() ;a++) {
1862 fViewerTabWidget->widget(a)->resize(e->size());
1873 G4Qt* interactorManager = G4Qt::getInstance ();
1874 Prompt(
"Session :");
1875 exitSession =
false;
1877 QCoreApplication::sendPostedEvents () ;
1879 #if QT_VERSION < 0x040200
1880 fMainWindow->show();
1882 fMainWindow->setVisible(
true);
1885 if (fDefaultIcons) {
1886#if QT_VERSION < 0x040200
1887 fToolbarApp->show();
1889 fToolbarApp->setVisible(
true);
1893#if QT_VERSION < 0x040200
1894 fToolbarApp->hide();
1896 fToolbarApp->setVisible(
false);
1903 UpdateCommandCompleter();
1906 fHistoryTBTableList->installEventFilter(
this);
1907 fCommandArea->installEventFilter(
this);
1910 fCommandArea->setFocus();
1912 interactorManager->DisableSecondaryLoop ();
1913 if ((QApplication*)interactorManager->GetMainInteractor())
1914 ((QApplication*)interactorManager->GetMainInteractor())->exec();
1916 interactorManager->EnableSecondaryLoop ();
1924void G4UIQt::Prompt (
1928 if (!aPrompt)
return;
1930 fCommandLabel->setText((
char*)aPrompt.
data());
1935void G4UIQt::SessionTerminate (
1938 G4Qt* interactorManager = G4Qt::getInstance ();
1939 fMainWindow->close();
1940 ((QApplication*)interactorManager->GetMainInteractor())->exit();
1953void G4UIQt::PauseSessionStart (
1957 if (!aState)
return;
1959 if(aState==
"G4_pause> ") {
1960 SecondaryLoop (
"Pause, type continue to exit this state");
1963 if(aState==
"EndOfEvent") {
1965 SecondaryLoop (
"End of event, type continue to exit this state");
1975void G4UIQt::SecondaryLoop (
1979 if (!aPrompt)
return;
1981 G4Qt* interactorManager = G4Qt::getInstance ();
1985 ((QApplication*)interactorManager)->processEvents(QEventLoop::WaitForMoreEvents);
1986 if(exitPause==
true)
break;
1988 Prompt(
"Session :");
1991#ifdef G4MULTITHREADED
2005G4int G4UIQt::ReceiveG4cout (
2009 if (!aString)
return 0;
2011#ifdef G4MULTITHREADED
2017 if (aString.
contains(
"*** This is just a warning message. ***")) {
2018 return ReceiveG4cerr(aString);
2023#ifdef G4MULTITHREADED
2026 std::cout << aString;
2031 G4UIOutputString txt = G4UIOutputString(QString((
char*)aString.data()).trimmed(),GetThreadPrefix());
2032 fG4OutputString.push_back(txt);
2034#ifdef G4MULTITHREADED
2035 QString result = FilterOutput(txt,fThreadsFilterComboBox->currentText(),fCoutFilter->text());
2037 QString result = FilterOutput(txt,
"",fCoutFilter->text());
2040 if (result.isEmpty()) {
2043 fCoutTBTextArea->append(result);
2044 fCoutTBTextArea->ensureCursorVisible ();
2046#ifdef G4MULTITHREADED
2047 UpdateCoutThreadFilter();
2051 fLastErrMessage = aString;
2061G4int G4UIQt::ReceiveG4cerr (
2065 if (!aString)
return 0;
2067#ifdef G4MULTITHREADED
2073#ifdef G4MULTITHREADED
2076 std::cerr << aString;
2082 G4UIOutputString txt = G4UIOutputString(QString((
char*)aString.data()).trimmed(),
2085 fG4OutputString.push_back(txt);
2087#ifdef G4MULTITHREADED
2088 QString result = FilterOutput(txt,fThreadsFilterComboBox->currentText(),fCoutFilter->text());
2090 QString result = FilterOutput(txt,
"",fCoutFilter->text());
2092 if (result.isEmpty()) {
2097 if (QString(aString.data()).trimmed() !=
"") {
2101 fLastErrMessage +=
"\n"+aString;
2102 QString criticalMessage = fLastErrMessage.data();
2103#if QT_VERSION < 0x050000
2104 criticalMessage = Qt::escape(criticalMessage);
2106 criticalMessage = criticalMessage.toHtmlEscaped();
2108 QMessageBox::critical(fMainWindow,
"Error",QString(fLastErrMessage));
2111 fCoutTBTextArea->append(QString(
"<font color=\"Red\">") +
2112 result + QString(
"</font>"));
2113 fCoutTBTextArea->ensureCursorVisible ();
2115 if (QString(aString.data()).trimmed() !=
"") {
2116 fLastErrMessage += aString;
2118#ifdef G4MULTITHREADED
2119 UpdateCoutThreadFilter();
2125G4String G4UIQt::GetThreadPrefix() {
2127#ifdef G4MULTITHREADED
2129 if(UI==NULL)
return "";
2137 return threadPrefix;
2141#ifdef G4MULTITHREADED
2142void G4UIQt::UpdateCoutThreadFilter() {
2144 if(UI==NULL)
return;
2147 if (fThreadsFilterComboBox->count() < 2) {
2148 if ( fThreadsFilterComboBox->findText(
"All", Qt::MatchExactly) == -1) {
2149 fThreadsFilterComboBox->addItem(
"All");
2152 if (fThreadsFilterComboBox->count() < 2) {
2153 if ( fThreadsFilterComboBox->findText(
"Master", Qt::MatchExactly) == -1) {
2154 fThreadsFilterComboBox->addItem(
"Master");
2160 if ( fThreadsFilterComboBox->findText(
prefix.data(), Qt::MatchExactly) == -1) {
2161 fThreadsFilterComboBox->addItem(
prefix.data());
2173void G4UIQt::AddMenu (
2178 if (aName == NULL)
return;
2179 if (aLabel == NULL)
return;
2181 QMenu *fileMenu =
new QMenu(aLabel);
2182 fMainWindow->menuBar()->addMenu(fileMenu);
2194void G4UIQt::AddButton (
2197,
const char* aCommand
2200 if(aMenu==NULL)
return;
2201 if(aLabel==NULL)
return;
2202 if(aCommand==NULL)
return;
2204 QMenu *parentTmp = (QMenu*)GetInteractor(aMenu);
2206 if(parentTmp==NULL) {
2211 G4cout <<
"Menu name " << aMenu<<
" does not exist, please define it before using it."<<
G4endl;
2218 if(UI==NULL)
return;
2222 G4int cmdEndPos = cmd.find_first_of(
" \t");
2223 if(cmdEndPos!=
G4int(std::string::npos)) {
2224 cmd.erase(cmdEndPos);
2227 if(treeTop->
FindPath(cmd) == NULL) {
2229 cmd(0,3) !=
"ls " &&
2232 cmd(0,3) !=
"cd " &&
2234 cmd(0,5) !=
"help " &&
2246 G4cout <<
"Warning: command '"<< cmd <<
"' does not exist, please define it before using it."<<
G4endl;
2251#if QT_VERSION < 0x050600
2252 QSignalMapper *signalMapper =
new QSignalMapper(
this);
2253 QAction *action = parentTmp->addAction(aLabel, signalMapper, SLOT(map()));
2255 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ButtonCallback(
const QString&)));
2256 signalMapper->setMapping(action, QString(aCommand));
2258 QString cmd_tmp = QString(aCommand);
2259 parentTmp->addAction(aLabel,
this, [=](){ this->ButtonCallback(cmd_tmp); });
2269void G4UIQt::AddIcon(
const char* aLabel,
const char* aIconFile,
const char* aCommand,
const char* aFileName){
2270 if(aLabel==NULL)
return;
2272 if (aCommand==NULL) {
2273 if (std::string(aIconFile) ==
"user_icon") {
2278 bool userToolBar =
false;
2280 if (!fDefaultIcons) {
2283 if (std::string(aIconFile) ==
"user_icon") {
2287 if (pix->isNull()) {
2291 G4cout <<
"Warning: file '"<< aFileName <<
"' is incorrect or does not exist, this command will not be build"<<
G4endl;
2295 }
else if (std::string(aIconFile) ==
"open") {
2297 }
else if (std::string(aIconFile) ==
"save") {
2299 }
else if (std::string(aIconFile) ==
"move") {
2301 }
else if (std::string(aIconFile) ==
"rotate") {
2303 }
else if (std::string(aIconFile) ==
"pick") {
2305 }
else if (std::string(aIconFile) ==
"zoom_in") {
2307 }
else if (std::string(aIconFile) ==
"zoom_out") {
2309 }
else if (std::string(aIconFile) ==
"wireframe") {
2310 pix = fWireframeIcon;
2311 }
else if (std::string(aIconFile) ==
"solid") {
2313 }
else if (std::string(aIconFile) ==
"hidden_line_removal") {
2314 pix = fHiddenLineRemovalIcon;
2315 }
else if (std::string(aIconFile) ==
"hidden_line_and_surface_removal") {
2316 pix = fHiddenLineAndSurfaceRemovalIcon;
2317 }
else if (std::string(aIconFile) ==
"perspective") {
2318 pix = fPerspectiveIcon;
2319 }
else if (std::string(aIconFile) ==
"ortho") {
2321 }
else if (std::string(aIconFile) ==
"runBeamOn") {
2328 G4cout <<
"Parameter"<< aIconFile <<
" not defined"<<
G4endl;
2332 QToolBar *currentToolbar = NULL;
2334 if (fToolbarUser == NULL) {
2335 fToolbarUser =
new QToolBar();
2336 fToolbarUser->setIconSize (QSize(20,20));
2337 fMainWindow->addToolBar(Qt::TopToolBarArea, fToolbarUser);
2339 currentToolbar = fToolbarUser;
2341 if (fToolbarApp == NULL) {
2342 fToolbarApp =
new QToolBar();
2343 fToolbarApp->setIconSize (QSize(20,20));
2344 fMainWindow->addToolBar(Qt::TopToolBarArea, fToolbarApp);
2346 currentToolbar = fToolbarApp;
2351 QList<QAction*> list = currentToolbar->actions();
2353 for (
int i = 0; i < list.size(); ++i) {
2354 if (list.at(i)->text() == QString(aLabel)) {
2356 if(UI==NULL)
return;
2359 G4cout <<
"Warning: A toolBar icon \""<< aLabel<<
"\" already exists with the same name!" <<
G4endl;
2364#if QT_VERSION < 0x050600
2365 QSignalMapper *signalMapper =
new QSignalMapper(
this);
2366 QAction *action = currentToolbar->addAction(QIcon(*pix),aLabel, signalMapper, SLOT(map()));
2369 if (std::string(aIconFile) ==
"open") {
2370 QString txt = aCommand + fStringSeparator + aLabel;
2371#if QT_VERSION < 0x050600
2372 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(OpenIconCallback(
const QString &)));
2373 signalMapper->setMapping(action, QString(txt));
2375 currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [=](){ this->OpenIconCallback(txt); });
2379 }
else if (std::string(aIconFile) ==
"save") {
2380 QString txt = aCommand + fStringSeparator + aLabel;
2381#if QT_VERSION < 0x050600
2382 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(SaveIconCallback(
const QString&)));
2383 signalMapper->setMapping(action, QString(txt));
2385 currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [=](){ this->SaveIconCallback(txt); });
2389 }
else if ((std::string(aIconFile) ==
"move") ||
2390 (std::string(aIconFile) ==
"rotate") ||
2391 (std::string(aIconFile) ==
"pick") ||
2392 (std::string(aIconFile) ==
"zoom_out") ||
2393 (std::string(aIconFile) ==
"zoom_in")) {
2394#if QT_VERSION < 0x050600
2395 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ChangeCursorAction(
const QString&)));
2396 signalMapper->setMapping(action, QString(aIconFile));
2398 QString txt = QString(aIconFile);
2399 QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [=](){ this->ChangeCursorAction(txt); });
2401 action->setCheckable(
TRUE);
2402 action->setChecked(
TRUE);
2403 action->setData(aIconFile);
2405 if (std::string(aIconFile) ==
"move") {
2406 SetIconMoveSelected();
2408 if (std::string(aIconFile) ==
"rotate") {
2409 SetIconRotateSelected();
2411 if (std::string(aIconFile) ==
"pick") {
2412 SetIconPickSelected();
2414 if (std::string(aIconFile) ==
"zoom_in") {
2415 SetIconZoomInSelected();
2417 if (std::string(aIconFile) ==
"zoom_out") {
2418 SetIconZoomOutSelected();
2422 }
else if ((std::string(aIconFile) ==
"hidden_line_removal") ||
2423 (std::string(aIconFile) ==
"hidden_line_and_surface_removal") ||
2424 (std::string(aIconFile) ==
"solid") ||
2425 (std::string(aIconFile) ==
"wireframe")) {
2426#if QT_VERSION < 0x050600
2427 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ChangeSurfaceStyle(
const QString&)));
2428 signalMapper->setMapping(action, QString(aIconFile));
2430 QString txt = QString(aIconFile);
2431 QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [=](){ this->ChangeSurfaceStyle(txt); });
2433 action->setCheckable(
TRUE);
2434 action->setChecked(
TRUE);
2435 action->setData(aIconFile);
2437 if (std::string(aIconFile) ==
"hidden_line_removal") {
2438 SetIconHLRSelected();
2440 if (std::string(aIconFile) ==
"hidden_line_and_surface_removal") {
2441 SetIconHLHSRSelected();
2443 if (std::string(aIconFile) ==
"solid") {
2444 SetIconSolidSelected();
2446 if (std::string(aIconFile) ==
"wireframe") {
2447 SetIconWireframeSelected();
2451 }
else if ((std::string(aIconFile) ==
"perspective") ||
2452 (std::string(aIconFile) ==
"ortho")) {
2453#if QT_VERSION < 0x050600
2454 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ChangePerspectiveOrtho(
const QString&)));
2455 signalMapper->setMapping(action, QString(aIconFile));
2457 QString txt = QString(aIconFile);
2458 QAction* action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [=](){ this->ChangePerspectiveOrtho(txt); });
2460 action->setCheckable(
TRUE);
2461 action->setChecked(
TRUE);
2462 action->setData(aIconFile);
2464 if (std::string(aIconFile) ==
"perspective") {
2465 SetIconPerspectiveSelected();
2467 if (std::string(aIconFile) ==
"ortho") {
2468 SetIconOrthoSelected();
2475 if(UI==NULL)
return;
2477 if (aCommand != NULL) {
2478 std::string str = aCommand;
2479 std::string::size_type
pos = str.find(
" ");
2480 if (pos != std::string::npos)
2482 str = str.substr(0,pos).c_str();
2484 if(treeTop->
FindPath(str.c_str()) == NULL) {
2489 G4cout <<
"Warning: command '"<< aCommand <<
"' does not exist, please define it before using it."<<
G4endl;
2494#if QT_VERSION < 0x050600
2495 connect(signalMapper, SIGNAL(mapped(
const QString &)),
this, SLOT(ButtonCallback(
const QString&)));
2496 signalMapper->setMapping(action, QString(aCommand));
2498 QString txt = QString(aCommand);
2499 currentToolbar->addAction(QIcon(*pix), aCommand,
this, [=](){ this->ButtonCallback(txt); });
2506void G4UIQt::ActivateCommand(
2510 if (!fHelpTreeWidget) {
2514 size_t i = newCommand.
index(
" ");
2516 if( i != std::string::npos )
2518 G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
2520 targetCom = ModifyToFullPathCommand( newValue );
2522 if (targetCom !=
"") {
2523 OpenHelpTreeOnCommand(targetCom.
data());
2526 fUITabWidget->setCurrentWidget(fHelpTBWidget);
2537void G4UIQt::InitHelpTreeAndVisParametersWidget()
2540 if (! fHelpTreeWidget ) {
2541 fHelpTreeWidget =
new QTreeWidget();
2545 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
2547 labels << QString(
"Command");
2548 fHelpTreeWidget->setHeaderLabels(labels);
2551 connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),
this, SLOT(HelpTreeClicCallback()));
2552 connect(fHelpTreeWidget, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,
int)),
this, SLOT(HelpTreeDoubleClicCallback()));
2561void G4UIQt::FillHelpTree()
2563 if (! fHelpTreeWidget ) {
2564 InitHelpTreeAndVisParametersWidget();
2567 QString searchText = fHelpLine->text();
2569 if (searchText ==
"") {
2576 if (fParameterHelpLabel) {
2577 fParameterHelpLabel->setText(
"Choose a command in the command tree");
2578 fParameterHelpTable->setVisible(
false);
2582#if QT_VERSION < 0x040200
2585 fHelpLine->setText(
"");
2590 if(UI==NULL)
return;
2594 QTreeWidgetItem * newItem = NULL;
2595 QString commandText =
"";
2596 for (
int a=0;a<treeSize;a++) {
2600 commandText = QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()).trimmed();
2603 for (
int b=0;b<fHelpTreeWidget->topLevelItemCount();b++) {
2605 newItem = FindTreeItem(fHelpTreeWidget->topLevelItem(b),commandText);
2608 if (newItem == NULL) {
2610 newItem =
new QTreeWidgetItem();
2611 newItem->setText(0,GetShortCommandPath(commandText));
2612 fHelpTreeWidget->addTopLevelItem(newItem);
2616 CreateHelpTree(newItem,treeTop->
GetTree(a+1));
2627void G4UIQt::CreateHelpTree(
2628 QTreeWidgetItem *aParent
2632 if (aParent == NULL)
return;
2633 if (aCommandTree == NULL)
return;
2637 QTreeWidgetItem * newItem;
2639 QString commandText =
"";
2643 commandText = QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()).trimmed();
2646 newItem = FindTreeItem(aParent,commandText);
2647 if (newItem == NULL) {
2648 newItem =
new QTreeWidgetItem();
2649 newItem->setText(0,GetShortCommandPath(commandText));
2650 aParent->addChild(newItem);
2652 CreateHelpTree(newItem,aCommandTree->
GetTree(a+1));
2659 QStringList stringList;
2663 newItem = FindTreeItem(aParent,commandText);
2664 if (newItem == NULL) {
2665 newItem =
new QTreeWidgetItem();
2666 newItem->setText(0,GetShortCommandPath(commandText));
2667 aParent->addChild(newItem);
2669#if QT_VERSION < 0x040202
2670 fHelpTreeWidget->setItemExpanded(newItem,
false);
2672 newItem->setExpanded(
false);
2686bool G4UIQt::CreateVisCommandGroupAndToolBox(
2693 QString commandText = QString((
char*)(aCommand->
GetCommandPath().
data())).section(
"/",-aDepthLevel);
2695 if (commandText == NULL) {
2701 QWidget* newParentWidget = NULL;
2703 QString commandSection = commandText.left(commandText.indexOf(
"/"));
2705 if (aDepthLevel == 1) {
2706 QToolBox* currentParent =
dynamic_cast<QToolBox*
>(aParent);
2707 if (currentParent != 0){
2710 for (
int a=0; a<currentParent->count(); a++) {
2711 if (currentParent->itemText(a) == commandSection) {
2713 newParentWidget = currentParent->widget(a);
2719 newParentWidget =
new QGroupBox();
2720 newParentWidget->setLayout(
new QVBoxLayout());
2721 if (currentParent != 0){
2722 currentParent->addItem(newParentWidget,commandSection);
2724 if (!aParent->layout()) {
2725 aParent->setLayout(
new QVBoxLayout());
2727 aParent->layout()->addWidget(newParentWidget);
2730 if (commandText.indexOf(
"/") == -1) {
2735 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
2736 guidance += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
2738 newParentWidget->setToolTip(guidance);
2741 QScrollArea* sc =
dynamic_cast<QScrollArea*
>(newParentWidget->parent()->parent());
2743 sc->ensureWidgetVisible(newParentWidget);
2750 QGroupBox* currentParent =
dynamic_cast<QGroupBox*
>(aParent);
2751 if (currentParent != 0){
2755 if (aDepthLevel == 2){
2756 QToolBox* parentToolBox =
dynamic_cast<QToolBox*
>(currentParent->parent()->parent()->parent());
2757 if (parentToolBox != 0) {
2761 for (
int a=0; a<aParent->layout()->count(); a++) {
2762 QGroupBox* gb =
dynamic_cast<QGroupBox*
>(aParent->layout()->itemAt(a)->widget());
2764 if (gb->title() == commandSection) {
2766 newParentWidget = gb;
2774 newParentWidget =
new QGroupBox();
2775 newParentWidget->setLayout(
new QVBoxLayout());
2776 if (!aParent->layout()) {
2777 aParent->setLayout(
new QVBoxLayout());
2779 aParent->layout()->addWidget(newParentWidget);
2785 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
2786 guidance += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
2788 newParentWidget->setToolTip(guidance);
2793 if (commandText.indexOf(
"/") == -1) {
2794 if (CreateCommandWidget(aCommand, newParentWidget,isDialog)) {
2798 CreateVisCommandGroupAndToolBox(aCommand,newParentWidget, aDepthLevel-1,isDialog);
2811bool G4UIQt::CreateCommandWidget(
G4UIcommand* aCommand, QWidget* aParent,
bool isDialog) {
2813 if (aCommand == NULL) {
2820 if( n_parameterEntry > 0 ) {
2824 QWidget* paramWidget =
new QWidget();
2825 QGridLayout* gridLayout =
new QGridLayout();
2826 paramWidget->setLayout(gridLayout);
2829 unsigned int nbColorParameter = 0;
2830 bool isStillColorParameter =
false;
2831 bool isColorDialogAdded =
false;
2832 QLabel* redLabel = NULL;
2833 QLabel* greenLabel = NULL;
2834 QString redDefaultStr =
"";
2835 QString greenDefaultStr =
"";
2836 QString blueDefaultStr =
"";
2837 QWidget* redInput = NULL;
2838 QWidget* greenInput = NULL;
2840 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
2843 QLabel* label =
new QLabel(QString((
char*)(param->
GetParameterName()).data()));
2845 if ((label->text() ==
"red") || (label->text() ==
"red_or_string")){
2846 nbColorParameter ++;
2847 isStillColorParameter =
true;
2848 }
else if ((label->text() ==
"green") && isStillColorParameter) {
2849 nbColorParameter ++;
2850 }
else if ((label->text() ==
"blue") && isStillColorParameter) {
2851 nbColorParameter ++;
2852 }
else if (!isColorDialogAdded) {
2855 if (nbColorParameter == 1) {
2856 gridLayout->addWidget(redLabel,i_thParameter-1,0);
2857 gridLayout->addWidget(redInput,i_thParameter-1,1);
2858 }
else if (nbColorParameter == 2) {
2859 gridLayout->addWidget(redLabel,i_thParameter-2,0);
2860 gridLayout->addWidget(redInput,i_thParameter-2,1);
2861 gridLayout->addWidget(greenLabel,i_thParameter-1,0);
2862 gridLayout->addWidget(greenInput,i_thParameter-1,1);
2864 nbColorParameter = 0;
2867 QWidget* input = NULL;
2869 input =
new QLineEdit();
2871 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
2873 if (((label->text() ==
"red") || (label->text() ==
"red_or_string")) && isStillColorParameter) {
2875 }
else if ((label->text() ==
"green") && isStillColorParameter) {
2877 }
else if ((label->text() ==
"green") && isStillColorParameter) {
2882 input =
new QWidget();
2883 QHBoxLayout* layout =
new QHBoxLayout();
2884 input->setLayout(layout);
2886 QButtonGroup* buttons =
new QButtonGroup();
2887 QRadioButton* radioOff =
new QRadioButton(
"0");
2888 QRadioButton* radioOn =
new QRadioButton(
"1");
2889 buttons->addButton(radioOn);
2890 buttons->addButton(radioOff);
2891 layout->addWidget(radioOn);
2892 layout->addWidget(radioOff);
2895 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
2896 if (defaultValue ==
"0") {
2897 radioOff->setChecked(
true);
2898 }
else if (defaultValue ==
"1") {
2899 radioOn->setChecked(
true);
2902 input =
new QComboBox();
2904 QStringList list = candidates.split (
" ");
2907 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
2908 for (
int a=0; a<list.size(); a++) {
2909 dynamic_cast<QComboBox*
>(input)->addItem(list.at(a));
2910 if (list.at(a) == defaultValue) {
2911 dynamic_cast<QComboBox*
>(input)->setCurrentIndex(a);
2916 input =
new QLineEdit();
2918 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
2921 input =
new QWidget();
2922 QHBoxLayout* layout =
new QHBoxLayout();
2923 input->setLayout(layout);
2925 QButtonGroup* buttons =
new QButtonGroup();
2926 QRadioButton* radioOff =
new QRadioButton(
"off");
2927 QRadioButton* radioOn =
new QRadioButton(
"on");
2928 buttons->addButton(radioOn);
2929 buttons->addButton(radioOff);
2930 layout->addWidget(radioOn);
2931 layout->addWidget(radioOff);
2934 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
2935 if (defaultValue ==
"off") {
2936 radioOff->setChecked(
true);
2937 }
else if (defaultValue ==
"on") {
2938 radioOn->setChecked(
true);
2942 input =
new QLineEdit();
2943 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
2946 txt +=
"\nParameter : " + QString((
char*)(param->
GetParameterName()).data()) +
"\n";
2950 txt +=
" Parameter type : " + QString(QChar(param->
GetParameterType())) +
"\n";
2952 txt +=
" Omittable : True\n";
2954 txt +=
" Omittable : False\n";
2957 txt +=
" Default value : taken from the current value\n";
2959 txt +=
" Default value : " + QString((
char*)(param->
GetDefaultValue()).data())+
"\n";
2962 txt +=
" Parameter range : " + QString((
char*)(param->
GetParameterRange()).data())+
"\n";
2968 if (isStillColorParameter && (nbColorParameter != 0)) {
2969 if ((label->text() ==
"red") || (label->text() ==
"red_or_string")) {
2972 }
else if (label->text() ==
"green") {
2975 }
else if (label->text() ==
"blue") {
2981 if ((redDefaultStr !=
"") && (redDefaultStr !=
"") && (redDefaultStr !=
"")) {
2982 qc.setRgbF(redDefaultStr.toDouble(),
2983 greenDefaultStr.toDouble(),
2984 blueDefaultStr.toDouble());
2986 QPixmap pixmap = QPixmap(QSize(16, 16));
2988 QPainter painter(&pixmap);
2989 painter.setPen(Qt::black);
2990 painter.drawRect(0,0,15,15);
2992 input =
new QPushButton(
"Change color");
2993 dynamic_cast<QPushButton*
>(input)->setIcon(pixmap);
2994 dynamic_cast<QPushButton*
>(input)->setAccessibleName(redDefaultStr+
" "+greenDefaultStr+
" "+blueDefaultStr);
2995 label =
new QLabel(
"Choose color");
2999 gridLayout->addWidget(label,i_thParameter-nbColorParameter,0);
3000 input->setToolTip(
"Select the current color");
3001 gridLayout->addWidget(input,i_thParameter-nbColorParameter,1);
3004#if QT_VERSION < 0x050600
3005 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3006 signalMapper->setMapping(input,input);
3007 connect(input, SIGNAL(clicked()), signalMapper, SLOT(map()));
3008 connect(signalMapper, SIGNAL(mapped(QWidget*)),
this, SLOT(ChangeColorCallback(QWidget*)));
3010 connect(
dynamic_cast<QPushButton*
>(input), &QPushButton::clicked , [=](){ this->ChangeColorCallback(input);});
3012 isColorDialogAdded =
true;
3013 isStillColorParameter =
false;
3016 gridLayout->addWidget(label,i_thParameter-nbColorParameter,0);
3017 input->setToolTip(txt);
3018 gridLayout->addWidget(input,i_thParameter-nbColorParameter,1);
3024 gridLayout->addWidget(name,n_parameterEntry-nbColorParameter,0);
3026 QPushButton* applyButton =
new QPushButton(
"Apply");
3029 gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,1);
3031#if QT_VERSION < 0x050600
3032 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3033 signalMapper->setMapping(applyButton, paramWidget);
3034 connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
3035 connect(signalMapper, SIGNAL(mapped(QWidget*)),
this, SLOT(VisParameterCallback(QWidget*)));
3037 connect(applyButton, &QPushButton::clicked , [=](){ this->VisParameterCallback(paramWidget);});
3042 applyButton->setAutoDefault(
TRUE );
3043 applyButton->setDefault(
TRUE );
3045 QPushButton* cancelButton =
new QPushButton( tr(
"&Cancel" ));
3046 cancelButton->setAutoDefault(
TRUE );
3047 gridLayout->addWidget(cancelButton,n_parameterEntry-nbColorParameter,1);
3048 gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,0);
3050#if QT_VERSION < 0x050600
3051 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3052 signalMapper->setMapping(applyButton, paramWidget);
3053 connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
3054 connect(signalMapper, SIGNAL(mapped(QWidget*)),
this, SLOT(VisParameterCallback(QWidget*)));
3056 connect(applyButton, &QPushButton::clicked , [=](){ this->VisParameterCallback(paramWidget);});
3059 QWidget * parentCheck = aParent;
3060 QDialog* parentDialog = NULL;
3062 while ((parentCheck->parentWidget()) != NULL) {
3063 parentCheck = parentCheck->parentWidget();
3064 parentDialog =
dynamic_cast<QDialog*
>(parentCheck);
3066 connect( applyButton, SIGNAL( clicked() ), parentDialog, SLOT( accept() ) );
3067 connect( cancelButton, SIGNAL( clicked() ), parentDialog, SLOT( reject() ) );
3076 if (!aParent->layout()) {
3077 aParent->setLayout(
new QVBoxLayout());
3079 aParent->layout()->addWidget(paramWidget);
3090QTreeWidgetItem* G4UIQt::FindTreeItem(
3091 QTreeWidgetItem *aParent
3092,
const QString& aCommand
3095 if (aParent == NULL)
return NULL;
3098 QString myCommand = aCommand;
3100 if (myCommand.lastIndexOf(
"/") == (myCommand.size()-1)) {
3101 myCommand = myCommand.left(myCommand.size()-1);
3104 if (GetLongCommandPath(aParent) == myCommand)
3107 QTreeWidgetItem * tmp = NULL;
3108 for (
int a=0;a<aParent->childCount();a++) {
3110 tmp = FindTreeItem(aParent->child(a),myCommand);
3124QString G4UIQt::GetCommandList (
3130 if (aCommand == NULL)
3138 if ((commandPath ==
"") &&
3139 (rangeString ==
"") &&
3140 (n_guidanceEntry == 0) &&
3141 (n_parameterEntry == 0)) {
3145 if((commandPath.length()-1)!=
'/') {
3146 txt +=
"Command " + QString((
char*)(commandPath).data()) +
"\n";
3148 txt +=
"Guidance :\n";
3150 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3151 txt += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
3153 if( ! rangeString.
isNull() ) {
3154 txt +=
" Range of parameters : " + QString((
char*)(rangeString).data()) +
"\n";
3156 if( n_parameterEntry > 0 ) {
3161 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3163 txt +=
"\nParameter : " + QString((
char*)(param->
GetParameterName()).data()) +
"\n";
3166 txt +=
" Parameter type : " + QString(QChar(param->
GetParameterType())) +
"\n";
3168 txt +=
" Omittable : True\n";
3170 txt +=
" Omittable : False\n";
3173 txt +=
" Default value : taken from the current value\n";
3175 txt +=
" Default value : " + QString((
char*)(param->
GetDefaultValue()).data())+
"\n";
3178 txt +=
" Parameter range : " + QString((
char*)(param->
GetParameterRange()).data())+
"\n";
3196void G4UIQt::updateHelpArea (
3200 if (!fParameterHelpLabel)
3202 if (!fParameterHelpTable)
3205 fParameterHelpLabel->setTextInteractionFlags(Qt::NoTextInteraction);
3207 if (aCommand == NULL)
3215 if ((commandPath ==
"") &&
3216 (rangeString ==
"") &&
3217 (n_guidanceEntry == 0) &&
3218 (n_parameterEntry == 0)) {
3222 if((commandPath.length()-1)!=
'/') {
3223 txt +=
"<b>Command </b> " + QString((
char*)(commandPath).data()) +
"<br />";
3225 txt +=
"<b>Guidance :</b> ";
3226 QString tmpGuidance =
"";
3227 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3228 tmpGuidance = QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data());
3229#if QT_VERSION < 0x050000
3230 tmpGuidance = Qt::escape(tmpGuidance);
3232 tmpGuidance = tmpGuidance.toHtmlEscaped();
3234 tmpGuidance.replace(
"\n",
"<br />");
3235 txt += tmpGuidance +
"<br />";
3237 if( ! rangeString.
isNull() ) {
3238 QString range = QString((
char*)(rangeString).data());
3239#if QT_VERSION < 0x050000
3240 range = Qt::escape(range);
3242 range = range.toHtmlEscaped();
3245 txt +=
"<b>Range of parameters : </b> " + range +
"<br />";
3249 fParameterHelpLabel->setHtml(txt);
3251 if( n_parameterEntry > 0 ) {
3256 fParameterHelpTable->clear();
3257 fParameterHelpTable->setRowCount(n_parameterEntry);
3258 fParameterHelpTable->setColumnCount(8);
3259 fParameterHelpTable->setHorizontalHeaderLabels(QStringList() <<
3268 fParameterHelpTable->setColumnWidth(2,60);
3270 fParameterHelpTable->verticalHeader()->setVisible(
false);
3271 fParameterHelpTable->setAlternatingRowColors (
true);
3272#if QT_VERSION < 0x050000
3273 fParameterHelpTable->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
3274 fParameterHelpTable->horizontalHeader()->setResizeMode(2, QHeaderView::Stretch);
3276 fParameterHelpTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
3277 fParameterHelpTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
3279 fParameterHelpTable->setWordWrap(
true);
3281 QTableWidgetItem* t = fParameterHelpTable->horizontalHeaderItem(1);
3282 QFont fnt = t->font();
3283 int size = fnt.pointSize();
3284 fnt.setPointSize(size-2);
3286 for(
G4int a=0; a<n_parameterEntry; a++ ) {
3288 fParameterHelpTable->setItem(a, 0,
new QTableWidgetItem(QString::number(a+1)));
3290 fParameterHelpTable->setItem(a, 1,
new QTableWidgetItem(QString((
char*)(param->
GetParameterName()).data())));
3292 fParameterHelpTable->setItem(a, 2,
new QTableWidgetItem(QString((
char*)(param->
GetParameterGuidance()).data())));
3294 fParameterHelpTable->setItem(a, 3,
new QTableWidgetItem(QString(QChar(param->
GetParameterType()))));
3297 fParameterHelpTable->setItem(a, 4,
new QTableWidgetItem(QString(
"True")));
3299 fParameterHelpTable->setItem(a, 4,
new QTableWidgetItem(QString(
"False")));
3302 fParameterHelpTable->setItem(a, 5,
new QTableWidgetItem(QString(
"taken from the current value")));
3304 fParameterHelpTable->setItem(a, 5,
new QTableWidgetItem(QString((
char*)(param->
GetDefaultValue()).data())));
3307 fParameterHelpTable->setItem(a, 6,
new QTableWidgetItem(QString((
char*)(param->
GetParameterRange()).data())));
3310 fParameterHelpTable->setItem(a, 7,
new QTableWidgetItem(QString((
char*)(param->
GetParameterCandidates()).data())));
3313 for (
int b=0; b<8; b++) {
3314 QTableWidgetItem* tmp = fParameterHelpTable->item(a,b);
3316 tmp->setToolTip(tmp->text());
3317 tmp->setFlags(Qt::NoItemFlags);
3320 fParameterHelpTable->resizeRowToContents(a);
3322 for (
int c=0; c<8; c++) {
3324 fParameterHelpTable->resizeColumnToContents(c);
3327 fParameterHelpLabel->setVisible(
true);
3328 fParameterHelpTable->setVisible(
true);
3339G4bool G4UIQt::IsGUICommand(
3343 if (aCommand == NULL)
3348 if( n_parameterEntry > 0 ) {
3353 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3375G4bool G4UIQt::GetHelpChoice(
3390bool G4UIQt::eventFilter(
3395 bool tabKeyPress =
false;
3396 bool moveCommandCursor =
false;
3397 if (aObj == NULL)
return false;
3398 if (aEvent == NULL)
return false;
3400 if (aObj == fHistoryTBTableList) {
3401 if (aEvent->type() == QEvent::KeyPress) {
3402 fCommandArea->setFocus();
3406 if (aObj == fCompleter->popup()) {
3407 if (aEvent->type() == QEvent::KeyPress) {
3408 QKeyEvent *e =
static_cast<QKeyEvent*
>(aEvent);
3409 if (e->key() == (Qt::Key_Tab)) {
3412 }
else if ( aEvent->type() == QEvent::Hide ) {
3414 QString c = fCommandArea->text();
3415 fLastCompleteCommand = c.left(c.indexOf(
"<"));
3419 if (aObj == fCommandArea) {
3420 if (aEvent->type() == QEvent::KeyPress) {
3421 QKeyEvent *e =
static_cast<QKeyEvent*
>(aEvent);
3422 if ((e->key() == (Qt::Key_Down)) ||
3423 (e->key() == (Qt::Key_PageDown)) ||
3424 (e->key() == (Qt::Key_Up)) ||
3425 (e->key() == (Qt::Key_PageUp))) {
3426 int selection = fHistoryTBTableList->currentRow();
3427 if (fHistoryTBTableList->count()) {
3428 if (selection == -1) {
3429 selection = fHistoryTBTableList->count()-1;
3431 if (e->key() == (Qt::Key_Down)) {
3432 if (selection <(fHistoryTBTableList->count()-1))
3434 }
else if (e->key() == (Qt::Key_PageDown)) {
3435 selection = fHistoryTBTableList->count()-1;
3436 }
else if (e->key() == (Qt::Key_Up)) {
3439 }
else if (e->key() == (Qt::Key_PageUp)) {
3443 fHistoryTBTableList->clearSelection();
3444#if QT_VERSION < 0x040202
3445 fHistoryTBTableList->setItemSelected(fHistoryTBTableList->item(selection),
true);
3447 fHistoryTBTableList->item(selection)->setSelected(
true);
3449 fHistoryTBTableList->setCurrentItem(fHistoryTBTableList->item(selection));
3451 moveCommandCursor =
true;
3452 }
else if (e->key() == (Qt::Key_Tab)) {
3454 }
else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_A)) {
3455 fCommandArea->home(
false);
3457 }
else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_E)) {
3458 fCommandArea->end(
false);
3461 }
else if (aEvent->type() == QEvent::Paint) {
3462 if (fLastCompleteCommand !=
"") {
3463 fCommandArea->setText(fLastCompleteCommand);
3464 fLastCompleteCommand =
"";
3468 if (tabKeyPress ==
true) {
3469 G4String ss = Complete(fCommandArea->text().toStdString().c_str());
3470 fCommandArea->setText((
char*)(ss.
data()));
3471 fCommandArea->setFocus();
3480 if (moveCommandCursor ==
true) {
3481 fCommandArea->setCursorPosition ( fCommandArea->text().length() );
3482 fCommandArea->setCursorPosition (4);
3485 res = QObject::eventFilter(aObj, aEvent);
3491void G4UIQt::UpdateCommandCompleter() {
3492 if (!fCommandArea)
return;
3495 fCommandArea->setCompleter(NULL);
3497 if (fCompleter->popup()) {
3498 fCompleter->popup()->removeEventFilter(
this);
3502 QStandardItemModel* model = CreateCompleterModel(
"/");
3503 fCompleter =
new QCompleter(model);
3510 int Ndir= aTree-> GetTreeEntry();
3511 fCompleter->setMaxVisibleItems(Ndir);
3513 fCommandArea->setCompleter(fCompleter);
3514 fCompleter->popup()->installEventFilter(
this);
3518QStandardItemModel* G4UIQt::CreateCompleterModel(
G4String aCmd) {
3520 QList< QStandardItem*> dirModelList;
3521 QList< QStandardItem*> commandModelList;
3522 QList< QStandardItem*> subDirModelList;
3523 QList< QStandardItem*> subCommandModelList;
3535 if(jpre !=
G4int(G4String::npos)) pName.
remove(jpre+1);
3540 int Ndir= aTree-> GetTreeEntry();
3541 int Ncmd= aTree-> GetCommandEntry();
3544 for(
G4int idir=1; idir<=Ndir; idir++) {
3545 G4String fpdir= aTree-> GetTree(idir)-> GetPathName();
3547 if( fpdir.
index(remainingPath, 0) == 0) {
3549 matchingPath = fpdir;
3556 QStandardItem* item1 =
new QStandardItem(fpdir.
data());
3557 QIcon i = QIcon(*fDirIcon);
3559 item1->setIcon(QIcon(*fDirIcon));
3560 dirModelList.append(item1);
3563 QStandardItemModel* subModel = CreateCompleterModel(fpdir.
data());
3564 for (
int a=0; a< subModel->rowCount(); a++) {
3567 QStandardItem* tempItem =
new QStandardItem(subModel->item(a)->text());
3568 tempItem->setIcon(subModel->item(a)->icon());
3569 tempItem->setToolTip(subModel->item(a)->toolTip());
3570 tempItem->setData(subModel->item(a)->data());
3573 if (tempItem->data() == 1) {
3575 subDirModelList.append(tempItem);
3578 else if (tempItem->data() == 0) {
3579 subCommandModelList.append(tempItem);
3586 G4int n_parameterEntry;
3588 G4int n_guidanceEntry;
3591 std::string tooltip;
3594 for(
G4int icmd=1; icmd<=Ncmd; icmd++){
3597 command = aTree-> GetCommand(icmd);
3598 G4String longCommandName= aTree-> GetPathName() +
3599 command -> GetCommandName();
3606 if( longCommandName.
index(remainingPath, 0) ==0) {
3608 matchingPath= longCommandName +
" ";
3610 strtmp= longCommandName +
" ";
3615 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3616 tooltip += std::string((command->
GetGuidanceLine(i_thGuidance)).data());
3617 if (i_thGuidance < n_guidanceEntry-1 ) {
3623 for(
G4int a=0; a<n_parameterEntry; a++ ) {
3634 QStandardItem* item =
new QStandardItem(
G4String(longCommandName + params).data());
3636 item->setIcon(QIcon(*fCommandIcon));
3637 item->setToolTip(tooltip.c_str());
3639 commandModelList.append(item);
3644 QStandardItemModel* model =
new QStandardItemModel();
3646 model->setColumnCount(1);
3649 for (
int a= 0; a< dirModelList.size(); a++) {
3650 model->appendRow(dirModelList.at(a));
3652 for (
int a= 0; a< subDirModelList.size(); a++) {
3653 model->appendRow(subDirModelList.at(a));
3655 for (
int a= 0; a< commandModelList.size(); a++) {
3656 model->appendRow(commandModelList.at(a));
3658 for (
int a= 0; a< subCommandModelList.size(); a++) {
3659 model->appendRow(subCommandModelList.at(a));
3674void G4UIQt::ShowHelpCallback (
3683void G4UIQt::ClearButtonCallback (
3686 fCoutTBTextArea->clear();
3687 fG4OutputString.clear();
3692void G4UIQt::ExitSession (
3698void G4UIQt::ExitHelp(
3706void G4UIQt::CommandEnteredCallback (
3710 fCommandArea->setText(fCommandArea->text().trimmed());
3711#if QT_VERSION < 0x050F00
3713 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),QString::SkipEmptyParts);
3716 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),Qt::SkipEmptyParts);
3720 for (
int a=0; a< list.size(); a++) {
3721 QString txt (list[a].trimmed());
3723 fHistoryTBTableList->addItem(txt);
3724 fHistoryTBTableList->clearSelection();
3725 fHistoryTBTableList->setCurrentItem(NULL);
3726 fCommandArea->setText(
"");
3727 G4Qt* interactorManager = G4Qt::getInstance ();
3728 if (interactorManager) {
3729 interactorManager->FlushAndWaitExecution();
3732 G4String command = txt.toStdString().c_str();
3733 if (command(0,4) !=
"help") {
3734 ApplyShellCommand (command,exitSession,exitPause);
3736 ActivateCommand(command);
3741 fCommandArea->setFocus();
3747 UpdateCommandCompleter();
3749 if(exitSession==
true)
3758void G4UIQt::CommandEditedCallback(
const QString &)
3760#if QT_VERSION < 0x050F00
3762 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),QString::SkipEmptyParts);
3765 QStringList list = fCommandArea->text().split(QRegExp(
"[\r\n]"),Qt::SkipEmptyParts);
3768 if (list.size() > 1) {
3769 for (
int a=0; a<list.size()-1; a++) {
3771 fCommandArea->setText(list[a]);
3773 CommandEnteredCallback();
3776 fCommandArea->setText(list[list.size()-1]);
3783void G4UIQt::VisParameterCallback(QWidget* widget){
3784 if (widget == NULL) {
3789 QGridLayout* grid =
dynamic_cast<QGridLayout*
>(widget->layout());
3794#if QT_VERSION < 0x040400
3795 QWidget*
name = grid->itemAt(grid->columnCount()*(grid->rowCount()-2))->widget();
3797 QWidget*
name = grid->itemAtPosition(grid->rowCount()-1,0)->widget();
3799 if (
dynamic_cast<QLabel*
>(name) == 0) {
3802 command += (
dynamic_cast<QLabel*
>(
name))->text()+
" ";
3804 for (
int a=0;a<grid->rowCount()-1; a++) {
3805#if QT_VERSION < 0x040400
3806 QWidget* widgetTmp = grid->itemAt(a*grid->columnCount()+1)->widget();
3808 QWidget* widgetTmp = grid->itemAtPosition(a,1)->widget();
3812 if (widgetTmp != NULL) {
3814 if (
dynamic_cast<QLineEdit*
>(widgetTmp) != 0) {
3815 command += (
dynamic_cast<QLineEdit*
>(widgetTmp))->text()+
" ";
3817 }
else if (
dynamic_cast<QComboBox*
>(widgetTmp) != 0){
3818 command += (
dynamic_cast<QComboBox*
>(widgetTmp))->itemText((
dynamic_cast<QComboBox*
>(widgetTmp))->currentIndex())+
" ";
3821 }
else if (
dynamic_cast<QPushButton*
>(widgetTmp) != 0){
3822 command += widgetTmp->accessibleName()+
" ";
3825 }
else if (
dynamic_cast<QWidget*
>(widgetTmp) != 0){
3826 if (widgetTmp->layout()->count() > 0){
3827 if (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()) != 0) {
3828 QAbstractButton * checked = (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()))->group()->checkedButton();
3830 command += (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()))->group()->checkedButton()->text()+
" ";
3838 if (command !=
"") {
3852void G4UIQt::ButtonCallback (
3853 const QString& aCommand
3860 if(UI==NULL)
return;
3867 if (IsGUICommand(command)) {
3868 QDialog* menuParameterDialog =
new QDialog();
3870 if (CreateVisCommandGroupAndToolBox(command,menuParameterDialog,1,
true)) {
3871 menuParameterDialog->setWindowTitle (aCommand);
3872 menuParameterDialog->setSizePolicy (QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
3875 menuParameterDialog->exec();
3878 delete menuParameterDialog;
3882 ApplyShellCommand(ss,exitSession,exitPause);
3887 if(exitSession==
true)
3895void G4UIQt::HelpTreeClicCallback (
3898 QTreeWidgetItem* item = NULL;
3899 if (!fHelpTreeWidget)
3902 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
3905 item = list.first();
3910 if(UI==NULL)
return;
3913 std::string itemText = GetLongCommandPath(item).toStdString();
3916 if (item->childCount() > 0) {
3922 updateHelpArea(command);
3928 fParameterHelpLabel->setVisible(
true);
3930 fParameterHelpTable->setVisible(
false);
3937void G4UIQt::HelpTreeDoubleClicCallback (
3940 HelpTreeClicCallback();
3942 QTreeWidgetItem* item = NULL;
3943 if (!fHelpTreeWidget)
3946 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
3949 item = list.first();
3953 fCommandArea->clear();
3954 fCommandArea->setText(GetLongCommandPath(item));
3961void G4UIQt::CommandHistoryCallback(
3964 QListWidgetItem* item = NULL;
3965 if (!fHistoryTBTableList)
3969 QList<QListWidgetItem *> list =fHistoryTBTableList->selectedItems();
3972 item = list.first();
3975 fCommandArea->setText(item->text());
3979void G4UIQt::ThreadComboBoxCallback(
int) {
3980 CoutFilterCallback(
"");
3984void G4UIQt::CoutFilterCallback(
3987 FilterAllOutputTextArea();
3989 fCoutTBTextArea->repaint();
3990 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
3995void G4UIQt::SaveOutputCallback(){
3996 QString fileName = QFileDialog::getSaveFileName(fMainWindow,
"Save console output as...", fLastOpenPath,
"Save output as...");
3997 if (fileName !=
"") {
3999 QFile data(fileName);
4000 if (data.open(QFile::WriteOnly | QFile::Truncate)) {
4001 QTextStream out(&data);
4002 out << fCoutTBTextArea->toPlainText();
4010QString G4UIQt::FilterOutput(
4011 const G4UIOutputString& output
4012,
const QString& currentThread
4013,
const QString& filter
4016#ifdef G4MULTITHREADED
4017 if ((currentThread ==
"All") ||
4018 (currentThread == output.fThread)) {
4020 if (currentThread ==
"") {
4022 if (output.fText.contains(QRegExp(filter))) {
4023 return output.fText;
4030void G4UIQt::FilterAllOutputTextArea() {
4032 QString currentThread =
"";
4033#ifdef G4MULTITHREADED
4034 currentThread = fThreadsFilterComboBox->currentText();
4035 if (currentThread ==
"Master") {
4039 QString filter = fCoutFilter->text();
4040 G4String previousOutputStream =
"";
4045 fCoutTBTextArea->clear();
4047 for (
unsigned int a=0; a<fG4OutputString.size(); a++) {
4048 G4UIOutputString out = fG4OutputString[a];
4049 if (FilterOutput(out,currentThread,filter) !=
"") {
4052 if (out.fOutputStream != previousOutputStream) {
4053 previousOutputStream = out.fOutputStream;
4054 if (out.fOutputStream ==
"info") {
4057 }
else if (out.fOutputStream ==
"warning") {
4058 pref =
"<font color=\"DarkYellow\">";
4061 pref =
"<font color=\"Red\">";
4065 fCoutTBTextArea->
append(pref + out.fText + post);
4075void G4UIQt::LookForHelpStringCallback(
4078 fHelpLine->setText(fHelpLine->text().trimmed());
4079 QString searchText = fHelpLine->text();
4081 fParameterHelpLabel->setText(
"");
4082 fParameterHelpTable->setVisible(
false);
4083 if (searchText ==
"") {
4085 fHelpTreeWidget->clear();
4091 OpenHelpTreeOnCommand(searchText);
4096void G4UIQt::OpenHelpTreeOnCommand(
4097 const QString & searchText
4102 if(UI==NULL)
return;
4108 fHelpTreeWidget->clear();
4114#if QT_VERSION < 0x050F00
4116 QMap<int,QString> commandResultMap;
4117 QMap<int,QString> commandChildResultMap;
4118 for (
int a=0;a<treeSize;a++) {
4120 tmp = GetCommandList (command).count(searchText,Qt::CaseInsensitive);
4122 commandResultMap.insertMulti(tmp,QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()));
4125 commandChildResultMap = LookForHelpStringInChildTree(treeTop->
GetTree(a+1),searchText);
4127 if (!commandChildResultMap.empty()) {
4128 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4129 while (i != commandChildResultMap.constEnd()) {
4130 commandResultMap.insertMulti(i.key(),i.value());
4133 commandChildResultMap.clear();
4138 QMultiMap<int,QString> commandResultMap;
4139 QMultiMap<int,QString> commandChildResultMap;
4140 for (
int a=0;a<treeSize;a++) {
4142 tmp = GetCommandList (command).count(searchText,Qt::CaseInsensitive);
4144 commandResultMap.insert(tmp,QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()));
4147 commandChildResultMap = LookForHelpStringInChildTree(treeTop->
GetTree(a+1),searchText);
4149 if (!commandChildResultMap.empty()) {
4150 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4151 while (i != commandChildResultMap.constEnd()) {
4152 commandResultMap.insert(i.key(),i.value());
4155 commandChildResultMap.clear();
4161 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
4162 fHelpTreeWidget->setColumnCount(2);
4164 labels << QString(
"Command") << QString(
"Match");
4165 fHelpTreeWidget->setHeaderLabels(labels);
4167 if (commandResultMap.empty()) {
4168 fParameterHelpLabel->setText(
"No match found");
4169 fParameterHelpTable->setVisible(
false);
4173 QMap<int,QString>::const_iterator i = commandResultMap.constEnd();
4176 float multValue = 10.0/(float)(i.key());
4177 QString progressChar =
"|";
4178 QString progressStr =
"|";
4180 QTreeWidgetItem * newItem;
4183 if (i == commandResultMap.constBegin()) {
4186 for(
int a=0;a<int(i.key()*multValue);a++) {
4187 progressStr += progressChar;
4189 newItem =
new QTreeWidgetItem();
4190 QString commandStr = i.value().trimmed();
4192 if (commandStr.indexOf(
"/") == 0) {
4193 commandStr = commandStr.right(commandStr.size()-1);
4196 newItem->setText(0,commandStr);
4197 newItem->setText(1,progressStr);
4198 fHelpTreeWidget->addTopLevelItem(newItem);
4199#if QT_VERSION < 0x040200
4201 newItem->setForeground ( 1, QBrush(Qt::blue) );
4206 fHelpTreeWidget->resizeColumnToContents (0);
4207 fHelpTreeWidget->sortItems(1,Qt::DescendingOrder);
4211#if QT_VERSION < 0x050F00
4213QMap<int,QString> G4UIQt::LookForHelpStringInChildTree(
4215,
const QString & text
4218 QMap<int,QString> commandResultMap;
4219 if (aCommandTree == NULL)
return commandResultMap;
4222 QMap<int,QString> commandChildResultMap;
4225 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4227 commandResultMap.insertMulti(tmp,QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()));
4230 commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->
GetTree(a+1),text);
4231 if (!commandChildResultMap.empty()) {
4233 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4234 while (i != commandChildResultMap.constEnd()) {
4235 commandResultMap.insertMulti(i.key(),i.value());
4238 commandChildResultMap.clear();
4244 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4249 return commandResultMap;
4253QMultiMap<int,QString> G4UIQt::LookForHelpStringInChildTree(
4255,
const QString & text
4258 QMultiMap<int,QString> commandResultMap;
4259 if (aCommandTree == NULL)
return commandResultMap;
4262 QMultiMap<int,QString> commandChildResultMap;
4265 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4267 commandResultMap.insert(tmp,QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()));
4270 commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->
GetTree(a+1),text);
4271 if (!commandChildResultMap.empty()) {
4273 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4274 while (i != commandChildResultMap.constEnd()) {
4275 commandResultMap.insert(i.key(),i.value());
4278 commandChildResultMap.clear();
4284 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
4289 return commandResultMap;
4294QString G4UIQt::GetShortCommandPath(
4298 if (commandPath.indexOf(
"/") == 0) {
4299 commandPath = commandPath.right(commandPath.size()-1);
4302 commandPath = commandPath.right(commandPath.size()-commandPath.lastIndexOf(
"/",-2)-1);
4304 if (commandPath.lastIndexOf(
"/") == (commandPath.size()-1)) {
4305 commandPath = commandPath.left(commandPath.size()-1);
4312QString G4UIQt::GetLongCommandPath(
4313 QTreeWidgetItem* item
4316 if (item == NULL)
return "";
4319 QString itemText =
"";
4320 itemText = item->text(0);
4322 while (item->parent() != NULL) {
4323 itemText = item->parent()->text(0)+
"/"+itemText;
4324 item = item->parent();
4326 itemText =
"/"+itemText;
4332void G4UIQt::ChangeColorCallback(QWidget* widget) {
4333 if (widget == NULL) {
4337 QPushButton* button =
dynamic_cast<QPushButton*
>(widget);
4341 QString value = button->accessibleName();
4344 old.setRgbF(value.section(
" ",0,1).toDouble(),
4345 value.section(
" ",1,2).toDouble(),
4346 value.section(
" ",2,3).toDouble());
4347#if QT_VERSION < 0x040500
4349 QColor color = QColor(QColorDialog::getRgba (old.rgba(),&a,fUITabWidget));
4351 QColor color = QColorDialog::getColor(old,
4354 QColorDialog::ShowAlphaChannel);
4358 if (color.isValid()) {
4360 QPixmap pixmap = QPixmap(QSize(16, 16));
4361 pixmap.fill (color);
4362 QPainter painter(&pixmap);
4363 painter.setPen(Qt::black);
4364 painter.drawRect(0,0,15,15);
4366 button->setAccessibleName(QString::number(color.redF())+
" "+
4367 QString::number(color.greenF())+
" "+
4368 QString::number(color.blueF())+
" "
4370 button->setIcon(pixmap);
4377void G4UIQt::ChangeCursorAction(
const QString& action) {
4381 fMoveSelected =
true;
4382 fPickSelected =
true;
4383 fRotateSelected =
true;
4384 fZoomInSelected =
true;
4385 fZoomOutSelected =
true;
4387 if (fToolbarApp == NULL)
return;
4388 QList<QAction *> list = fToolbarApp->actions ();
4389 for (
int i = 0; i < list.size(); ++i) {
4390 if (list.at(i)->data().toString () == action) {
4391 list.at(i)->setChecked(
TRUE);
4392 if (list.at(i)->data().toString () ==
"pick") {
4394 CreatePickInfosDialog();
4396 fPickInfosDialog->show();
4397 fPickInfosDialog->raise();
4398 fPickInfosDialog->activateWindow();
4400 }
else if (list.at(i)->data().toString () ==
"move") {
4401 fMoveSelected =
false;
4402 list.at(i)->setChecked(
FALSE);
4403 }
else if (list.at(i)->data().toString () ==
"pick") {
4404 fPickSelected =
false;
4405 list.at(i)->setChecked(
FALSE);
4407 if (fPickInfosDialog) {
4408 fPickInfosDialog->hide();
4410 }
else if (list.at(i)->data().toString () ==
"rotate") {
4411 fRotateSelected =
false;
4412 list.at(i)->setChecked(
FALSE);
4413 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4414 fZoomInSelected =
false;
4415 list.at(i)->setChecked(
FALSE);
4416 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4417 fZoomOutSelected =
false;
4418 list.at(i)->setChecked(
FALSE);
4431void G4UIQt::ChangeSurfaceStyle(
const QString& action) {
4435 if (fToolbarApp == NULL)
return;
4436 QList<QAction *> list = fToolbarApp->actions ();
4437 for (
int i = 0; i < list.size(); ++i) {
4438 if (list.at(i)->data().toString () == action) {
4439 list.at(i)->setChecked(
TRUE);
4440 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4441 list.at(i)->setChecked(
FALSE);
4442 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4443 list.at(i)->setChecked(
FALSE);
4444 }
else if (list.at(i)->data().toString () ==
"solid") {
4445 list.at(i)->setChecked(
FALSE);
4446 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4447 list.at(i)->setChecked(
FALSE);
4452 if (action ==
"hidden_line_removal") {
4456 }
else if (action ==
"hidden_line_and_surface_removal") {
4460 }
else if (action ==
"solid") {
4464 }
else if (action ==
"wireframe") {
4471void G4UIQt::OpenIconCallback(
const QString& aParam) {
4473 QString aCommand = aParam.left(aParam.indexOf(fStringSeparator));
4474 QString aLabel = aParam.mid(aParam.indexOf(fStringSeparator)+fStringSeparator.length());
4476 QString nomFich = QFileDialog::getOpenFileName(fMainWindow, aLabel, fLastOpenPath,
"Macro files (*.mac)");
4477 if (nomFich !=
"") {
4480 fLastOpenPath = dir.absoluteFilePath(nomFich);
4485void G4UIQt::SaveIconCallback(
const QString& aParam) {
4487 QString aCommand = aParam.left(aParam.indexOf(fStringSeparator));
4488 QString aLabel = aParam.mid(aParam.indexOf(fStringSeparator)+fStringSeparator.length());
4490 QString nomFich = QFileDialog::getSaveFileName(fMainWindow, aLabel, fLastOpenPath,
"Macro files (*.mac)");
4491 if (nomFich !=
"") {
4494 fLastOpenPath = dir.absoluteFilePath(nomFich);
4499void G4UIQt::CreateViewerPropertiesDialog() {
4501 if (fViewerPropertiesDialog != NULL) {
4504 fViewerPropertiesDialog =
new QDialog();
4506 fViewerPropertiesDialog->setWindowTitle(
"Viewer properties");
4507 fViewerPropertiesDialog->setSizePolicy (QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
4509 if (!fViewerPropertiesWidget) {
4510 fViewerPropertiesWidget =
new QWidget();
4511 QVBoxLayout* layoutPropertiesWidget =
new QVBoxLayout();
4512 fViewerPropertiesWidget->setLayout(layoutPropertiesWidget);
4514 CreateEmptyViewerPropertiesWidget();
4517 QVBoxLayout* layoutDialog =
new QVBoxLayout();
4519 layoutDialog->addWidget(fViewerPropertiesWidget);
4520 layoutDialog->setContentsMargins(0,0,0,0);
4521 fViewerPropertiesDialog->setLayout(layoutDialog);
4525void G4UIQt::CreatePickInfosDialog() {
4527 if (fPickInfosDialog != NULL) {
4530 fPickInfosDialog =
new QDialog();
4532 fPickInfosDialog->setWindowTitle(
"Pick infos");
4533 fPickInfosDialog->setSizePolicy (QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
4535 if (!fPickInfosWidget) {
4536 fPickInfosWidget =
new QWidget();
4537 QVBoxLayout* layoutPickInfos =
new QVBoxLayout();
4538 fPickInfosWidget->setLayout(layoutPickInfos);
4540 CreateEmptyPickInfosWidget();
4543 QVBoxLayout* layoutDialog =
new QVBoxLayout();
4545 layoutDialog->addWidget(fPickInfosWidget);
4546 layoutDialog->setContentsMargins(0,0,0,0);
4547 fPickInfosDialog->setLayout(layoutDialog);
4548 fPickInfosDialog->setWindowFlags(Qt::WindowStaysOnTopHint);
4553void G4UIQt::CreateEmptyViewerPropertiesWidget() {
4554 QLayoutItem * wItem;
4555 if (fViewerPropertiesWidget->layout()->count()) {
4556 while ((wItem = fViewerPropertiesWidget->layout()->takeAt(0)) != 0) {
4557 delete wItem->widget();
4562 QLabel* label =
new QLabel(
"No viewer - Please open a viewer first");
4563 fViewerPropertiesWidget->layout()->addWidget(label);
4564 fViewerPropertiesDialog->setWindowTitle(
"No viewer");
4568void G4UIQt::CreateEmptyPickInfosWidget() {
4569 QLayoutItem * wItem;
4570 if (fPickInfosWidget->layout()->count()) {
4571 while ((wItem = fPickInfosWidget->layout()->takeAt(0)) != 0) {
4572 delete wItem->widget();
4577 QLabel* label =
new QLabel(
"Click on the object you want to pick");
4578 fPickInfosWidget->layout()->addWidget(label);
4579 fPickInfosDialog->setWindowTitle(
"Nothing to pick");
4583void G4UIQt::ViewerPropertiesIconCallback(
int) {
4585 CreateViewerPropertiesDialog();
4587 fViewerPropertiesDialog->show();
4588 fViewerPropertiesDialog->raise();
4589 fViewerPropertiesDialog->activateWindow();
4593void G4UIQt::ChangePerspectiveOrtho(
const QString& action) {
4597 if (fToolbarApp == NULL)
return;
4598 QList<QAction *> list = fToolbarApp->actions ();
4599 QString checked =
"";
4600 for (
int i = 0; i < list.size(); ++i) {
4601 if (list.at(i)->data().toString () == action) {
4602 list.at(i)->setChecked(
TRUE);
4603 checked = list.at(i)->data().toString ();
4604 }
else if (list.at(i)->data().toString () ==
"perspective") {
4605 list.at(i)->setChecked(
FALSE);
4606 }
else if (list.at(i)->data().toString () ==
"ortho") {
4607 list.at(i)->setChecked(
FALSE);
4611 if ((action ==
"ortho") && (checked ==
"ortho")) {
4613 }
else if ((action ==
"perspective") && (checked ==
"perspective")) {
4620void G4UIQt::SetIconMoveSelected() {
4622 fMoveSelected =
true;
4623 fRotateSelected =
false;
4624 fPickSelected =
false;
4625 fZoomInSelected =
false;
4626 fZoomOutSelected =
false;
4628 if (fToolbarApp == NULL)
return;
4629 QList<QAction *> list = fToolbarApp->actions ();
4630 for (
int i = 0; i < list.size(); ++i) {
4631 if (list.at(i)->data().toString () ==
"move") {
4632 list.at(i)->setChecked(
TRUE);
4633 }
else if (list.at(i)->data().toString () ==
"rotate") {
4634 list.at(i)->setChecked(
FALSE);
4635 }
else if (list.at(i)->data().toString () ==
"pick") {
4636 list.at(i)->setChecked(
FALSE);
4637 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4638 list.at(i)->setChecked(
FALSE);
4639 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4640 list.at(i)->setChecked(
FALSE);
4646void G4UIQt::SetIconRotateSelected() {
4648 fRotateSelected =
true;
4649 fMoveSelected =
false;
4650 fPickSelected =
false;
4651 fZoomInSelected =
false;
4652 fZoomOutSelected =
false;
4654 if (fToolbarApp == NULL)
return;
4655 QList<QAction *> list = fToolbarApp->actions ();
4656 for (
int i = 0; i < list.size(); ++i) {
4657 if (list.at(i)->data().toString () ==
"rotate") {
4658 list.at(i)->setChecked(
TRUE);
4659 }
else if (list.at(i)->data().toString () ==
"move") {
4660 list.at(i)->setChecked(
FALSE);
4661 }
else if (list.at(i)->data().toString () ==
"pick") {
4662 list.at(i)->setChecked(
FALSE);
4663 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4664 list.at(i)->setChecked(
FALSE);
4665 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4666 list.at(i)->setChecked(
FALSE);
4672void G4UIQt::SetIconPickSelected() {
4674 fPickSelected =
true;
4675 fMoveSelected =
false;
4676 fRotateSelected =
false;
4677 fZoomInSelected =
false;
4678 fZoomOutSelected =
false;
4680 QToolBar* bar = fToolbarApp;
4681 if (!fDefaultIcons) {
4686 QList<QAction *> list = bar->actions ();
4687 for (
int i = 0; i < list.size(); ++i) {
4688 if (list.at(i)->data().toString () ==
"pick") {
4689 list.at(i)->setChecked(
TRUE);
4690 }
else if (list.at(i)->data().toString () ==
"move") {
4691 list.at(i)->setChecked(
FALSE);
4692 }
else if (list.at(i)->data().toString () ==
"rotate") {
4693 list.at(i)->setChecked(
FALSE);
4694 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4695 list.at(i)->setChecked(
FALSE);
4696 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4697 list.at(i)->setChecked(
FALSE);
4703void G4UIQt::SetIconZoomInSelected() {
4705 fZoomInSelected =
true;
4706 fMoveSelected =
false;
4707 fRotateSelected =
false;
4708 fPickSelected =
false;
4709 fZoomOutSelected =
false;
4711 QToolBar* bar = fToolbarApp;
4712 if (!fDefaultIcons) {
4717 QList<QAction *> list = bar->actions ();
4718 for (
int i = 0; i < list.size(); ++i) {
4719 if (list.at(i)->data().toString () ==
"zoom_in") {
4720 list.at(i)->setChecked(
TRUE);
4721 }
else if (list.at(i)->data().toString () ==
"move") {
4722 list.at(i)->setChecked(
FALSE);
4723 }
else if (list.at(i)->data().toString () ==
"rotate") {
4724 list.at(i)->setChecked(
FALSE);
4725 }
else if (list.at(i)->data().toString () ==
"pick") {
4726 list.at(i)->setChecked(
FALSE);
4727 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4728 list.at(i)->setChecked(
FALSE);
4734void G4UIQt::SetIconZoomOutSelected() {
4736 fZoomOutSelected =
true;
4737 fMoveSelected =
false;
4738 fRotateSelected =
false;
4739 fPickSelected =
false;
4740 fZoomInSelected =
false;
4742 QToolBar* bar = fToolbarApp;
4743 if (!fDefaultIcons) {
4748 QList<QAction *> list = bar->actions ();
4749 for (
int i = 0; i < list.size(); ++i) {
4750 if (list.at(i)->data().toString () ==
"zoom_out") {
4751 list.at(i)->setChecked(
TRUE);
4752 }
else if (list.at(i)->data().toString () ==
"move") {
4753 list.at(i)->setChecked(
FALSE);
4754 }
else if (list.at(i)->data().toString () ==
"rotate") {
4755 list.at(i)->setChecked(
FALSE);
4756 }
else if (list.at(i)->data().toString () ==
"pick") {
4757 list.at(i)->setChecked(
FALSE);
4758 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4759 list.at(i)->setChecked(
FALSE);
4765void G4UIQt::SetIconSolidSelected() {
4768 QToolBar* bar = fToolbarApp;
4769 if (!fDefaultIcons) {
4774 QList<QAction *> list = bar->actions ();
4775 for (
int i = 0; i < list.size(); ++i) {
4776 if (list.at(i)->data().toString () ==
"solid") {
4777 list.at(i)->setChecked(
TRUE);
4778 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4779 list.at(i)->setChecked(
FALSE);
4780 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4781 list.at(i)->setChecked(
FALSE);
4782 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4783 list.at(i)->setChecked(
FALSE);
4789void G4UIQt::SetIconWireframeSelected() {
4792 QToolBar* bar = fToolbarApp;
4793 if (!fDefaultIcons) {
4798 QList<QAction *> list = bar->actions ();
4799 for (
int i = 0; i < list.size(); ++i) {
4800 if (list.at(i)->data().toString () ==
"wireframe") {
4801 list.at(i)->setChecked(
TRUE);
4802 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4803 list.at(i)->setChecked(
FALSE);
4804 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4805 list.at(i)->setChecked(
FALSE);
4806 }
else if (list.at(i)->data().toString () ==
"solid") {
4807 list.at(i)->setChecked(
FALSE);
4813void G4UIQt::SetIconHLRSelected() {
4816 QToolBar* bar = fToolbarApp;
4817 if (!fDefaultIcons) {
4823 QList<QAction *> list = bar->actions ();
4824 for (
int i = 0; i < list.size(); ++i) {
4825 if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4826 list.at(i)->setChecked(
TRUE);
4827 }
else if (list.at(i)->data().toString () ==
"solid") {
4828 list.at(i)->setChecked(
FALSE);
4829 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4830 list.at(i)->setChecked(
FALSE);
4831 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4832 list.at(i)->setChecked(
FALSE);
4838void G4UIQt::SetIconHLHSRSelected() {
4841 QToolBar* bar = fToolbarApp;
4842 if (!fDefaultIcons) {
4848 QList<QAction *> list = bar->actions ();
4849 for (
int i = 0; i < list.size(); ++i) {
4850 if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4851 list.at(i)->setChecked(
TRUE);
4852 }
else if (list.at(i)->data().toString () ==
"solid") {
4853 list.at(i)->setChecked(
FALSE);
4854 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4855 list.at(i)->setChecked(
FALSE);
4856 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4857 list.at(i)->setChecked(
FALSE);
4863void G4UIQt::SetIconPerspectiveSelected() {
4866 QToolBar* bar = fToolbarApp;
4867 if (!fDefaultIcons) {
4873 QList<QAction *> list = bar->actions ();
4874 for (
int i = 0; i < list.size(); ++i) {
4875 if (list.at(i)->data().toString () ==
"perspective") {
4876 list.at(i)->setChecked(
TRUE);
4877 }
else if (list.at(i)->data().toString () ==
"ortho") {
4878 list.at(i)->setChecked(
FALSE);
4885void G4UIQt::SetIconOrthoSelected() {
4888 QToolBar* bar = fToolbarApp;
4889 if (!fDefaultIcons) {
4895 QList<QAction *> list = bar->actions ();
4896 for (
int i = 0; i < list.size(); ++i) {
4897 if (list.at(i)->data().toString () ==
"ortho") {
4898 list.at(i)->setChecked(
TRUE);
4899 }
else if (list.at(i)->data().toString () ==
"perspective") {
4900 list.at(i)->setChecked(
FALSE);
4907G4QTabWidget::G4QTabWidget(
4911):QTabWidget(aParent)
4912 ,fTabSelected(false)
4914,fPreferedSizeX(sizeX+6)
4915,fPreferedSizeY(sizeY+58)
4917 setMinimumSize(100,100);
4918 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
4919 setSizePolicy(policy);
4922G4QTabWidget::G4QTabWidget(
4924 ,fTabSelected(false)
4932G4UIOutputString::G4UIOutputString(
4940 if (!GetOutputList().contains(QString(
" ")+outputStream+
" ")) {
4941 fOutputStream =
"info";
4943 fOutputStream = outputStream;
4948#if QT_VERSION < 0x040500
4949void G4UIQt::TabCloseCallback(
int){
4951void G4UIQt::TabCloseCallback(
int a){
4953#if QT_VERSION < 0x040500
4955 if (fViewerTabWidget == NULL)
return;
4958 QWidget* temp = fViewerTabWidget->widget(a);
4960 fViewerTabWidget->removeTab (a);
4963 bool lastTab =
true;
4964 for (
int c=0; c<fViewerTabWidget->count(); c++) {
4965 if (fViewerTabWidget->tabText(c).contains(
"viewer")) {
4971 CreateEmptyViewerPropertiesWidget();
4979void G4UIQt::ToolBoxActivated(
int a){
4981 if (fUITabWidget->widget(a) == fHelpTBWidget) {
4984 }
else if (fUITabWidget->widget(a) == fSceneTreeWidget) {
4985#if QT_VERSION < 0x040200
4986 fSceneTreeWidget->show();
4988 fSceneTreeWidget->setVisible(
true);
4994void G4QTabWidget::paintEvent(
4999 if (currentWidget()) {
5001 if ( isTabSelected()) {
5005 QString text = tabText (currentIndex());
5007 if (fLastCreated == -1) {
5008 QTextEdit* edit =
dynamic_cast<QTextEdit*
>(currentWidget());
5010 QString paramSelect = QString(
"/vis/viewer/select ")+text;
5019 setTabSelected(
false);
5025G4UIDockWidget::G4UIDockWidget(QString txt):
5030void G4UIDockWidget::closeEvent(QCloseEvent *aEvent) {
5031 setFloating (
false);
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4String GetFullPrefixString() const
G4String GetPrefixString() const
static G4StateManager * GetStateManager()
G4String & remove(str_size)
G4String & append(const G4String &)
str_size index(const char *, G4int pos=0) const
std::size_t last(char) const
G4bool contains(const std::string &) const
G4String strip(G4int strip_Type=trailing, char c=' ')
const char * data() const
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)
G4int GetVerboseLevel() const
G4String FindMacroPath(const G4String &fname) const
static G4UImanager * GetUIpointer()
G4MTcoutDestination * GetThreadCout()
void SetSession(G4UIsession *const value)
void SetG4UIWindow(G4UIsession *const value)
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
const char * name(G4int ptype)