43#include <qapplication.h>
44#include <qmessagebox.h>
49#include <qpushbutton.h>
52#include <qscrollbar.h>
56#include <qtextbrowser.h>
57#if QT_VERSION < 0x050600
58#include <qsignalmapper.h>
60#include <qtabwidget.h>
62#include <qstringlist.h>
63#include <qtextstream.h>
65#include <qmainwindow.h>
67#include <qlistwidget.h>
68#include <qtreewidget.h>
69#include <qheaderview.h>
71#include <qscrollarea.h>
73#include <qradiobutton.h>
74#include <qbuttongroup.h>
77#include <qcolordialog.h>
79#include <qfiledialog.h>
80#include <qdesktopwidget.h>
81#include <qtablewidget.h>
82#include <qcompleter.h>
83#include <qstandarditemmodel.h>
84#include <qboxlayout.h>
88#include "moc_G4UIQt.cpp"
122,fCoutTBTextArea(NULL)
127,fHistoryTBTableList(NULL)
128,fHelpTreeWidget(NULL)
130,fHistoryTBWidget(NULL)
131,fCoutDockWidget(NULL)
133,fSceneTreeWidget(NULL)
134,fViewerPropertiesWidget(NULL)
135,fPickInfosWidget(NULL)
137,fViewerTabWidget(NULL)
141,fParameterHelpLabel(NULL)
142,fParameterHelpTable(NULL)
145,fStringSeparator(
"__$$$@%%###__")
158,fHiddenLineRemovalIcon(NULL)
159,fHiddenLineAndSurfaceRemovalIcon(NULL)
160,fPerspectiveIcon(NULL)
166,fPickTargetIcon(NULL)
167#ifdef G4MULTITHREADED
168,fThreadsFilterComboBox(NULL)
170,fDefaultViewerFirstPageHTMLText(
"")
171,fViewerPropertiesDialog(NULL)
172,fPickInfosDialog(NULL)
173,fLastCompleteCommand(
"")
175,fRotateSelected(true)
177,fZoomInSelected(false)
178,fZoomOutSelected(false)
187 G4cout <<
"G4UIQt : Unable to init Qt. Aborted" <<
G4endl;
197 Q_FOREACH (QWidget *widget, QApplication::allWidgets()) {
198 if ((found==
false) && (widget->inherits(
"QMainWindow"))) {
208 G4cout <<
"G4UIQt : Found an external App with a QMainWindow already defined. Aborted" <<
G4endl;
215 for (
const auto& destination: {
"cout",
"cerr",
"warnings",
"errors"}) {
217 defaultStyle.
fixed =
true;
225 fMainWindow->setCorner( Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
226 fMainWindow->setCorner( Qt::TopRightCorner, Qt::RightDockWidgetArea );
227 fMainWindow->setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
228 fMainWindow->setCorner( Qt::BottomRightCorner, Qt::RightDockWidgetArea );
240#ifdef G4MULTITHREADED
245 fMainWindow->setWindowTitle(QFileInfo( QCoreApplication::applicationFilePath() ).fileName());
259 qRegisterMetaType<QTextCursor>(
"QTextCursor");
265 #if QT_VERSION < 0x040200
282#ifdef G4MULTITHREADED
293#if QT_VERSION < 0x040200
303#if QT_VERSION < 0x040200
310#if QT_VERSION < 0x040200
331 AddIcon(
"Open macro file",
"open",
"/control/execute");
332 AddIcon(
"Save viewer state",
"save",
"/vis/viewer/save");
335#if QT_VERSION < 0x050600
336 QSignalMapper *signalMapperViewerProperties =
new QSignalMapper(
this);
337 QAction *actionViewerProperties =
fToolbarApp->addAction(QIcon(*
fParamIcon),
"Viewer properties", signalMapperViewerProperties, SLOT(
map()));
340 signalMapperViewerProperties->setMapping(actionViewerProperties, intVP);
348 AddIcon(
"Zoom out",
"zoom_out",
"");
349 AddIcon(
"Zoom in",
"zoom_in",
"");
350 AddIcon(
"Rotate",
"rotate",
"");
353 AddIcon(
"Hidden line removal",
"hidden_line_removal",
"");
354 AddIcon(
"Hidden line and hidden surface removal",
"hidden_line_and_surface_removal",
"");
355 AddIcon(
"Surfaces",
"solid",
"");
356 AddIcon(
"Wireframe",
"wireframe",
"");
359 AddIcon(
"Perspective",
"perspective",
"");
360 AddIcon(
"Orthographic",
"ortho",
"");
361 AddIcon(
"Run beam on",
"runBeamOn",
"/run/beamOn 1");
362 AddIcon(
"Exit Application",
"exit",
"exit");
370 const char *
const save[]={
398 " +++++++++++++++++++++++++ ",
399 " +@##+$%%%%%%%%%%%%%%%&*$%&+ ",
400 " +=-;@>,,''',,,,,,,',,)&!,)+ ",
401 " +;-~@>,,,,,,,,,,,,,,,>$!,)+ ",
402 " +=-~@>,,,,,{]]]]]^,,,>*&$&+ ",
403 " +=-~@>,,,,,'{^{^^{,,,>*#=#+ ",
404 " +=-~@>,,,,,,,,,,,,,,,>@~/=+ ",
405 " +=-~@>,,,{{{''''{',,,>@~-=+ ",
406 " +=-~@>,,'^]]]]]]({,,,>@~-=+ ",
407 " +=-~@>,,,{{{{{{{{{,,,>@~-=+ ",
408 " +=-~@>,,,,,'{^{{^{,,,>@~-=+ ",
409 " +=-~@>,,,,,]]]]]]],,,>@~-=+ ",
410 " +=-~*>,,,,,,,,,,,,,,,>@~-=+ ",
411 " +=-~@>,,,,,,,,,,,,,,,>@~-=+ ",
412 " +=-/=$%%%%%%%%%%%%%%%$=/-=+ ",
413 " +=---;###############;---=+ ",
414 " +=---////////////////----=+ ",
415 " +=----------------///----=+ ",
416 " +=---=@##############@#--=+ ",
417 " +=---@+++++++++++*%))_+~-=+ ",
418 " +=---#+++++++++++&:,,>@~-=+ ",
419 " +=---#+++++++++++$',,>@~-=+ ",
420 " +=---#+++++++++++&!,,>@~-=+ ",
421 " +=/--#+++++++++++&',,>@~-=+ ",
422 " @;--#+++++++++++$',,>@~-=+ ",
423 " @;;@+++++++++++*)!>%@=;#+ ",
424 " @++++++++++++++*&**++@++ ",
431 const char *
const search[] = {
443 "OOOOOOOOOOOOOOOOOOO",
444 "OOOOOOOOOOOOOOOOOOO",
445 "OOOOOOOo. .oOOOOOO",
448 "OOOOO. XOOOOX .OOOO",
451 "OOOOO. XOOOOo .OOOO",
455 "OOOOOOOOOOOOO. XOO",
456 "OOOOOOOOOOOOOO. XOO",
457 "OOOOOOOOOOOOOOOoOOO",
458 "OOOOOOOOOOOOOOOOOOO",
459 "OOOOOOOOOOOOOOOOOOO",
460 "OOOOOOOOOOOOOOOOOOO",
461 "OOOOOOOOOOOOOOOOOOO"
465 const char *
const clear[] = {
477 "OOOOOOOOOOOOOOOOOOOO",
480 "OOOOOOOOOOOOOOOOOOOO",
481 "OOOOOOOOOOOOOOOOOOOO",
482 "OOOO XXXXXXXXXX OOOO",
483 "OOO XOOOOOOOOOO OOO",
484 "OOOOXOooOooOooO OOOO",
485 "OOOOXOooOooOooO OOOO",
486 "OOOOXOooOooOooO OOOO",
487 "OOOOXOooOooOooO OOOO",
488 "OOOOXOooOooOooO OOOO",
489 "OOOOXOooOooOooO OOOO",
490 "OOOOXOooOooOooO OOOO",
491 "OOOOXOooOooOooO OOOO",
492 "OOOOXOooOooOooO OOOO",
493 "OOOOXOooOooOooO OOOO",
494 "OOOOXOOOOOOOOOO OOOO",
495 "OOOOOooooooooooOOOOO",
496 "OOOOOO........OOOOOO"
502 const char *
const open[]={
546 " {]^/((_({- %%%%%%%%%%% ",
547 " {(^_^^^^:<{{{{{{{{{{{{{[& ",
548 " {/_/(((((/]]]]]]]]]]]/]!# ",
549 " {/^(((((_^^^^^^^^^^^^^^:# ",
550 " {/^(((_^^____________^^}$ ",
551 " {/^(((((/////////////((!# ",
552 " {/^/^_:<|||||||||||||||@@****1 ",
553 " {/^/^(<[)||||||||||||||))!!}<; ",
554 " {/^_(:|234444444444444444432)1 ",
555 " {/_^/<)34444444444444444443}, ",
556 " {/^(2{:41111111111111111142|5 ",
557 " {3^3<:31111111111111111143}- ",
558 " {/^2<:31111111111111111441|' ",
559 " {_/<:41111111111111111143}, ",
560 " {(4<:31111111111111111144!# ",
561 " )4))44111111111111111144}, ",
562 " )2<:31111111111111111144{# ",
563 " @|:14444444444444444444}* ",
564 " ;@434444444444444444434<# ",
565 " ;[))))))))))))))))))))!~ ",
566 " ++++++++++++++++++++++;% ",
573 const char *
const move[]={
606 " ')&$$$$*@@ @@*$$$$&)' ",
607 " ')&$$$$*@@ @@*$$$$&+' ",
626 const char *
const rotate[]={
662 " --------!*{{{*&, ",
663 " -------=){*{{{>>{) ",
664 " ,!-----= ){& ,&{{@",
672 " !-!!======!!(((---! ",
673 " ='--------------! ",
690 const char *
const pick[]={
706 "*********oo*********",
707 "*********oo*********",
708 "******$O. .O%******",
709 "****&o .O..O O*****",
710 "***&X @**oo**@ X****",
711 "***o $***oo***$ O***",
712 "**% @**********@ %**",
713 "**O.***********& +**",
714 "**.O*****@@*****o.**",
715 "oo .oo**@ #*&XX. oo",
716 "oo .oo**@ #*&oo. oO",
717 "**.O*****##*****oX**",
718 "**O ***********& +**",
719 "**% @****&&****+ &**",
720 "***O $***Xo***# +***",
721 "****X @&*Xo*&+ o****",
722 "*****O o..o +*****",
723 "******%+. X+&******",
724 "*********oo*********",
725 "*********oO*********"
729 const char *
const zoom_in[]={
751 " ++.%%%+&&&*%%.++ ",
752 " .+#%%%%+&&&*%%.#+ ",
753 " ++..%%%+&&&*%%%.++ ",
754 " +#.+++++&&&*++++.+ ",
755 " @.+&&&&&&&&&&&&&+@ ",
756 " @#+&&&&&&&&&&&&&+@ ",
757 " @.+&&&&&&&&&&&&&+. ",
758 " +++@***+&&&****@+. ",
759 " ....++++&&&*++++.. ",
760 " ++.===+&&&*%=.++ ",
761 " @..==+&&&*=..@#& ",
762 " .@+#.+&&&@-+@@*@ ",
777 const char *
const zoom_out[]={
799 " ++.$$$$$$$$$$.++ ",
800 " .+#$$$$$$$$$$$.#+ ",
801 " ++..$$$$$$$$$$$.++ ",
802 " +#.+++++++++++++.+ ",
803 " @.+&&&&&&&&&&&&&+@ ",
804 " @#+&&&&&&&&&&&&&+@ ",
805 " @.+&&&&&&&&&&&&&+. ",
806 " +++@***********@+. ",
807 " ....++++++++++++.. ",
808 " ++.===$$$$$$=.++ ",
809 " @..===$$$$=..@#& ",
810 " .@+#.$$$..-+@@*@ ",
825 const char *
const wireframe[]={
854 " +&********&@-***; ",
855 " +@@@&**&@@@@@@$ @*-&>&+ ",
856 " +*****&+ %*@ ,**'# ",
857 " @***)!~ @*{&*****+ ",
858 " @*!]***&+ +-*^**'~!*@ ",
859 " @*~ +@&**&@@@@@@&****&+ ~*@ ",
860 " @*@ +&********&-*= @*@ ",
861 " @*@ $%@-*-@$ @*@ @*@ ",
869 " @*@ =*-+ @*@ @*@ ",
870 " @*@ $%@@&****&@-*-+ @*@ ",
871 " @*@ $@&*****&@@&******&~~!*@ ",
872 " @*{/***&@@%$ $@-*-&*****+ ",
873 " @*)*)(-~ @*@ ~)**] ",
874 " +*******&@@@@+ %*_+]**] ",
875 " +@@@@@&******&@%+_*^**]# ",
886 const char *
const solid[]={
924 " +-;>>>>>>>>>,')!~ ",
925 " {]@@-;>>>>>>>>>>>>^/(_= ",
926 " {:>>>>>>>>>>>>>>>>><//[)!= ",
927 " ]>>>>>>>>>>>>>>>>>><////[)} ",
928 " @>>>>>>>>>>>>>>>>>><//////| ",
929 " @>>>>>>>>>>>>>>>>>><//////| ",
930 " @>>>>>>>>>>>>>>>>>><//////| ",
931 " @>>>>>>>>>>>>>>>>>><//////| ",
932 " @>>>>>>>>>>>>>>>>>><//////| ",
933 " @>>>>>>>>>>>>>>>>>><//////| ",
934 " @>>>>>>>>>>>>>>>>>><//////| ",
935 " @>>>>>>>>>>>>>>>>>><//////| ",
936 " @>>>>>>>>>>>>>>>>>><//////| ",
937 " @>>>>>>>>>>>>>>>>>><//////| ",
938 " @>>>>>>>>>>>>>>>>>><//////| ",
939 " @>>>>>>>>>>>>>>>>>><//////| ",
940 " @>>>>>>>>>>>>>>>>>><//////| ",
941 " @>>>>>>>>>>>>>>>>>><//////| ",
942 " @>>>>>>>>>>>>>>>>>></////[1 ",
943 " @>>>>>>>>>>>>>>>>>><////[*2 ",
944 " {:>>>>>>>>>>>>>>>>><//[)12 ",
945 " +@@@@@-;>>>>>>>>>><[)13 ",
956 const char *
const hidden_line_removal[]={
976 " +#$$$$$$$$#@&$$$* ",
977 " =-@@#$$#@@@@@-= @$&#;>= ",
978 " =$$$$$#+ -$@ *$$%+ ",
979 " -$&@-= -$- #$$$= ",
995 " -$&@@@-= -$- =>;, ",
996 " =$$$$$$$#@@@-= -$'+#$$, ",
997 " =-@@@@#$$$$$$#@-+'$)$$#+ ",
1008 const char *
const hidden_line_and_surface_removal[]={
1054 " ++@%####&*=-#+;>, ",
1055 " +++++@'=)))))))!)~+{]^++ ",
1056 " +$%&*=)!!!!!!!!!)~+/(]_+++ ",
1057 " +#-))!!!!!!!!!!!)~+/(::<[+ ",
1058 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1059 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1060 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1061 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1062 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1063 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1064 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1065 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1066 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1067 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1068 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1069 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1070 " +#)!!!!!!!!!!!!!!}+/::::{+ ",
1071 " +#)!!!!!!!!!!!!!!}+/:::|1+ ",
1072 " +$#}}~23!!!!!!!!)~+/(]45, ",
1073 " +++++++@#}}~23!!)~+678++ ",
1074 " ++++++@#~90+a++ ",
1085 const char *
const perspective[]={
1095 " ................ ",
1096 " ....+++++++++++++++. ",
1097 " ...++++..+.........+++. ",
1098 " ..++..............++..+. ",
1099 " .+++++++++++++++++.. .+. ",
1100 " .+...............+. .+. ",
1101 " .+. .+. .+. .+. ",
1102 " .+. .+. .+. .+. ",
1103 " .+. .+. .+. .+. ",
1104 " .+. .+. .+. .+. ",
1105 " .+. .+. .+. .+. ",
1106 " .+. .+. .+. .+. ",
1107 " .+. .+. .+. .+. ",
1108 " .+. .+. .+. .+. ",
1109 " .+. .+......+....+. ",
1110 " .+. ..++++++.+.++++. ",
1111 " .+. .++.......+...+.. ",
1112 " .+. .++. .+..++. ",
1113 " .+. ..+.. .+..+. ",
1116 " .+++.............++. ",
1117 " .+++++++++++++++++. ",
1118 " ................... ",
1125 const char *
const ortho[]={
1133 " ................... ",
1134 " ..@@@@@@@@@@@@@@@@@. ",
1135 " ..@@@.............@@@. ",
1136 " ..@@.@. ..@..@. ",
1137 " ..@@ ..@. .@@...@. ",
1138 " ..@@..............@@.. .@. ",
1139 " .@@@@@@@@@@@@@@@@@.. .@. ",
1140 " .@...............@. .@. ",
1141 " .@. .@. .@. .@. ",
1142 " .@. .@. .@. .@. ",
1143 " .@. .@. .@. .@. ",
1144 " .@. .@. .@. .@. ",
1145 " .@. .@. .@. .@. ",
1146 " .@. .@. .@. .@. ",
1147 " .@. .@. .@. .@. ",
1148 " .@. .@. .@. .@. ",
1149 " .@. .@. .@. .@. ",
1150 " .@. .@. .@. .@. ",
1151 " .@. .@........@......@. ",
1152 " .@. .@@@@@@@@@.@.@@@@@@. ",
1153 " .@. .@@+........@....@@.. ",
1154 " .@...@. .@...@... ",
1156 " .@@@.............@@@.. ",
1157 " .@@@@@@@@@@@@@@@@@... ",
1158 " ................... ",
1165 const char *
const commandIcon[]={
1193 "66666666666666666666",
1194 "66%++++++++++++++&56",
1195 "6$ o..o......o..o *6",
1196 "6+o...o*<441;@.o..+6",
1197 "6+..o@1553<354$..o+6",
1198 "6+..o<5<@ .*54#o.+6",
1207 "6+..O25<@ X=54#o.+6",
1208 "6+.o.@1553<354$...@6",
1209 "6+o..oo*<44<;@o..o+6",
1210 "6$ .o..o.....o..o *6",
1211 "66%+++++OOOO+++++*66",
1212 "66666666666666666666"
1216 const char *
const dirIcon[]={
1244 "66666666666666666666",
1245 "66$oOOOOOOOOOOOOo%66",
1248 "6o =635533666$ o6",
1249 "6o -65:+ +165X o6",
1258 "6o -65:+ @265X o6",
1259 "6o =635543665# O6",
1262 "66$OOOoo....OOOOo%66",
1263 "66666666666666666666"}
1268 const char *
const runIcon[]={
1305 "rrrrrrrr%<<2rrrrrrrr",
1306 "rrrrr5=$$$$===rrrrrr",
1307 "rrrr<##$$$$$---&rrrr",
1308 "rrr=###$$$$-----%rrr",
1309 "rr=####$$$$------&rr",
1310 "r2@####7##$-------rr",
1311 "r.@####048$-------Or",
1312 "r.@####q4ee=----$@.r",
1313 " .@@###w4eee5%$#@@@X",
1314 " .@@@..w4eeeeqo..@@X",
1315 " .@..ooe<eeee7Oooo@X",
1316 " ..oooOe2eee6OOOooo ",
1317 "rOooOO+e2ew2+++++O+r",
1318 "r:oO+++e30,;;;;;++Or",
1319 "r :++;:9,>,,>>:;;1rr",
1320 "rr*1;:>,333333,>32rr",
1321 "rrr66,1367777637<rrr",
1322 "rrrr509799999905rrrr",
1323 "rrrrr=8wqwwww8-rrrrr",
1324 "rrrrrrrr4444rrrrrrrr"
1328 const char *
const paramIcon[]={
1367 "wwwwwwww5 5wwwwwwww",
1368 "wwwwwwww, ,wwwwwwww",
1369 "www&;ww7+ +9ww=-www",
1375 "5<+ .wwwwwww0. +<5",
1378 "5<+ .wwwwwww0X +<5",
1384 "www*>ww7+ +7ww=:www",
1385 "wwwwwwww1 1wwwwwwww",
1386 "wwwwwwww5 5wwwwwwww"
1390 const char *
const exitIcon[]={
1456 " rMMMM# jMMM MMMMx ",
1457 " OMMMMk jMMM 8MMMM9 ",
1458 " xMMMM jMMM pMMMM ",
1459 " MMMM jMMM xMMM8 ",
1470 " <MMMMMp: $rMMMMMp ",
1471 " yMMMMMMMMMMMMMMk ",
1489 QVBoxLayout *layoutHistoryTB =
new QVBoxLayout();
1508 QWidget *helpWidget =
new QWidget();
1509 QHBoxLayout *helpLayout =
new QHBoxLayout();
1510 QVBoxLayout *vLayout =
new QVBoxLayout();
1513 helpLayout->addWidget(
new QLabel(
"Search :"));
1534 QSizePolicy policy = QSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
1535 policy.setVerticalStretch(4);
1539 policy = QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
1540 policy.setVerticalStretch(1);
1544 vLayout->addWidget(helpWidget);
1546 vLayout->setContentsMargins(5,5,5,5);
1548 helpWidget->setLayout(helpLayout);
1560 QWidget* coutTBWidget =
new QWidget();
1562 QVBoxLayout *layoutCoutTB =
new QVBoxLayout();
1569#if QT_VERSION > 0x050100
1571 fCoutFilter->setStyleSheet (
"border-radius:7px;");
1573 QPushButton *coutTBFilterButton =
new QPushButton();
1575 coutTBFilterButton->setStyleSheet (
"padding-left: 0px; border:0px;");
1576 fCoutFilter->setStyleSheet (
"padding-right: 0px;");
1579 QPushButton *coutTBClearButton =
new QPushButton();
1581 coutTBClearButton->setToolTip(
"Clear console output");
1582 coutTBClearButton->setStyleSheet (
"border-radius:7px;");
1586 QPushButton *coutTBSaveOutputButton =
new QPushButton();
1587 coutTBSaveOutputButton->setIcon(*
fSaveIcon);
1588 coutTBSaveOutputButton->setToolTip(
"Save console output");
1589 coutTBSaveOutputButton->setStyleSheet (
"border-radius:7px;");
1594 QWidget* coutButtonWidget =
new QWidget();
1595 QHBoxLayout* layoutCoutTBButtons =
new QHBoxLayout();
1597#ifdef G4MULTITHREADED
1599 fThreadsFilterComboBox =
new QComboBox();
1600 fThreadsFilterComboBox->setInsertPolicy(QComboBox::InsertAlphabetically);
1603 UpdateCoutThreadFilter();
1605 fThreadsFilterComboBox->setToolTip(
"Thread selection in output");
1606 layoutCoutTBButtons->addWidget(
new QLabel(
" Threads:"));
1607 layoutCoutTBButtons->addWidget(fThreadsFilterComboBox);
1611#if QT_VERSION <= 0x050100
1612 layoutCoutTBButtons->addWidget(coutTBFilterButton);
1614 layoutCoutTBButtons->addWidget(coutTBClearButton);
1615 layoutCoutTBButtons->addWidget(coutTBSaveOutputButton);
1616 coutButtonWidget->setLayout(layoutCoutTBButtons);
1619 layoutCoutTBButtons->setContentsMargins(3,3,3,0);
1621 layoutCoutTB->addWidget(coutButtonWidget);
1624 coutTBWidget->setLayout(layoutCoutTB);
1629 QWidget* commandLineWidget =
new QWidget();
1630 QHBoxLayout *layoutCommandLine =
new QHBoxLayout();
1654 commandLineWidget->setLayout(layoutCommandLine);
1655 commandLineWidget->setMinimumSize(50,50);
1657 layoutCoutTB->addWidget(commandLineWidget);
1660 fCoutDockWidget->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
1689 fUITabWidget->setTabToolTip (0,
"Scene component tree. Only available in Stored mode");
1691 fUITabWidget->setTabToolTip (2,
"All commands history");
1695 fUIDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
1706 QVBoxLayout* layout =
new QVBoxLayout();
1709#if QT_VERSION < 0x040200
1723 SetStartPage(std::string(
"<table width='100%'><tr><td width='30%'></td><td><div ")+
1724 "style='color: rgb(140, 31, 31); font-size: xx-large; font-family: Garamond, serif; padding-bottom: 0px; font-weight: normal'>Geant4: "+
1725 QApplication::applicationName ().toStdString()+
1726 "</div></td><td width='40%'> <br/><i>http://cern.ch/geant4/</i></td></tr></table>"+
1728 "<div style='background:#EEEEEE;'><b>Tooltips :</b><ul>"+
1729 "<li><b>Start a new viewer :</b><br />"+
1730 "<i>'/vis/open/...'<br />"+
1731 "For example '/vis/open OGL'</i></li>"+
1732 "<li><b>Execute a macro file :</b><br />"+
1733 "<i>'/control/execute my_macro_file'</i></li>"+
1736 "<div style='background:#EEEEEE;'><b>Documentation :</b><ul>"+
1737 "<li><b>Visualisation publication :</b><br />"+
1738 "<i><a href='http://www.worldscientific.com/doi/abs/10.1142/S1793962313400011'>The Geant4 Visualization System - A Multi-Driver Graphics System</b><br />, Allison, J. et al., International Journal of Modeling, Simulation, and Scientific Computing, Vol. 4, Suppl. 1 (2013) 1340001</a>:<br/> http://www.worldscientific.com/doi/abs/10.1142/S1793962313400011</i></li>"+
1741 "<div style='background:#EEEEEE;'><b>Getting Help :</b><ul>"+
1742 "<li><b>If problems arise, try <a href='https://cern.ch/geant4-forum'>browsing the user forum</a> to see whether or not your problem has already been encountered.<br /> If it hasn't, you can post it and Geant4 developers will do their best to find a solution. This is also a good place to<br /> discuss Geant4 topics in general.</b> https://cern.ch/geant4-forum"+
1743 "<li><b>Get a look at <a href='http://cern.ch/geant4/support'>Geant4 User support pages</a>: <i>http://cern.ch/geant4/support</i></b></li>"+
1752#if QT_VERSION < 0x040500
1757#if QT_VERSION < 0x040200
1762#if QT_VERSION < 0x040500
1770 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
1771 policy.setVerticalStretch(4);
1828 std::string fileName
1837 if(UI==NULL)
return 0;
1841 std::string content( (std::istreambuf_iterator<char>(
file) ),
1842 (std::istreambuf_iterator<char>() ) );
1844 QTextEdit* text =
new QTextEdit();
1845 text->setAcceptRichText (
true);
1846 text->setContentsMargins(5,5,5,5);
1847 text->setText(QString(
"<pre>")+content.c_str()+
"</pre>");
1848 text->setReadOnly(
true);
1871 #if QT_VERSION < 0x050100
1872 #if QT_VERSION >= 0x050000
1873 QString message = QString(
1874 "This Qt version [")+qVersion ()+
"] has some issues with the OpenGL viewer.\n"+
1875 "To prevent problems, you are not allowed to open a Stored nor Immediate viewer.\n" +
1877 "Please upgrade to Qt version >= 5.1\n";
1880 tr(message.toStdString().c_str()),
1903 #if QT_VERSION < 0x040200
1918const std::string& text)
1943 #if QT_VERSION < 0x040200
1974 QCoreApplication::sendPostedEvents () ;
1976 #if QT_VERSION < 0x040200
1983#if QT_VERSION < 0x040200
1990#if QT_VERSION < 0x040200
2025 if (!aPrompt)
return;
2054 if (!aState)
return;
2056 if(aState==
"G4_pause> ") {
2060 if(aState==
"EndOfEvent") {
2062 SecondaryLoop (
"End of event, type continue to exit this state");
2076 if (!aPrompt)
return;
2082 ((QApplication*)interactorManager)->processEvents(QEventLoop::WaitForMoreEvents);
2088#ifdef G4MULTITHREADED
2106 if(aString.empty())
return 0;
2108#ifdef G4MULTITHREADED
2120#ifdef G4MULTITHREADED
2123 std::cout << aString;
2134 for (
size_t i = 0; i < aString.length() - 1; ++i) {
2135 if (aString[i] ==
'\n') {
2136 aStringWithStyle +=
"<br>";
2137 }
else if (aString[i] ==
' ') {
2138 aStringWithStyle +=
" ";
2139 }
else if (aString[i] ==
'\t') {
2140 aStringWithStyle +=
" ";
2141 }
else if (aString[i] ==
'<') {
2142 aStringWithStyle +=
"<";
2144 aStringWithStyle += aString[i];
2148 aStringWithStyle =
"<span style='font-family:courier;'>" + aStringWithStyle +
"</span>";
2150 aStringWithStyle =
"<span>" + aStringWithStyle +
"</span>";
2157#ifdef G4MULTITHREADED
2163 if (result.isEmpty()) {
2171 result = QString(
"<span style='background:") + pal.link().color().name() +
";'> </span>"
2172 +
"<span style='background:" + pal.highlight().color().name() +
";'> " + result +
"</span>";
2180#ifdef G4MULTITHREADED
2181 UpdateCoutThreadFilter();
2199 if (aString.empty())
return 0;
2201#ifdef G4MULTITHREADED
2207#ifdef G4MULTITHREADED
2210 std::cerr << aString;
2221 for (
size_t i = 0; i < aString.length() - 1; ++i) {
2222 if (aString[i] ==
'\n') {
2223 aStringWithStyle +=
"<br>";
2224 }
else if (aString[i] ==
' ') {
2225 aStringWithStyle +=
" ";
2226 }
else if (aString[i] ==
'\t') {
2227 aStringWithStyle +=
" ";
2228 }
else if (aString[i] ==
'<') {
2229 aStringWithStyle +=
"<";
2231 aStringWithStyle += aString[i];
2235 aStringWithStyle =
"<span style='font-family:courier;'>" + aStringWithStyle +
"</span>";
2237 aStringWithStyle =
"<span>" + aStringWithStyle +
"</span>";
2247#ifdef G4MULTITHREADED
2252 if (result.isEmpty()) {
2257 if (QString(aString.data()).trimmed() !=
"") {
2263#if QT_VERSION < 0x050000
2264 criticalMessage = Qt::escape(criticalMessage);
2266 criticalMessage = criticalMessage.toHtmlEscaped();
2272 result + QString(
"</font>"));
2275 if (QString(aString.data()).trimmed() !=
"") {
2278#ifdef G4MULTITHREADED
2279 UpdateCoutThreadFilter();
2287#ifdef G4MULTITHREADED
2289 if(UI==NULL)
return "";
2297 return threadPrefix;
2301#ifdef G4MULTITHREADED
2302void G4UIQt::UpdateCoutThreadFilter() {
2304 if(UI==NULL)
return;
2307 if (fThreadsFilterComboBox->count() < 2) {
2308 if ( fThreadsFilterComboBox->findText(
"All", Qt::MatchExactly) == -1) {
2309 fThreadsFilterComboBox->addItem(
"All");
2312 if (fThreadsFilterComboBox->count() < 2) {
2313 if ( fThreadsFilterComboBox->findText(
"Master", Qt::MatchExactly) == -1) {
2314 fThreadsFilterComboBox->addItem(
"Master");
2320 if ( fThreadsFilterComboBox->findText(
prefix.data(), Qt::MatchExactly) == -1) {
2321 fThreadsFilterComboBox->addItem(
prefix.data());
2338 if (aName == NULL)
return;
2339 if (aLabel == NULL)
return;
2341 QMenu *fileMenu =
new QMenu(aLabel);
2357,
const char* aCommand
2360 if(aMenu==NULL)
return;
2361 if(aLabel==NULL)
return;
2362 if(aCommand==NULL)
return;
2366 if(parentTmp==NULL) {
2371 G4cout <<
"Menu name " << aMenu<<
" does not exist, please define it before using it."<<
G4endl;
2378 if(UI==NULL)
return;
2382 G4int cmdEndPos = cmd.find_first_of(
" \t");
2383 if(cmdEndPos!=
G4int(std::string::npos)) {
2384 cmd.erase(cmdEndPos);
2387 if(treeTop->
FindPath(cmd) == NULL) {
2389 cmd.substr(0,3) !=
"ls " &&
2392 cmd.substr(0,3) !=
"cd " &&
2394 cmd.substr(0,5) !=
"help " &&
2406 G4cout <<
"Warning: command '"<< cmd <<
"' does not exist, please define it before using it."<<
G4endl;
2411#if QT_VERSION < 0x050600
2412 QSignalMapper *signalMapper =
new QSignalMapper(
this);
2413 QAction *
action = parentTmp->addAction(aLabel, signalMapper, SLOT(
map()));
2416 signalMapper->setMapping(
action, QString(aCommand));
2418 QString cmd_tmp = QString(aCommand);
2419 parentTmp->addAction(aLabel,
this, [
this, cmd_tmp](){ this->
ButtonCallback(cmd_tmp); });
2429void G4UIQt::AddIcon(
const char* aLabel,
const char* aIconFile,
const char* aCommand,
const char* aFileName){
2430 if(aLabel==NULL)
return;
2432 if (aCommand==NULL) {
2433 if (std::string(aIconFile) ==
"user_icon") {
2438 bool userToolBar =
false;
2443 if (std::string(aIconFile) ==
"user_icon") {
2446 pix =
new QPixmap(UImanager->
FindMacroPath(aFileName).data());
2447 if (pix->isNull()) {
2451 G4cout <<
"Warning: file '"<< aFileName <<
"' is incorrect or does not exist, this command will not be build"<<
G4endl;
2455 }
else if (std::string(aIconFile) ==
"open") {
2457 }
else if (std::string(aIconFile) ==
"save") {
2459 }
else if (std::string(aIconFile) ==
"move") {
2461 }
else if (std::string(aIconFile) ==
"rotate") {
2463 }
else if (std::string(aIconFile) ==
"pick") {
2465 }
else if (std::string(aIconFile) ==
"zoom_in") {
2467 }
else if (std::string(aIconFile) ==
"zoom_out") {
2469 }
else if (std::string(aIconFile) ==
"wireframe") {
2471 }
else if (std::string(aIconFile) ==
"solid") {
2473 }
else if (std::string(aIconFile) ==
"hidden_line_removal") {
2475 }
else if (std::string(aIconFile) ==
"hidden_line_and_surface_removal") {
2477 }
else if (std::string(aIconFile) ==
"perspective") {
2479 }
else if (std::string(aIconFile) ==
"ortho") {
2481 }
else if (std::string(aIconFile) ==
"runBeamOn") {
2483 }
else if (std::string(aIconFile) ==
"exit") {
2490 G4cout <<
"Parameter"<< aIconFile <<
" not defined"<<
G4endl;
2494 QToolBar *currentToolbar = NULL;
2513 QList<QAction*> list = currentToolbar->actions();
2515 for (
int i = 0; i < list.size(); ++i) {
2516 if (list.at(i)->text() == QString(aLabel)) {
2518 if(UI==NULL)
return;
2521 G4cout <<
"Warning: A toolBar icon \""<< aLabel<<
"\" already exists with the same name!" <<
G4endl;
2526#if QT_VERSION < 0x050600
2527 QSignalMapper *signalMapper =
new QSignalMapper(
this);
2528 QAction *
action = currentToolbar->addAction(QIcon(*pix),aLabel, signalMapper, SLOT(
map()));
2531 if (std::string(aIconFile) ==
"open") {
2533#if QT_VERSION < 0x050600
2535 signalMapper->setMapping(
action, QString(txt));
2537 currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->
OpenIconCallback(txt); });
2541 }
else if (std::string(aIconFile) ==
"save") {
2543#if QT_VERSION < 0x050600
2545 signalMapper->setMapping(
action, QString(txt));
2547 currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->
SaveIconCallback(txt); });
2551 }
else if ((std::string(aIconFile) ==
"move") ||
2552 (std::string(aIconFile) ==
"rotate") ||
2553 (std::string(aIconFile) ==
"pick") ||
2554 (std::string(aIconFile) ==
"zoom_out") ||
2555 (std::string(aIconFile) ==
"zoom_in")) {
2556#if QT_VERSION < 0x050600
2558 signalMapper->setMapping(
action, QString(aIconFile));
2560 QString txt = QString(aIconFile);
2561 QAction*
action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->
ChangeCursorAction(txt); });
2565 action->setData(aIconFile);
2567 if (std::string(aIconFile) ==
"move") {
2570 if (std::string(aIconFile) ==
"rotate") {
2573 if (std::string(aIconFile) ==
"pick") {
2576 if (std::string(aIconFile) ==
"zoom_in") {
2579 if (std::string(aIconFile) ==
"zoom_out") {
2584 }
else if ((std::string(aIconFile) ==
"hidden_line_removal") ||
2585 (std::string(aIconFile) ==
"hidden_line_and_surface_removal") ||
2586 (std::string(aIconFile) ==
"solid") ||
2587 (std::string(aIconFile) ==
"wireframe")) {
2588#if QT_VERSION < 0x050600
2590 signalMapper->setMapping(
action, QString(aIconFile));
2592 QString txt = QString(aIconFile);
2593 QAction*
action = currentToolbar->addAction(QIcon(*pix), aIconFile,
this, [
this, txt](){ this->
ChangeSurfaceStyle(txt); });
2597 action->setData(aIconFile);
2599 if (std::string(aIconFile) ==
"hidden_line_removal") {
2602 if (std::string(aIconFile) ==
"hidden_line_and_surface_removal") {
2605 if (std::string(aIconFile) ==
"solid") {
2608 if (std::string(aIconFile) ==
"wireframe") {
2613 }
else if ((std::string(aIconFile) ==
"perspective") ||
2614 (std::string(aIconFile) ==
"ortho")) {
2615#if QT_VERSION < 0x050600
2617 signalMapper->setMapping(
action, QString(aIconFile));
2619 QString txt = QString(aIconFile);
2624 action->setData(aIconFile);
2626 if (std::string(aIconFile) ==
"perspective") {
2629 if (std::string(aIconFile) ==
"ortho") {
2637 if(UI==NULL)
return;
2639 if (aCommand != NULL) {
2640 std::string str = aCommand;
2641 std::string::size_type
pos = str.find(
" ");
2642 if (
pos != std::string::npos)
2644 str = str.substr(0,
pos).c_str();
2646 if(treeTop->
FindPath(str.c_str()) == NULL) {
2651 G4cout <<
"Warning: command '"<< aCommand <<
"' does not exist, please define it before using it."<<
G4endl;
2656#if QT_VERSION < 0x050600
2658 signalMapper->setMapping(
action, QString(aCommand));
2660 QString txt = QString(aCommand);
2661 currentToolbar->addAction(QIcon(*pix), aCommand,
this, [
this, txt](){ this->
ButtonCallback(txt); });
2673 G4String uiQtDestination(destination);
2675 if (
G4String(style) ==
"fixed") uiQtStyle.
fixed =
true;
else uiQtStyle.
fixed =
false;
2677 if (uiQtDestination ==
"all") {
2679 i.second = uiQtStyle;
2688 if (
fMainWindow->menuBar()->isNativeMenuBar() == aVal )
2708 size_t i = newCommand.find(
" ");
2710 if( i != std::string::npos )
2712 G4String newValue = newCommand.substr(i+1,newCommand.length()-(i+1));
2716 if (targetCom !=
"") {
2739 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
2741 labels << QString(
"Command");
2763 if (searchText ==
"") {
2776#if QT_VERSION < 0x040200
2784 if(UI==NULL)
return;
2788 QTreeWidgetItem * newItem = NULL;
2789 QString commandText =
"";
2790 for (
int a=0;a<treeSize;a++) {
2794 commandText = QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()).trimmed();
2802 if (newItem == NULL) {
2804 newItem =
new QTreeWidgetItem();
2822 QTreeWidgetItem *aParent
2826 if (aParent == NULL)
return;
2827 if (aCommandTree == NULL)
return;
2831 QTreeWidgetItem * newItem;
2833 QString commandText =
"";
2837 commandText = QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()).trimmed();
2841 if (newItem == NULL) {
2842 newItem =
new QTreeWidgetItem();
2844 aParent->addChild(newItem);
2853 QStringList stringList;
2858 if (newItem == NULL) {
2859 newItem =
new QTreeWidgetItem();
2861 aParent->addChild(newItem);
2863#if QT_VERSION < 0x040202
2866 newItem->setExpanded(
false);
2887 QString commandText = QString((
char*)(aCommand->
GetCommandPath().data())).section(
"/",-aDepthLevel);
2889 if (commandText == NULL) {
2895 QWidget* newParentWidget = NULL;
2897 QString commandSection = commandText.left(commandText.indexOf(
"/"));
2899 if (aDepthLevel == 1) {
2900 QToolBox* currentParent =
dynamic_cast<QToolBox*
>(aParent);
2901 if (currentParent != 0){
2904 for (
int a=0; a<currentParent->count(); a++) {
2905 if (currentParent->itemText(a) == commandSection) {
2907 newParentWidget = currentParent->widget(a);
2913 newParentWidget =
new QGroupBox();
2914 newParentWidget->setLayout(
new QVBoxLayout());
2915 if (currentParent != 0){
2916 currentParent->addItem(newParentWidget,commandSection);
2918 if (!aParent->layout()) {
2919 aParent->setLayout(
new QVBoxLayout());
2921 aParent->layout()->addWidget(newParentWidget);
2924 if (commandText.indexOf(
"/") == -1) {
2929 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
2930 guidance += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
2932 newParentWidget->setToolTip(guidance);
2935 QScrollArea* sc =
dynamic_cast<QScrollArea*
>(newParentWidget->parent()->parent());
2937 sc->ensureWidgetVisible(newParentWidget);
2944 QGroupBox* currentParent =
dynamic_cast<QGroupBox*
>(aParent);
2945 if (currentParent != 0){
2949 if (aDepthLevel == 2){
2950 QToolBox* parentToolBox =
dynamic_cast<QToolBox*
>(currentParent->parent()->parent()->parent());
2951 if (parentToolBox != 0) {
2955 for (
int a=0; a<aParent->layout()->count(); a++) {
2956 QGroupBox* gb =
dynamic_cast<QGroupBox*
>(aParent->layout()->itemAt(a)->widget());
2958 if (gb->title() == commandSection) {
2960 newParentWidget = gb;
2968 newParentWidget =
new QGroupBox();
2969 newParentWidget->setLayout(
new QVBoxLayout());
2970 if (!aParent->layout()) {
2971 aParent->setLayout(
new QVBoxLayout());
2973 aParent->layout()->addWidget(newParentWidget);
2979 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
2980 guidance += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
2982 newParentWidget->setToolTip(guidance);
2987 if (commandText.indexOf(
"/") == -1) {
3007 if (aCommand == NULL) {
3014 if( n_parameterEntry > 0 ) {
3018 QWidget* paramWidget =
new QWidget();
3019 QGridLayout* gridLayout =
new QGridLayout();
3020 paramWidget->setLayout(gridLayout);
3023 unsigned int nbColorParameter = 0;
3024 bool isStillColorParameter =
false;
3025 bool isColorDialogAdded =
false;
3026 QLabel* redLabel = NULL;
3027 QLabel* greenLabel = NULL;
3028 QString redDefaultStr =
"";
3029 QString greenDefaultStr =
"";
3030 QString blueDefaultStr =
"";
3031 QWidget* redInput = NULL;
3032 QWidget* greenInput = NULL;
3034 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3037 QLabel* label =
new QLabel(QString((
char*)(param->
GetParameterName()).data()));
3039 if ((label->text() ==
"red") || (label->text() ==
"red_or_string")){
3040 nbColorParameter ++;
3041 isStillColorParameter =
true;
3042 }
else if ((label->text() ==
"green") && isStillColorParameter) {
3043 nbColorParameter ++;
3044 }
else if ((label->text() ==
"blue") && isStillColorParameter) {
3045 nbColorParameter ++;
3046 }
else if (!isColorDialogAdded) {
3049 if (nbColorParameter == 1) {
3050 gridLayout->addWidget(redLabel,i_thParameter-1,0);
3051 gridLayout->addWidget(redInput,i_thParameter-1,1);
3052 }
else if (nbColorParameter == 2) {
3053 gridLayout->addWidget(redLabel,i_thParameter-2,0);
3054 gridLayout->addWidget(redInput,i_thParameter-2,1);
3055 gridLayout->addWidget(greenLabel,i_thParameter-1,0);
3056 gridLayout->addWidget(greenInput,i_thParameter-1,1);
3058 nbColorParameter = 0;
3061 QWidget* input = NULL;
3063 input =
new QLineEdit();
3065 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
3067 if (((label->text() ==
"red") || (label->text() ==
"red_or_string")) && isStillColorParameter) {
3069 }
else if ((label->text() ==
"green") && isStillColorParameter) {
3071 }
else if ((label->text() ==
"green") && isStillColorParameter) {
3076 input =
new QWidget();
3077 QHBoxLayout* layout =
new QHBoxLayout();
3078 input->setLayout(layout);
3080 QButtonGroup* buttons =
new QButtonGroup();
3081 QRadioButton* radioOff =
new QRadioButton(
"0");
3082 QRadioButton* radioOn =
new QRadioButton(
"1");
3083 buttons->addButton(radioOn);
3084 buttons->addButton(radioOff);
3085 layout->addWidget(radioOn);
3086 layout->addWidget(radioOff);
3089 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
3090 if (defaultValue ==
"0") {
3091 radioOff->setChecked(
true);
3092 }
else if (defaultValue ==
"1") {
3093 radioOn->setChecked(
true);
3096 input =
new QComboBox();
3098 QStringList list = candidates.split (
" ");
3101 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
3102 for (
int a=0; a<list.size(); a++) {
3103 dynamic_cast<QComboBox*
>(input)->addItem(list.at(a));
3104 if (list.at(a) == defaultValue) {
3105 dynamic_cast<QComboBox*
>(input)->setCurrentIndex(a);
3110 input =
new QLineEdit();
3112 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
3115 input =
new QWidget();
3116 QHBoxLayout* layout =
new QHBoxLayout();
3117 input->setLayout(layout);
3119 QButtonGroup* buttons =
new QButtonGroup();
3120 QRadioButton* radioOff =
new QRadioButton(
"off");
3121 QRadioButton* radioOn =
new QRadioButton(
"on");
3122 buttons->addButton(radioOn);
3123 buttons->addButton(radioOff);
3124 layout->addWidget(radioOn);
3125 layout->addWidget(radioOff);
3128 QString defaultValue = QString((
char*)(param->
GetDefaultValue()).data());
3129 if (defaultValue ==
"off") {
3130 radioOff->setChecked(
true);
3131 }
else if (defaultValue ==
"on") {
3132 radioOn->setChecked(
true);
3136 input =
new QLineEdit();
3137 dynamic_cast<QLineEdit*
>(input)->setText(QString((
char*)(param->
GetDefaultValue()).data()));
3140 txt +=
"\nParameter : " + QString((
char*)(param->
GetParameterName()).data()) +
"\n";
3144 txt +=
" Parameter type : " + QString(QChar(param->
GetParameterType())) +
"\n";
3146 txt +=
" Omittable : True\n";
3148 txt +=
" Omittable : False\n";
3151 txt +=
" Default value : taken from the current value\n";
3153 txt +=
" Default value : " + QString((
char*)(param->
GetDefaultValue()).data())+
"\n";
3156 txt +=
" Parameter range : " + QString((
char*)(param->
GetParameterRange()).data())+
"\n";
3162 if (isStillColorParameter && (nbColorParameter != 0)) {
3163 if ((label->text() ==
"red") || (label->text() ==
"red_or_string")) {
3166 }
else if (label->text() ==
"green") {
3169 }
else if (label->text() ==
"blue") {
3175 if ((redDefaultStr !=
"") && (redDefaultStr !=
"") && (redDefaultStr !=
"")) {
3176 qc.setRgbF(redDefaultStr.toDouble(),
3177 greenDefaultStr.toDouble(),
3178 blueDefaultStr.toDouble());
3180 QPixmap pixmap = QPixmap(QSize(16, 16));
3182 QPainter painter(&pixmap);
3183 painter.setPen(Qt::black);
3184 painter.drawRect(0,0,15,15);
3186 input =
new QPushButton(
"Change color");
3187 dynamic_cast<QPushButton*
>(input)->setIcon(pixmap);
3188 dynamic_cast<QPushButton*
>(input)->setAccessibleName(redDefaultStr+
" "+greenDefaultStr+
" "+blueDefaultStr);
3189 label =
new QLabel(
"Choose color");
3193 gridLayout->addWidget(label,i_thParameter-nbColorParameter,0);
3194 input->setToolTip(
"Select the current color");
3195 gridLayout->addWidget(input,i_thParameter-nbColorParameter,1);
3198#if QT_VERSION < 0x050600
3199 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3200 signalMapper->setMapping(input,input);
3201 connect(input, SIGNAL(clicked()), signalMapper, SLOT(
map()));
3206 isColorDialogAdded =
true;
3207 isStillColorParameter =
false;
3210 gridLayout->addWidget(label,i_thParameter-nbColorParameter,0);
3211 input->setToolTip(txt);
3212 gridLayout->addWidget(input,i_thParameter-nbColorParameter,1);
3218 gridLayout->addWidget(
name,n_parameterEntry-nbColorParameter,0);
3220 QPushButton* applyButton =
new QPushButton(
"Apply");
3223 gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,1);
3225#if QT_VERSION < 0x050600
3226 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3227 signalMapper->setMapping(applyButton, paramWidget);
3228 connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(
map()));
3236 applyButton->setAutoDefault(
TRUE );
3237 applyButton->setDefault(
TRUE );
3239 QPushButton* cancelButton =
new QPushButton( tr(
"&Cancel" ));
3240 cancelButton->setAutoDefault(
TRUE );
3241 gridLayout->addWidget(cancelButton,n_parameterEntry-nbColorParameter,1);
3242 gridLayout->addWidget(applyButton,n_parameterEntry-nbColorParameter,0);
3244#if QT_VERSION < 0x050600
3245 QSignalMapper* signalMapper =
new QSignalMapper(
this);
3246 signalMapper->setMapping(applyButton, paramWidget);
3247 connect(applyButton, SIGNAL(clicked()), signalMapper, SLOT(
map()));
3253 QWidget * parentCheck = aParent;
3254 QDialog* parentDialog = NULL;
3256 while ((parentCheck->parentWidget()) != NULL) {
3257 parentCheck = parentCheck->parentWidget();
3258 parentDialog =
dynamic_cast<QDialog*
>(parentCheck);
3260 connect( applyButton, SIGNAL( clicked() ), parentDialog, SLOT( accept() ) );
3261 connect( cancelButton, SIGNAL( clicked() ), parentDialog, SLOT( reject() ) );
3270 if (!aParent->layout()) {
3271 aParent->setLayout(
new QVBoxLayout());
3273 aParent->layout()->addWidget(paramWidget);
3285 QTreeWidgetItem *aParent
3286,
const QString& aCommand
3289 if (aParent == NULL)
return NULL;
3292 QString myCommand = aCommand;
3294 if (myCommand.lastIndexOf(
"/") == (myCommand.size()-1)) {
3295 myCommand = myCommand.left(myCommand.size()-1);
3301 QTreeWidgetItem * tmp = NULL;
3302 for (
int a=0;a<aParent->childCount();a++) {
3324 if (aCommand == NULL)
3332 if ((commandPath ==
"") &&
3333 (rangeString ==
"") &&
3334 (n_guidanceEntry == 0) &&
3335 (n_parameterEntry == 0)) {
3339 if((commandPath.length()-1)!=
'/') {
3340 txt +=
"Command " + QString((
char*)(commandPath).data()) +
"\n";
3342 txt +=
"Guidance :\n";
3344 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3345 txt += QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data()) +
"\n";
3347 if( ! rangeString.empty() ) {
3348 txt +=
" Range of parameters : " + QString((
char*)(rangeString).data()) +
"\n";
3350 if( n_parameterEntry > 0 ) {
3355 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3357 txt +=
"\nParameter : " + QString((
char*)(param->
GetParameterName()).data()) +
"\n";
3360 txt +=
" Parameter type : " + QString(QChar(param->
GetParameterType())) +
"\n";
3362 txt +=
" Omittable : True\n";
3364 txt +=
" Omittable : False\n";
3367 txt +=
" Default value : taken from the current value\n";
3369 txt +=
" Default value : " + QString((
char*)(param->
GetDefaultValue()).data())+
"\n";
3372 txt +=
" Parameter range : " + QString((
char*)(param->
GetParameterRange()).data())+
"\n";
3401 if (aCommand == NULL)
3409 if ((commandPath ==
"") &&
3410 (rangeString ==
"") &&
3411 (n_guidanceEntry == 0) &&
3412 (n_parameterEntry == 0)) {
3416 if((commandPath.length()-1)!=
'/') {
3417 txt +=
"<b>Command </b> " + QString((
char*)(commandPath).data()) +
"<br />";
3419 txt +=
"<b>Guidance :</b> ";
3420 QString tmpGuidance =
"";
3421 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3422 tmpGuidance = QString((
char*)(aCommand->
GetGuidanceLine(i_thGuidance)).data());
3423#if QT_VERSION < 0x050000
3424 tmpGuidance = Qt::escape(tmpGuidance);
3426 tmpGuidance = tmpGuidance.toHtmlEscaped();
3428 tmpGuidance.replace(
"\n",
"<br />");
3429 txt += tmpGuidance +
"<br />";
3431 if( ! rangeString.empty() ) {
3432 QString range = QString((
char*)(rangeString).data());
3433#if QT_VERSION < 0x050000
3434 range = Qt::escape(range);
3436 range = range.toHtmlEscaped();
3439 txt +=
"<b>Range of parameters : </b> " + range +
"<br />";
3445 if( n_parameterEntry > 0 ) {
3466#if QT_VERSION < 0x050000
3470 fParameterHelpTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
3476 QFont fnt = t->font();
3477 int size = fnt.pointSize();
3478 fnt.setPointSize(size-2);
3480 for(
G4int a=0; a<n_parameterEntry; a++ ) {
3496 fParameterHelpTable->setItem(a, 5,
new QTableWidgetItem(QString(
"taken from the current value")));
3507 for (
int b=0; b<8; b++) {
3510 tmp->setToolTip(tmp->text());
3511 tmp->setFlags(Qt::NoItemFlags);
3516 for (
int c=0; c<8; c++) {
3537 if (aCommand == NULL)
3542 if( n_parameterEntry > 0 ) {
3547 for(
G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
3589 bool tabKeyPress =
false;
3590 bool moveCommandCursor =
false;
3591 if (aObj == NULL)
return false;
3592 if (aEvent == NULL)
return false;
3595 if (aEvent->type() == QEvent::KeyPress) {
3601 if (aEvent->type() == QEvent::KeyPress) {
3602 QKeyEvent *e =
static_cast<QKeyEvent*
>(aEvent);
3603 if (e->key() == (Qt::Key_Tab)) {
3606 }
else if ( aEvent->type() == QEvent::Hide ) {
3614 if (aEvent->type() == QEvent::KeyPress) {
3615 QKeyEvent *e =
static_cast<QKeyEvent*
>(aEvent);
3616 if ((e->key() == (Qt::Key_Down)) ||
3617 (e->key() == (Qt::Key_PageDown)) ||
3618 (e->key() == (Qt::Key_Up)) ||
3619 (e->key() == (Qt::Key_PageUp))) {
3622 if (selection == -1) {
3625 if (e->key() == (Qt::Key_Down)) {
3628 }
else if (e->key() == (Qt::Key_PageDown)) {
3630 }
else if (e->key() == (Qt::Key_Up)) {
3633 }
else if (e->key() == (Qt::Key_PageUp)) {
3638#if QT_VERSION < 0x040202
3645 moveCommandCursor =
true;
3646 }
else if (e->key() == (Qt::Key_Tab)) {
3648 }
else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_A)) {
3651 }
else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_E)) {
3655 }
else if (aEvent->type() == QEvent::Paint) {
3662 if (tabKeyPress ==
true) {
3674 if (moveCommandCursor ==
true) {
3679 res = QObject::eventFilter(aObj, aEvent);
3692 fCompleter->popup()->removeEventFilter(
this);
3704 int Ndir= aTree-> GetTreeEntry();
3708 fCompleter->popup()->installEventFilter(
this);
3714 QList< QStandardItem*> dirModelList;
3715 QList< QStandardItem*> commandModelList;
3716 QList< QStandardItem*> subDirModelList;
3717 QList< QStandardItem*> subCommandModelList;
3728 auto jpre= pName.rfind(
'/');
3729 if(jpre != G4String::npos) pName.erase(jpre+1);
3734 int Ndir= aTree-> GetTreeEntry();
3735 int Ncmd= aTree-> GetCommandEntry();
3738 for(
G4int idir=1; idir<=Ndir; idir++) {
3739 G4String fpdir= aTree-> GetTree(idir)-> GetPathName();
3741 if( fpdir.find(remainingPath, 0) == 0) {
3743 matchingPath = fpdir;
3750 QStandardItem* item1 =
new QStandardItem(fpdir.data());
3754 dirModelList.append(item1);
3758 for (
int a=0; a< subModel->rowCount(); a++) {
3761 QStandardItem* tempItem =
new QStandardItem(subModel->item(a)->text());
3762 tempItem->setIcon(subModel->item(a)->icon());
3763 tempItem->setToolTip(subModel->item(a)->toolTip());
3764 tempItem->setData(subModel->item(a)->data());
3767 if (tempItem->data() == 1) {
3769 subDirModelList.append(tempItem);
3772 else if (tempItem->data() == 0) {
3773 subCommandModelList.append(tempItem);
3780 G4int n_parameterEntry;
3782 G4int n_guidanceEntry;
3785 std::string tooltip;
3788 for(
G4int icmd=1; icmd<=Ncmd; icmd++){
3791 command = aTree-> GetCommand(icmd);
3792 G4String longCommandName= aTree-> GetPathName() +
3793 command -> GetCommandName();
3800 if( longCommandName.find(remainingPath, 0) ==0) {
3802 matchingPath= longCommandName +
" ";
3804 strtmp= longCommandName +
" ";
3809 for(
G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
3810 tooltip += std::string((command->
GetGuidanceLine(i_thGuidance)).data());
3811 if (i_thGuidance < n_guidanceEntry-1 ) {
3817 for(
G4int a=0; a<n_parameterEntry; a++ ) {
3828 QStandardItem* item =
new QStandardItem(
G4String(longCommandName + params).data());
3831 item->setToolTip(tooltip.c_str());
3833 commandModelList.append(item);
3838 QStandardItemModel* model =
new QStandardItemModel();
3840 model->setColumnCount(1);
3843 for (
int a= 0; a< dirModelList.size(); a++) {
3844 model->appendRow(dirModelList.at(a));
3846 for (
int a= 0; a< subDirModelList.size(); a++) {
3847 model->appendRow(subDirModelList.at(a));
3849 for (
int a= 0; a< commandModelList.size(); a++) {
3850 model->appendRow(commandModelList.at(a));
3852 for (
int a= 0; a< subCommandModelList.size(); a++) {
3853 model->appendRow(subCommandModelList.at(a));
3905#if QT_VERSION < 0x050F00
3907 QStringList list =
fCommandArea->text().split(QRegExp(
"[\r\n]"),QString::SkipEmptyParts);
3910 QStringList list =
fCommandArea->text().split(QRegExp(
"[\r\n]"),Qt::SkipEmptyParts);
3914 for (
int a=0; a< list.size(); a++) {
3915 QString txt (list[a].trimmed());
3922 if (interactorManager) {
3926 G4String command = txt.toStdString().c_str();
3927 if (command.substr(0,4) !=
"help") {
3954#if QT_VERSION < 0x050F00
3956 QStringList list =
fCommandArea->text().split(QRegExp(
"[\r\n]"),QString::SkipEmptyParts);
3959 QStringList list =
fCommandArea->text().split(QRegExp(
"[\r\n]"),Qt::SkipEmptyParts);
3962 if (list.size() > 1) {
3963 for (
int a=0; a<list.size()-1; a++) {
3978 if (widget == NULL) {
3983 QGridLayout* grid =
dynamic_cast<QGridLayout*
>(widget->layout());
3988#if QT_VERSION < 0x040400
3989 QWidget*
name = grid->itemAt(grid->columnCount()*(grid->rowCount()-2))->widget();
3991 QWidget*
name = grid->itemAtPosition(grid->rowCount()-1,0)->widget();
3993 if (
dynamic_cast<QLabel*
>(
name) == 0) {
3996 command += (
dynamic_cast<QLabel*
>(
name))->text()+
" ";
3998 for (
int a=0;a<grid->rowCount()-1; a++) {
3999#if QT_VERSION < 0x040400
4000 QWidget* widgetTmp = grid->itemAt(a*grid->columnCount()+1)->widget();
4002 QWidget* widgetTmp = grid->itemAtPosition(a,1)->widget();
4006 if (widgetTmp != NULL) {
4008 if (
dynamic_cast<QLineEdit*
>(widgetTmp) != 0) {
4009 command += (
dynamic_cast<QLineEdit*
>(widgetTmp))->text()+
" ";
4011 }
else if (
dynamic_cast<QComboBox*
>(widgetTmp) != 0){
4012 command += (
dynamic_cast<QComboBox*
>(widgetTmp))->itemText((
dynamic_cast<QComboBox*
>(widgetTmp))->currentIndex())+
" ";
4015 }
else if (
dynamic_cast<QPushButton*
>(widgetTmp) != 0){
4016 command += widgetTmp->accessibleName()+
" ";
4019 }
else if (
dynamic_cast<QWidget*
>(widgetTmp) != 0){
4020 if (widgetTmp->layout()->count() > 0){
4021 if (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()) != 0) {
4022 QAbstractButton * checked = (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()))->group()->checkedButton();
4024 command += (
dynamic_cast<QRadioButton*
>(widgetTmp->layout()->itemAt(0)->widget()))->group()->checkedButton()->text()+
" ";
4032 if (command !=
"") {
4047 const QString& aCommand
4053 if(UI==NULL)
return;
4061 QDialog* menuParameterDialog =
new QDialog();
4064 menuParameterDialog->setWindowTitle (aCommand);
4065 menuParameterDialog->setSizePolicy (QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
4068 menuParameterDialog->exec();
4071 delete menuParameterDialog;
4091 QTreeWidgetItem* item = NULL;
4098 item = list.first();
4103 if(UI==NULL)
return;
4109 if (item->childCount() > 0) {
4135 QTreeWidgetItem* item = NULL;
4142 item = list.first();
4157 QListWidgetItem* item = NULL;
4165 item = list.first();
4189 QString fileName = QFileDialog::getSaveFileName(
fMainWindow,
"Save console output as...",
fLastOpenPath,
"Save output as...");
4190 if (fileName !=
"") {
4192 QFile data(fileName);
4193 if (data.open(QFile::WriteOnly | QFile::Truncate)) {
4194 QTextStream out(&data);
4205,
const QString& currentThread
4206,
const QString& filter
4209#ifdef G4MULTITHREADED
4210 if ((currentThread ==
"All") ||
4211 (currentThread == output.
fThread)) {
4213 if (currentThread ==
"") {
4215 if (output.
fText.contains(QRegExp(filter))) {
4216 return output.
fText;
4225 QString currentThread =
"";
4226#ifdef G4MULTITHREADED
4227 currentThread = fThreadsFilterComboBox->currentText();
4228 if (currentThread ==
"Master") {
4233 G4String previousOutputStream =
"";
4251 pref =
"<font color=\"DarkYellow\">";
4254 pref =
"<font color=\"Red\">";
4276 if (searchText ==
"") {
4290 const QString & searchText
4295 if(UI==NULL)
return;
4307#if QT_VERSION < 0x050F00
4309 QMap<int,QString> commandResultMap;
4310 QMap<int,QString> commandChildResultMap;
4311 for (
int a=0;a<treeSize;a++) {
4313 tmp =
GetCommandList (command).count(searchText,Qt::CaseInsensitive);
4315 commandResultMap.insertMulti(tmp,QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()));
4320 if (!commandChildResultMap.empty()) {
4321 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4322 while (i != commandChildResultMap.constEnd()) {
4323 commandResultMap.insertMulti(i.key(),i.value());
4326 commandChildResultMap.clear();
4331 QMultiMap<int,QString> commandResultMap;
4332 QMultiMap<int,QString> commandChildResultMap;
4333 for (
int a=0;a<treeSize;a++) {
4335 tmp =
GetCommandList (command).count(searchText,Qt::CaseInsensitive);
4337 commandResultMap.insert(tmp,QString((
char*)(treeTop->
GetTree(a+1)->
GetPathName()).data()));
4342 if (!commandChildResultMap.empty()) {
4343 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4344 while (i != commandChildResultMap.constEnd()) {
4345 commandResultMap.insert(i.key(),i.value());
4348 commandChildResultMap.clear();
4354 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
4357 labels << QString(
"Command") << QString(
"Match");
4360 if (commandResultMap.empty()) {
4366 QMap<int,QString>::const_iterator i = commandResultMap.constEnd();
4369 float multValue = 10.0/(float)(i.key());
4370 QString progressChar =
"|";
4371 QString progressStr =
"|";
4373 QTreeWidgetItem * newItem;
4376 if (i == commandResultMap.constBegin()) {
4379 for(
int a=0;a<int(i.key()*multValue);a++) {
4380 progressStr += progressChar;
4382 newItem =
new QTreeWidgetItem();
4383 QString commandStr = i.value().trimmed();
4385 if (commandStr.indexOf(
"/") == 0) {
4386 commandStr = commandStr.right(commandStr.size()-1);
4389 newItem->setText(0,commandStr);
4390 newItem->setText(1,progressStr);
4392#if QT_VERSION < 0x040200
4394 newItem->setForeground ( 1, QBrush(Qt::blue) );
4404#if QT_VERSION < 0x050F00
4408,
const QString & text
4411 QMap<int,QString> commandResultMap;
4412 if (aCommandTree == NULL)
return commandResultMap;
4415 QMap<int,QString> commandChildResultMap;
4420 commandResultMap.insertMulti(tmp,QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()));
4424 if (!commandChildResultMap.empty()) {
4426 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4427 while (i != commandChildResultMap.constEnd()) {
4428 commandResultMap.insertMulti(i.key(),i.value());
4431 commandChildResultMap.clear();
4442 return commandResultMap;
4448,
const QString & text
4451 QMultiMap<int,QString> commandResultMap;
4452 if (aCommandTree == NULL)
return commandResultMap;
4455 QMultiMap<int,QString> commandChildResultMap;
4460 commandResultMap.insert(tmp,QString((
char*)(aCommandTree->
GetTree(a+1)->
GetPathName()).data()));
4464 if (!commandChildResultMap.empty()) {
4466 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
4467 while (i != commandChildResultMap.constEnd()) {
4468 commandResultMap.insert(i.key(),i.value());
4471 commandChildResultMap.clear();
4482 return commandResultMap;
4491 if (commandPath.indexOf(
"/") == 0) {
4492 commandPath = commandPath.right(commandPath.size()-1);
4495 commandPath = commandPath.right(commandPath.size()-commandPath.lastIndexOf(
"/",-2)-1);
4497 if (commandPath.lastIndexOf(
"/") == (commandPath.size()-1)) {
4498 commandPath = commandPath.left(commandPath.size()-1);
4506 QTreeWidgetItem* item
4509 if (item == NULL)
return "";
4512 QString itemText =
"";
4513 itemText = item->text(0);
4515 while (item->parent() != NULL) {
4516 itemText = item->parent()->text(0)+
"/"+itemText;
4517 item = item->parent();
4519 itemText =
"/"+itemText;
4526 if (widget == NULL) {
4530 QPushButton* button =
dynamic_cast<QPushButton*
>(widget);
4534 QString value = button->accessibleName();
4537 old.setRgbF(value.section(
" ",0,1).toDouble(),
4538 value.section(
" ",1,2).toDouble(),
4539 value.section(
" ",2,3).toDouble());
4540#if QT_VERSION < 0x040500
4542 QColor color = QColor(QColorDialog::getRgba (old.rgba(),&a,
fUITabWidget));
4544 QColor color = QColorDialog::getColor(old,
4547 QColorDialog::ShowAlphaChannel);
4551 if (color.isValid()) {
4553 QPixmap pixmap = QPixmap(QSize(16, 16));
4554 pixmap.fill (color);
4555 QPainter painter(&pixmap);
4556 painter.setPen(Qt::black);
4557 painter.drawRect(0,0,15,15);
4559 button->setAccessibleName(QString::number(color.redF())+
" "+
4560 QString::number(color.greenF())+
" "+
4561 QString::number(color.blueF())+
" "
4563 button->setIcon(pixmap);
4582 for (
int i = 0; i < list.size(); ++i) {
4583 if (list.at(i)->data().toString () ==
action) {
4584 list.at(i)->setChecked(
TRUE);
4585 if (list.at(i)->data().toString () ==
"pick") {
4593 }
else if (list.at(i)->data().toString () ==
"move") {
4595 list.at(i)->setChecked(
FALSE);
4596 }
else if (list.at(i)->data().toString () ==
"pick") {
4598 list.at(i)->setChecked(
FALSE);
4603 }
else if (list.at(i)->data().toString () ==
"rotate") {
4605 list.at(i)->setChecked(
FALSE);
4606 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4608 list.at(i)->setChecked(
FALSE);
4609 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4611 list.at(i)->setChecked(
FALSE);
4630 for (
int i = 0; i < list.size(); ++i) {
4631 if (list.at(i)->data().toString () ==
action) {
4632 list.at(i)->setChecked(
TRUE);
4633 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4634 list.at(i)->setChecked(
FALSE);
4635 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4636 list.at(i)->setChecked(
FALSE);
4637 }
else if (list.at(i)->data().toString () ==
"solid") {
4638 list.at(i)->setChecked(
FALSE);
4639 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4640 list.at(i)->setChecked(
FALSE);
4645 if (
action ==
"hidden_line_removal") {
4649 }
else if (
action ==
"hidden_line_and_surface_removal") {
4653 }
else if (
action ==
"solid") {
4657 }
else if (
action ==
"wireframe") {
4669 QString nomFich = QFileDialog::getOpenFileName(
fMainWindow, aLabel,
fLastOpenPath,
"Macro files (*.mac);;Geant4 files( *.mac *.g4* *.in);;All (*.*)");
4670 if (nomFich !=
"") {
4684 if (nomFich !=
"") {
4704 QVBoxLayout* layoutPropertiesWidget =
new QVBoxLayout();
4710 QVBoxLayout* layoutDialog =
new QVBoxLayout();
4713 layoutDialog->setContentsMargins(0,0,0,0);
4726 fPickInfosDialog->setSizePolicy (QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
4730 QVBoxLayout* layoutPickInfos =
new QVBoxLayout();
4736 QVBoxLayout* layoutDialog =
new QVBoxLayout();
4739 layoutDialog->setContentsMargins(0,0,0,0);
4749 QLayoutItem * wItem;
4752 delete wItem->widget();
4757 QLabel* label =
new QLabel(
"No viewer - Please open a viewer first");
4765 QLayoutItem * wItem;
4768 delete wItem->widget();
4773 QLabel* label =
new QLabel(
"Click on the object you want to pick");
4795 QString checked =
"";
4796 for (
int i = 0; i < list.size(); ++i) {
4797 if (list.at(i)->data().toString () ==
action) {
4798 list.at(i)->setChecked(
TRUE);
4799 checked = list.at(i)->data().toString ();
4800 }
else if (list.at(i)->data().toString () ==
"perspective") {
4801 list.at(i)->setChecked(
FALSE);
4802 }
else if (list.at(i)->data().toString () ==
"ortho") {
4803 list.at(i)->setChecked(
FALSE);
4807 if ((
action ==
"ortho") && (checked ==
"ortho")) {
4809 }
else if ((
action ==
"perspective") && (checked ==
"perspective")) {
4826 for (
int i = 0; i < list.size(); ++i) {
4827 if (list.at(i)->data().toString () ==
"move") {
4828 list.at(i)->setChecked(
TRUE);
4829 }
else if (list.at(i)->data().toString () ==
"rotate") {
4830 list.at(i)->setChecked(
FALSE);
4831 }
else if (list.at(i)->data().toString () ==
"pick") {
4832 list.at(i)->setChecked(
FALSE);
4833 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4834 list.at(i)->setChecked(
FALSE);
4835 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4836 list.at(i)->setChecked(
FALSE);
4852 for (
int i = 0; i < list.size(); ++i) {
4853 if (list.at(i)->data().toString () ==
"rotate") {
4854 list.at(i)->setChecked(
TRUE);
4855 }
else if (list.at(i)->data().toString () ==
"move") {
4856 list.at(i)->setChecked(
FALSE);
4857 }
else if (list.at(i)->data().toString () ==
"pick") {
4858 list.at(i)->setChecked(
FALSE);
4859 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4860 list.at(i)->setChecked(
FALSE);
4861 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4862 list.at(i)->setChecked(
FALSE);
4882 QList<QAction *> list =
bar->actions ();
4883 for (
int i = 0; i < list.size(); ++i) {
4884 if (list.at(i)->data().toString () ==
"pick") {
4885 list.at(i)->setChecked(
TRUE);
4886 }
else if (list.at(i)->data().toString () ==
"move") {
4887 list.at(i)->setChecked(
FALSE);
4888 }
else if (list.at(i)->data().toString () ==
"rotate") {
4889 list.at(i)->setChecked(
FALSE);
4890 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4891 list.at(i)->setChecked(
FALSE);
4892 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4893 list.at(i)->setChecked(
FALSE);
4913 QList<QAction *> list =
bar->actions ();
4914 for (
int i = 0; i < list.size(); ++i) {
4915 if (list.at(i)->data().toString () ==
"zoom_in") {
4916 list.at(i)->setChecked(
TRUE);
4917 }
else if (list.at(i)->data().toString () ==
"move") {
4918 list.at(i)->setChecked(
FALSE);
4919 }
else if (list.at(i)->data().toString () ==
"rotate") {
4920 list.at(i)->setChecked(
FALSE);
4921 }
else if (list.at(i)->data().toString () ==
"pick") {
4922 list.at(i)->setChecked(
FALSE);
4923 }
else if (list.at(i)->data().toString () ==
"zoom_out") {
4924 list.at(i)->setChecked(
FALSE);
4944 QList<QAction *> list =
bar->actions ();
4945 for (
int i = 0; i < list.size(); ++i) {
4946 if (list.at(i)->data().toString () ==
"zoom_out") {
4947 list.at(i)->setChecked(
TRUE);
4948 }
else if (list.at(i)->data().toString () ==
"move") {
4949 list.at(i)->setChecked(
FALSE);
4950 }
else if (list.at(i)->data().toString () ==
"rotate") {
4951 list.at(i)->setChecked(
FALSE);
4952 }
else if (list.at(i)->data().toString () ==
"pick") {
4953 list.at(i)->setChecked(
FALSE);
4954 }
else if (list.at(i)->data().toString () ==
"zoom_in") {
4955 list.at(i)->setChecked(
FALSE);
4970 QList<QAction *> list =
bar->actions ();
4971 for (
int i = 0; i < list.size(); ++i) {
4972 if (list.at(i)->data().toString () ==
"solid") {
4973 list.at(i)->setChecked(
TRUE);
4974 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4975 list.at(i)->setChecked(
FALSE);
4976 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
4977 list.at(i)->setChecked(
FALSE);
4978 }
else if (list.at(i)->data().toString () ==
"wireframe") {
4979 list.at(i)->setChecked(
FALSE);
4994 QList<QAction *> list =
bar->actions ();
4995 for (
int i = 0; i < list.size(); ++i) {
4996 if (list.at(i)->data().toString () ==
"wireframe") {
4997 list.at(i)->setChecked(
TRUE);
4998 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
4999 list.at(i)->setChecked(
FALSE);
5000 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
5001 list.at(i)->setChecked(
FALSE);
5002 }
else if (list.at(i)->data().toString () ==
"solid") {
5003 list.at(i)->setChecked(
FALSE);
5019 QList<QAction *> list =
bar->actions ();
5020 for (
int i = 0; i < list.size(); ++i) {
5021 if (list.at(i)->data().toString () ==
"hidden_line_removal") {
5022 list.at(i)->setChecked(
TRUE);
5023 }
else if (list.at(i)->data().toString () ==
"solid") {
5024 list.at(i)->setChecked(
FALSE);
5025 }
else if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
5026 list.at(i)->setChecked(
FALSE);
5027 }
else if (list.at(i)->data().toString () ==
"wireframe") {
5028 list.at(i)->setChecked(
FALSE);
5044 QList<QAction *> list =
bar->actions ();
5045 for (
int i = 0; i < list.size(); ++i) {
5046 if (list.at(i)->data().toString () ==
"hidden_line_and_surface_removal") {
5047 list.at(i)->setChecked(
TRUE);
5048 }
else if (list.at(i)->data().toString () ==
"solid") {
5049 list.at(i)->setChecked(
FALSE);
5050 }
else if (list.at(i)->data().toString () ==
"hidden_line_removal") {
5051 list.at(i)->setChecked(
FALSE);
5052 }
else if (list.at(i)->data().toString () ==
"wireframe") {
5053 list.at(i)->setChecked(
FALSE);
5069 QList<QAction *> list =
bar->actions ();
5070 for (
int i = 0; i < list.size(); ++i) {
5071 if (list.at(i)->data().toString () ==
"perspective") {
5072 list.at(i)->setChecked(
TRUE);
5073 }
else if (list.at(i)->data().toString () ==
"ortho") {
5074 list.at(i)->setChecked(
FALSE);
5091 QList<QAction *> list =
bar->actions ();
5092 for (
int i = 0; i < list.size(); ++i) {
5093 if (list.at(i)->data().toString () ==
"ortho") {
5094 list.at(i)->setChecked(
TRUE);
5095 }
else if (list.at(i)->data().toString () ==
"perspective") {
5096 list.at(i)->setChecked(
FALSE);
5107):QTabWidget(aParent)
5108 ,fTabSelected(false)
5110,fPreferedSizeX(sizeX+6)
5111,fPreferedSizeY(sizeY+58)
5113 setMinimumSize(100,100);
5114 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
5115 setSizePolicy(policy);
5120 ,fTabSelected(false)
5144#if QT_VERSION < 0x040500
5149#if QT_VERSION < 0x040500
5159 bool lastTab =
true;
5181#if QT_VERSION < 0x040200
5195 if (currentWidget()) {
5197 if ( isTabSelected()) {
5201 QString text = tabText (currentIndex());
5203 if (fLastCreated == -1) {
5204 QTextEdit* edit =
dynamic_cast<QTextEdit*
>(currentWidget());
5206 QString paramSelect = QString(
"/vis/viewer/select ")+text;
5215 setTabSelected(
false);
5227 setFloating (
false);
static const G4double pos
static constexpr double bar
#define G4MUTEX_INITIALIZER
static G4bool exitSession
G4GLOB_DLL std::ostream G4cout
G4String GetFullPrefixString() const
G4String GetPrefixString() const
static G4Qt * getInstance()
void FlushAndWaitExecution()
static G4StateManager * GetStateManager()
G4UIOutputString(QString text, G4String thread="", G4String outputstream="info")
void UpdateCommandCompleter()
QTextEdit * fParameterHelpLabel
G4QTabWidget * fViewerTabWidget
void SetIconPickSelected()
QWidget * GetViewerPropertiesWidget()
void SetIconOrthoSelected()
void ClearButtonCallback()
QPixmap * fPerspectiveIcon
std::vector< G4UIOutputString > fG4OutputString
void FilterAllOutputTextArea()
G4String GetThreadPrefix()
QWidget * CreateSceneTreeWidget()
void CreateViewerWidget()
bool eventFilter(QObject *, QEvent *)
void DefaultIcons(bool aVal)
void TabCloseCallback(int)
QDialog * fViewerPropertiesDialog
void SetStartPage(const std::string &)
QString FilterOutput(const G4UIOutputString &, const QString &, const QString &)
G4UIDockWidget * CreateUITabWidget()
void LookForHelpStringCallback()
void ChangePerspectiveOrtho(const QString &)
QWidget * fViewerPropertiesWidget
void CreateEmptyViewerPropertiesWidget()
virtual void PauseSessionStart(const G4String &)
void ViewerPropertiesIconCallback(int)
void OpenHelpTreeOnCommand(const QString &)
void SetIconZoomInSelected()
G4bool IsGUICommand(const G4UIcommand *)
void InitHelpTreeAndVisParametersWidget()
std::string fDefaultViewerFirstPageHTMLText
QString GetLongCommandPath(QTreeWidgetItem *)
bool CreateCommandWidget(G4UIcommand *command, QWidget *parent, bool isDialog)
QWidget * fHistoryTBWidget
void SetDefaultIconsToolbar()
QWidget * GetSceneTreeWidget()
void CommandEnteredCallback()
void CoutFilterCallback(const QString &)
void ChangeCursorAction(const QString &)
void ChangeColorCallback(QWidget *)
QPixmap * fHiddenLineAndSurfaceRemovalIcon
QTabWidget * fUITabWidget
void CreateViewerPropertiesDialog()
QStandardItemModel * CreateCompleterModel(G4String aCmd)
void CreateEmptyPickInfosWidget()
void OpenIconCallback(const QString &)
QDialog * fPickInfosDialog
void SetIconZoomOutSelected()
QWidget * fPickInfosWidget
QTreeWidget * fHelpTreeWidget
QWidget * fSceneTreeWidget
void SetIconHLRSelected()
std::map< G4String, G4UIQtStyle > fOutputStyles
QMainWindow * fMainWindow
void SetIconPerspectiveSelected()
virtual G4bool GetHelpChoice(G4int &)
QString fLastCompleteCommand
QWidget * CreateHistoryTBWidget()
QString GetCommandList(const G4UIcommand *)
virtual G4int ReceiveG4cout(const G4String &)
void HelpTreeClicCallback()
void ChangeSurfaceStyle(const QString &)
void CommandEditedCallback(const QString &text)
virtual G4int ReceiveG4cerr(const G4String &)
G4UIsession * SessionStart()
QWidget * GetPickInfosWidget()
void CreateHelpTree(QTreeWidgetItem *, G4UIcommandTree *)
void SetIconSolidSelected()
G4UIDockWidget * CreateCoutTBWidget()
void SaveOutputCallback()
G4UIDockWidget * fCoutDockWidget
void SaveIconCallback(const QString &)
void CreatePickInfosDialog()
void SetIconRotateSelected()
QWidget * CreateVisParametersTBWidget()
QSplitter * fHelpVSplitter
void ToolBoxActivated(int)
void UpdateTabWidget(int)
QWidget * CreateHelpTBWidget()
void AddButton(const char *, const char *, const char *)
void VisParameterCallback(QWidget *)
QMap< int, QString > LookForHelpStringInChildTree(G4UIcommandTree *, const QString &)
QTableWidget * fParameterHelpTable
QPixmap * fHiddenLineRemovalIcon
QTreeWidgetItem * FindTreeItem(QTreeWidgetItem *, const QString &)
void AddMenu(const char *, const char *)
void CommandHistoryCallback()
bool AddViewerTabFromFile(std::string fileName, std::string title)
void AddIcon(const char *userLabel, const char *iconFile, const char *command, const char *file_name="")
QTextEdit * fCoutTBTextArea
void ResizeTabWidget(QResizeEvent *)
void ButtonCallback(const QString &)
QTextBrowser * fStartPage
virtual void ExitHelp() const
void SetIconWireframeSelected()
bool AddTabWidget(QWidget *, QString)
QString GetShortCommandPath(QString)
void SetIconMoveSelected()
QListWidget * fHistoryTBTableList
void ThreadComboBoxCallback(int)
void HelpTreeDoubleClicCallback()
G4UIDockWidget * fUIDockWidget
void SetIconHLHSRSelected()
void NativeMenu(bool aVal)
void OutputStyle(const char *, const char *, const char *)
void ActivateCommand(G4String)
bool AddViewerTab(QWidget *w, std::string title)
bool CreateVisCommandGroupAndToolBox(G4UIcommand *, QWidget *, int, bool isDialog)
void updateHelpArea(const G4UIcommand *)
void SecondaryLoop(G4String)
G4int GetCommandEntry() const
const G4UIcommand * GetGuidance() const
G4UIcommand * GetCommand(G4int i)
const G4String & GetPathName() const
G4int GetTreeEntry() const
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * FindCommandTree(const char *commandPath)
const G4String GetTitle() const
G4String GetFirstMatchedString(const G4String &, const G4String &) const
G4UIcommand * FindPath(const char *commandPath) const
std::size_t GetParameterEntries() const
const G4String & GetGuidanceLine(G4int i) const
G4UIparameter * GetParameter(G4int i) const
const G4String & GetCommandPath() const
std::size_t GetGuidanceEntries() const
const G4String & GetRange() const
void SetCoutDestination(G4UIsession *const value)
G4UIcommandTree * GetTree() const
G4int ApplyCommand(const char *aCommand)
bool IsLastCommandOutputTreated()
G4int GetVerboseLevel() const
G4String FindMacroPath(const G4String &fname) const
static G4UImanager * GetUIpointer()
G4MTcoutDestination * GetThreadCout()
void SetSession(G4UIsession *const value)
void SetG4UIWindow(G4UIsession *const value)
void SetLastCommandOutputTreated()
const G4String & GetParameterCandidates() const
const G4String & GetParameterGuidance() const
G4bool IsOmittable() const
const G4String & GetParameterRange() const
G4bool GetCurrentAsDefault() const
char GetParameterType() const
const G4String & GetParameterName() const
const G4String & GetDefaultValue() const
G4String ModifyToFullPathCommand(const char *aCommandLine) const
G4String Complete(const G4String &)
void TerminalHelp(const G4String &)
void ApplyShellCommand(const G4String &, G4bool &, G4bool &)
void AddInteractor(G4String, G4Interactor)
G4Interactor GetInteractor(G4String)
void EnableSecondaryLoop()
G4Interactor GetMainInteractor()
void DisableSecondaryLoop()
static G4MTGLOB_DLL G4coutDestination * masterG4coutDestination
const G4double al
Mysterious coefficient that appears in the wavefunctions.
const char * name(G4int ptype)
G4String lstrip_copy(G4String str, char c=' ')
Return copy of string with leading characters removed.
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.
G4bool contains(const G4String &str, std::string_view ss)
Check if a string contains a given substring.
def connect(endpoint="tcp://127.0.0.1:5555")