source: trunk/source/interfaces/basic/src/G4UIQt.cc@ 1264

Last change on this file since 1264 was 1264, checked in by garnier, 16 years ago

test qt3

  • Property svn:mime-type set to text/cpp
File size: 55.0 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id: G4UIQt.cc,v 1.37 2010/05/20 07:01:03 lgarnier Exp $
28// GEANT4 tag $Name: $
29//
30// L. Garnier
31
32#ifdef G4UI_BUILD_QT_SESSION
33
34#include "G4Types.hh"
35
36#include <string.h>
37
38#include "G4UIQt.hh"
39#include "G4UImanager.hh"
40#include "G4StateManager.hh"
41#include "G4UIcommandTree.hh"
42#include "G4UIcommandStatus.hh"
43
44#include "G4Qt.hh"
45
46#include <qapplication.h>
47#include <qlineedit.h>
48#include <qwidget.h>
49#include <qmenubar.h>
50#include <qlayout.h>
51#include <qpushbutton.h>
52#include <qlabel.h>
53#include <qtoolbox.h>
54#include <qsplitter.h>
55#include <qscrollbar.h>
56#include <qdialog.h>
57#include <qevent.h>
58#include <qtextedit.h>
59#include <qsignalmapper.h>
60#include <qtabwidget.h>
61#include <qtabbar.h>
62#include <qstringlist.h>
63
64#include <qmainwindow.h>
65#if QT_VERSION >= 0x040000
66#include <qmenu.h>
67#include <qlistwidget.h>
68#include <qtreewidget.h>
69#include <QResizeEvent>
70#else
71#include <qaction.h>
72#include <qheader.h>
73#include <qlistview.h>
74#include <qpopupmenu.h>
75#include <qwidgetlist.h>
76#endif
77
78
79
80#include <stdlib.h>
81
82// Pourquoi Static et non variables de classe ?
83static G4bool exitSession = true;
84static G4bool exitPause = true;
85
86/** Build a Qt window with a menubar, output area and promt area<br>
87<pre>
88 +-----------------------+
89 |exit menu| |
90 | |
91 | +-------------------+ |
92 | | | |
93 | | Output area | |
94 | | | |
95 | +-------------------+ |
96 | | clear | |
97 | +-------------------+ |
98 | | promt history | |
99 | +-------------------+ |
100 | +-------------------+ |
101 | |> promt area | |
102 | +-------------------+ |
103 +-----------------------+
104</pre>
105*/
106G4UIQt::G4UIQt (
107 int argc
108,char** argv
109)
110:fG4cout("")
111,fHelpTreeWidget(NULL)
112,fHelpTBWidget(NULL)
113,fHistoryTBWidget(NULL)
114,fCoutTBWidget(NULL)
115,fVisParametersTBWidget(NULL)
116,fViewComponentsTBWidget(NULL)
117,fTabWidget(NULL)
118,fCoutText("Output")
119{
120
121 G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt");
122 if (!(QApplication*)interactorManager->GetMainInteractor()) {
123 G4cout << "G4UIQt : Unable to init Qt. Aborted" << G4endl;
124 }
125
126 G4UImanager* UI = G4UImanager::GetUIpointer();
127 if(UI!=NULL) UI->SetSession(this);
128 if(UI!=NULL) UI->SetG4UIWindow(this);
129
130 // Check if already define in external app QMainWindow
131 bool found = false;
132#if QT_VERSION < 0x040000
133 // theses lines does nothing exept this one "GLWindow = new QDialog(0..."
134 // but if I comment them, it doesn't work...
135 QWidgetList *list = QApplication::allWidgets();
136 QWidgetListIt it( *list ); // iterate over the widgets
137 QWidget * widget;
138 while ( (widget=it.current()) != 0 ) { // for each widget...
139 ++it;
140 if ((found== false) && (widget->inherits("QMainWindow"))) {
141 found = true;
142 }
143 }
144 delete list; // delete the list, not the widgets
145#else
146 foreach (QWidget *widget, QApplication::allWidgets()) {
147 if ((found== false) && (widget->inherits("QMainWindow"))) {
148 found = true;
149 }
150 }
151#endif
152
153 if (found) {
154 G4cout << "G4UIQt : Found an external App with a QMainWindow already defined. Aborted" << G4endl;
155 return ;
156 }
157 fMainWindow = new QMainWindow();
158
159#ifdef G4DEBUG_INTERFACES_BASIC
160 printf("G4UIQt::Initialise after main window creation +++++++++++\n");
161#endif
162
163 QWidget *mainWidget = new QWidget(fMainWindow);
164#if QT_VERSION < 0x040000
165 fMyVSplitter = new QSplitter(Qt::Horizontal,fMainWindow);
166 fToolBox = new QToolBox(fMyVSplitter);
167#else
168 fMyVSplitter = new QSplitter(Qt::Horizontal,fMainWindow);
169 fToolBox = new QToolBox();
170#endif
171
172 // Set layouts
173
174 // Add a empty tabwidget
175 fTabWidget = new G4QTabWidget(fMyVSplitter);
176#if QT_VERSION >= 0x040500
177 fTabWidget->setTabsClosable (true);
178#endif
179
180#if QT_VERSION >= 0x040200
181 fTabWidget->setUsesScrollButtons (true);
182#endif
183
184 QWidget* commandLineWidget = new QWidget(mainWidget);
185#if QT_VERSION < 0x040000
186 QVBoxLayout *layoutCommandLine = new QVBoxLayout(commandLineWidget);
187#else
188 QVBoxLayout *layoutCommandLine = new QVBoxLayout();
189#endif
190
191 // fill them
192
193 fCommandLabel = new QLabel("",commandLineWidget);
194
195 fCommandArea = new QLineEdit(commandLineWidget);
196 fCommandArea->installEventFilter(this);
197#if QT_VERSION < 0x040000
198 fCommandArea->setActiveWindow();
199#else
200 fCommandArea->activateWindow();
201#endif
202
203#if QT_VERSION < 0x040000
204 fCommandArea->setFocusPolicy ( QWidget::StrongFocus );
205 fCommandArea->setFocus();
206#else
207 fCommandArea->setFocusPolicy ( Qt::StrongFocus );
208 fCommandArea->setFocus(Qt::TabFocusReason);
209#endif
210
211
212
213 layoutCommandLine->addWidget(fCommandLabel);
214 layoutCommandLine->addWidget(fCommandArea);
215#if QT_VERSION >= 0x040000
216 QVBoxLayout *mainLayout = new QVBoxLayout();
217#else
218 QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
219#endif
220
221 fHelpTBWidget = new QWidget(fToolBox);
222 fHistoryTBWidget = new QWidget(fToolBox);
223 fCoutTBWidget = new QWidget(fToolBox);
224 fVisParametersTBWidget = new QWidget(fToolBox);
225 fViewComponentsTBWidget = new QWidget(fToolBox);
226
227 CreateVisParametersTBWidget();
228 CreateViewComponentsTBWidget();
229 CreateHelpTBWidget();
230 CreateCoutTBWidget();
231 CreateHistoryTBWidget();
232
233 // the splitter
234 // fToolBox->addItem(fVisParametersTBWidget,"Vis parameters");
235 // fToolBox->addItem(fViewComponentsTBWidget,"Viewer components");
236 fToolBox->addItem(fHelpTBWidget,"Help");
237 fToolBox->addItem(fCoutTBWidget,"Cout");
238 fToolBox->addItem(fHistoryTBWidget,"History");
239
240
241
242 fToolBox->setSizePolicy (QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
243 fTabWidget->setSizePolicy (QSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum));
244
245 QSizePolicy policy = fTabWidget->sizePolicy();
246#if QT_VERSION < 0x040000
247 policy.setHorStretch(1);
248 policy.setVerStretch(1);
249#else
250 policy.setHorizontalStretch(1);
251 policy.setVerticalStretch(1);
252#endif
253 fTabWidget->setSizePolicy(policy);
254
255#if QT_VERSION < 0x040000
256 fEmptyViewerTabLabel = new QLabel(fToolBox," If you want to have a Viewer, please use /vis/open commands. ");
257#else
258 fEmptyViewerTabLabel = new QLabel(" If you want to have a Viewer, please use /vis/open commands. ");
259#endif
260
261 // Only at creation. Will be set visible when sessionStart();
262#if QT_VERSION >= 0x040000
263#if QT_VERSION >= 0x040200
264 fTabWidget->setVisible(false);
265 fEmptyViewerTabLabel->setVisible(false);
266#else
267 fTabWidget->hide();
268 fEmptyViewerTabLabel->hide();
269#endif
270#else
271 fTabWidget->hide();
272 fEmptyViewerTabLabel->hide();
273#endif
274
275
276 // fMyVSplitter->addWidget(fTabWidget);
277
278 // unset parent fot TabWidget
279#if QT_VERSION < 0x040000
280 fTabWidget->reparent(0,0,QPoint(0,0));
281#else
282 fMyVSplitter->addWidget(fToolBox);
283 fMyVSplitter->addWidget(fEmptyViewerTabLabel);
284 fTabWidget->setParent(0);
285#endif
286
287
288#if QT_VERSION >= 0x040000
289 commandLineWidget->setLayout(layoutCommandLine);
290#endif
291 commandLineWidget->setSizePolicy (QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
292 mainLayout->addWidget(fMyVSplitter,1);
293 mainLayout->addWidget(commandLineWidget);
294
295#ifdef G4DEBUG_INTERFACES_BASIC
296 printf("G4UIQt::G4UIQt :: 5\n");
297#endif
298
299#if QT_VERSION >= 0x040000
300 mainWidget->setLayout(mainLayout);
301#endif
302
303 fMainWindow->setCentralWidget(mainWidget);
304
305#if QT_VERSION < 0x040000
306
307 // Add a quit subMenu
308 QPopupMenu *fileMenu = new QPopupMenu( fMainWindow);
309 fileMenu->insertItem( "&Quit", this, SLOT(ExitSession()), CTRL+Key_Q );
310 fMainWindow->menuBar()->insertItem( QString("&File"), fileMenu );
311
312#else
313
314 // Add a quit subMenu
315 QMenu *fileMenu = fMainWindow->menuBar()->addMenu("File");
316 fileMenu->addAction("Quit", this, SLOT(ExitSession()));
317
318#endif
319
320 AddInteractor ("file",(G4Interactor)fileMenu);
321#ifdef G4DEBUG_INTERFACES_BASIC
322 printf("G4UIQt::G4UIQt :: 6\n");
323#endif
324
325 // Connect signal
326 connect(fCommandArea, SIGNAL(returnPressed()), SLOT(CommandEnteredCallback()));
327 connect(fTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(TabCloseCallback(int)));
328 connect(fTabWidget, SIGNAL(currentChanged ( int ) ), SLOT(UpdateTabWidget(int)));
329 connect(fToolBox, SIGNAL(currentChanged(int)), SLOT(ToolBoxActivated(int)));
330
331 if(UI!=NULL) UI->SetCoutDestination(this); // TO KEEP
332
333#if QT_VERSION < 0x040000
334 fMainWindow->setCaption( tr( "G4UI Session" ));
335 fMainWindow->resize(900,600);
336 fMainWindow->move(50,100);
337#else
338 fMainWindow->setWindowTitle( tr("G4UI Session") );
339 fMainWindow->resize(900,600);
340 fMainWindow->move(QPoint(50,100));
341#endif
342
343 // Set visible
344#if QT_VERSION >= 0x040000
345#if QT_VERSION >= 0x040200
346 fMainWindow->setVisible(true);
347#else
348 fMainWindow->show();
349#endif
350#else
351 fMainWindow->show();
352#endif
353
354#ifdef G4DEBUG_INTERFACES_BASIC
355 printf("G4UIQt::G4UIQt END\n");
356#endif
357}
358
359
360
361G4UIQt::~G4UIQt(
362)
363{
364#ifdef G4DEBUG_INTERFACES_BASIC
365 printf("G4UIQt::~G4UIQt Delete\n");
366#endif
367 G4UImanager* UI = G4UImanager::GetUIpointer(); // TO KEEP
368 if(UI!=NULL) { // TO KEEP
369 UI->SetSession(NULL); // TO KEEP
370 UI->SetG4UIWindow(NULL);
371 UI->SetCoutDestination(NULL); // TO KEEP
372 }
373
374 if (fMainWindow!=NULL) {
375#ifdef G4DEBUG_INTERFACES_BASIC
376 printf("G4UIQt::~G4UIQt DELETE fMainWindow\n");
377#endif
378 delete fMainWindow;
379 }
380}
381
382/** Create the History ToolBox Widget
383 */
384void G4UIQt::CreateHistoryTBWidget(
385)
386{
387
388#if QT_VERSION < 0x040000
389 QVBoxLayout *layoutHistoryTB = new QVBoxLayout(fHistoryTBWidget);
390
391 fHistoryTBTableList = new QListView(fHistoryTBWidget);
392 fHistoryTBTableList->setSorting (-1, FALSE);
393 fHistoryTBTableList->setSelectionMode(QListView::Single);
394 fHistoryTBTableList->addColumn("");
395 fHistoryTBTableList->header()->hide();
396 connect(fHistoryTBTableList, SIGNAL(selectionChanged()), SLOT(CommandHistoryCallback()));
397#else
398 QVBoxLayout *layoutHistoryTB = new QVBoxLayout();
399 fHistoryTBTableList = new QListWidget();
400 fHistoryTBTableList->setSelectionMode(QAbstractItemView::SingleSelection);
401 connect(fHistoryTBTableList, SIGNAL(itemSelectionChanged()), SLOT(CommandHistoryCallback()));
402#endif
403 fHistoryTBTableList->installEventFilter(this);
404
405 layoutHistoryTB->addWidget(fHistoryTBTableList);
406
407#if QT_VERSION >= 0x040000
408 fHistoryTBWidget->setLayout(layoutHistoryTB);
409#endif
410}
411
412/** Create the Help ToolBox Widget
413 */
414void G4UIQt::CreateHelpTBWidget(
415)
416{
417
418
419#if QT_VERSION < 0x040000
420 QWidget *helpWidget = new QWidget(fHelpTBWidget);
421 QHBoxLayout *helpLayout = new QHBoxLayout(helpWidget);
422 fHelpVSplitter = new QSplitter(Qt::Horizontal,fHelpTBWidget);
423#else
424 QWidget *helpWidget = new QWidget();
425 QHBoxLayout *helpLayout = new QHBoxLayout();
426 QVBoxLayout *vLayout = new QVBoxLayout();
427 fHelpVSplitter = new QSplitter(Qt::Horizontal);
428#endif
429 fHelpLine = new QLineEdit(fHelpTBWidget);
430 helpLayout->addWidget(new QLabel("Search :",helpWidget));
431 helpLayout->addWidget(fHelpLine);
432#if QT_VERSION < 0x040000
433 connect( fHelpLine, SIGNAL( returnPressed () ), this, SLOT( LookForHelpStringCallback() ) );
434#else
435 connect( fHelpLine, SIGNAL( editingFinished () ), this, SLOT( LookForHelpStringCallback() ) );
436#endif
437
438 // Create Help tree
439 FillHelpTree();
440
441 fHelpArea = new QTextEdit(fHelpVSplitter);
442 fHelpArea->setReadOnly(true);
443
444 // Set layouts
445
446#if QT_VERSION >= 0x040000
447 if (fHelpTreeWidget) {
448 fHelpVSplitter->addWidget(fHelpTreeWidget);
449 }
450 fHelpVSplitter->addWidget(fHelpArea);
451#endif
452
453
454#if QT_VERSION >= 0x040000
455 vLayout->addWidget(helpWidget);
456 vLayout->addWidget(fHelpVSplitter,1);
457#endif
458
459 fHelpTBWidget->setMinimumSize(50,50);
460 fHelpTBWidget->setSizePolicy (QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
461 // set the splitter size
462#if QT_VERSION >= 0x040000
463 QList<int> list;
464#else
465 QValueList<int> list;
466#endif
467 list.append( 50 );
468 list.append( 50 );
469 fHelpVSplitter->setSizes(list);
470
471#if QT_VERSION >= 0x040000
472 helpWidget->setLayout(helpLayout);
473 fHelpTBWidget->setLayout(vLayout);
474#endif
475}
476
477
478/** Create the Cout ToolBox Widget
479 */
480void G4UIQt::CreateCoutTBWidget(
481)
482{
483#if QT_VERSION >= 0x040000
484 QVBoxLayout *layoutCoutTB = new QVBoxLayout();
485#else
486 QVBoxLayout *layoutCoutTB = new QVBoxLayout(fCoutTBWidget);
487#endif
488
489 fCoutTBTextArea = new QTextEdit(fCoutTBWidget);
490 fCoutFilter = new QLineEdit(fCoutTBWidget);
491 QLabel* coutFilterLabel = new QLabel("Filter : ",fCoutTBWidget);
492
493 QPushButton *coutTBClearButton = new QPushButton("clear",fCoutTBWidget);
494 connect(coutTBClearButton, SIGNAL(clicked()), SLOT(ClearButtonCallback()));
495 connect(fCoutFilter, SIGNAL(textEdited ( const QString &)), SLOT(CoutFilterCallback( const QString &)));
496
497 fCoutTBTextArea->setReadOnly(true);
498
499 QWidget* coutButtonWidget = new QWidget(fCoutTBWidget);
500 QHBoxLayout* layoutCoutTBButtons = new QHBoxLayout(coutButtonWidget);
501 layoutCoutTBButtons->addWidget(coutTBClearButton);
502 layoutCoutTBButtons->addWidget(coutFilterLabel);
503 layoutCoutTBButtons->addWidget(fCoutFilter);
504
505 layoutCoutTB->addWidget(fCoutTBTextArea);
506 layoutCoutTB->addWidget(coutButtonWidget);
507
508#if QT_VERSION >= 0x040000
509 fCoutTBWidget->setLayout(layoutCoutTB);
510#endif
511}
512
513
514/** Create the VisParameters ToolBox Widget
515 */
516void G4UIQt::CreateVisParametersTBWidget(
517)
518{
519}
520
521
522/** Create the ViewComponents ToolBox Widget
523 */
524void G4UIQt::CreateViewComponentsTBWidget(
525)
526{
527}
528
529
530/** Add a new tab widget.
531 Create the tab if it was not done
532*/
533bool G4UIQt::AddTabWidget(
534 QWidget* aWidget
535,QString name
536,int sizeX
537,int sizeY
538)
539{
540#ifdef G4DEBUG_INTERFACES_BASIC
541 printf("G4UIQt::AddTabWidget %d %d\n",sizeX, sizeY);
542#endif
543 if (!aWidget) {
544 return false;
545 }
546
547 // Remove QLabel
548
549 // L.Garnier 26/05/2010 : not exactly the same in qt3. Could cause some
550 // troubles
551#if QT_VERSION >= 0x040000
552 if ( fMyVSplitter->indexOf(fEmptyViewerTabLabel) != -1) {
553#endif
554
555#if QT_VERSION < 0x040000
556 fEmptyViewerTabLabel->reparent(0,0,QPoint(0,0));
557 fMyVSplitter->addWidget(fTabWidget);
558#else
559 fEmptyViewerTabLabel->setParent(0);
560 fMyVSplitter->addWidget(fTabWidget);
561#endif
562
563#if QT_VERSION < 0x040000
564 aWidget->reparent(fTabWidget,0,QPoint(0,0));
565#else
566 aWidget->setParent(fTabWidget);
567#endif
568#if QT_VERSION >= 0x040000
569 }
570#endif
571
572
573#ifdef G4DEBUG_INTERFACES_BASIC
574 printf("G4UIQt::AddTabWidget ADD %d %d + %d %d---------------------------------------------------\n",sizeX, sizeY,sizeX-fTabWidget->width(),sizeY-fTabWidget->height());
575#endif
576
577 fMainWindow->resize(fMainWindow->width()+sizeX-fTabWidget->width(),fMainWindow->height()+sizeY-fTabWidget->height());
578
579 // Problems with resize. The widgets are not realy drawn at this step,
580 // then we have to force them on order to check the size
581
582#if QT_VERSION < 0x040000
583 fTabWidget->insertTab(aWidget,name,fTabWidget->count());
584#else
585 fTabWidget->insertTab(fTabWidget->count(),aWidget,name);
586#endif
587
588#if QT_VERSION < 0x040000
589 fTabWidget->setCurrentPage(fTabWidget->count()-1);
590#else
591 fTabWidget->setCurrentIndex(fTabWidget->count()-1);
592#endif
593
594 // Set visible
595#if QT_VERSION >= 0x040000
596 #if QT_VERSION >= 0x040200
597 fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
598 fMainWindow->setVisible(true);
599 #else
600 fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
601 fMainWindow->show();
602 #endif
603#else
604 fTabWidget->setLastTabCreated(fTabWidget->currentPageIndex());
605 fMainWindow->show();
606#endif
607
608#if QT_VERSION >= 0x040000
609 #if QT_VERSION >= 0x040200
610 fTabWidget->setVisible(true);
611 #else
612 fTabWidget->show;
613 #endif
614#else
615 fTabWidget->show;
616#endif
617
618 return true;
619}
620
621
622void G4UIQt::UpdateTabWidget(int tabNumber) {
623#ifdef G4DEBUG_INTERFACES_BASIC
624 printf("G4UIQt::UpdateTabWidget %d\n",tabNumber);
625#endif
626 if ( fTabWidget == NULL) {
627 fTabWidget = new G4QTabWidget;
628 }
629
630
631#ifdef G4DEBUG_INTERFACES_BASIC
632 printf("G4UIQt::UpdateTabWidget CALL REPAINT tabGL\n");
633#endif
634
635#if QT_VERSION < 0x040000
636 fTabWidget->setCurrentPage(tabNumber);
637#else
638 fTabWidget->setCurrentIndex(tabNumber);
639#endif
640
641 // Send this signal to unblock graphic updates !
642#if QT_VERSION >= 0x040000
643 #if QT_VERSION >= 0x040200
644 fTabWidget->setVisible(true);
645 #else
646 fTabWidget->show;
647 #endif
648#else
649 fTabWidget->show;
650#endif
651
652 // This will send a paintEvent to OGL Viewers
653 fTabWidget->setTabSelected();
654
655#if QT_VERSION < 0x040000
656 QApplication::sendPostedEvents () ;
657#else
658 QCoreApplication::sendPostedEvents () ;
659#endif
660
661#ifdef G4DEBUG_INTERFACES_BASIC
662 printf("G4UIQt::UpdateTabWidget END\n");
663#endif
664}
665
666
667/** Send resize event to all tabs
668 */
669void G4UIQt::ResizeTabWidget( QResizeEvent* e) {
670 for (int a=0;a<fTabWidget->count() ;a++) {
671#ifdef G4DEBUG_INTERFACES_BASIC
672 printf("G4UIQt::ResizeTabWidget +++++++++++++++++++++++++++++++++++++++\n");
673#endif
674 fTabWidget->widget(a)->resize(e->size());
675 }
676}
677
678
679/** Start the Qt main loop
680*/
681G4UIsession* G4UIQt::SessionStart (
682)
683{
684#ifdef G4DEBUG_INTERFACES_BASIC
685 printf("G4UIQt::G4UIQt SessionStart\n");
686#endif
687
688 G4Qt* interactorManager = G4Qt::getInstance ();
689
690 Prompt("Session :");
691 exitSession = false;
692
693 fTabWidget->setVisible(true);
694 fEmptyViewerTabLabel->setVisible(true);
695
696#if QT_VERSION >= 0x040000
697#if QT_VERSION >= 0x040200
698 fMainWindow->setVisible(true);
699#else
700 fMainWindow->show();
701#endif
702#else
703 fMainWindow->show();
704#endif
705
706#if QT_VERSION < 0x040000
707 QApplication::sendPostedEvents () ;
708#else
709 QCoreApplication::sendPostedEvents () ;
710#endif
711
712#ifdef G4DEBUG_INTERFACES_BASIC
713 printf("G4UIQt::G4UIQt SessionStart2\n");
714#endif
715 interactorManager->DisableSecondaryLoop (); // TO KEEP
716 if ((QApplication*)interactorManager->GetMainInteractor())
717 ((QApplication*)interactorManager->GetMainInteractor())->exec();
718
719 // on ne passe pas le dessous ? FIXME ????
720 // je ne pense pas 13/06
721
722 // void* event; // TO KEEP
723 // while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP
724 // interactorManager->DispatchEvent(event); // TO KEEP
725 // if(exitSession==true) break; // TO KEEP
726 // } // TO KEEP
727
728 interactorManager->EnableSecondaryLoop ();
729 return this;
730}
731
732
733/** Display the prompt in the prompt area
734 @param aPrompt : string to display as the promt label
735 //FIXME : probablement inutile puisque le seul a afficher qq chose d'autre
736 que "session" est SecondaryLoop()
737*/
738void G4UIQt::Prompt (
739 G4String aPrompt
740)
741{
742 if (!aPrompt) return;
743
744 fCommandLabel->setText((char*)aPrompt.data());
745}
746
747
748
749void G4UIQt::SessionTerminate (
750)
751{
752 G4Qt* interactorManager = G4Qt::getInstance ();
753 fMainWindow->close();
754 ((QApplication*)interactorManager->GetMainInteractor())->exit();
755}
756
757
758
759/**
760 Called by intercoms/src/G4UImanager.cc<br>
761 Called by visualization/management/src/G4VisCommands.cc with "EndOfEvent" argument<br>
762 It have to pause the session command terminal.<br>
763 Call SecondaryLoop to wait for exit event<br>
764 @param aState
765 @see : G4VisCommandReviewKeptEvents::SetNewValue
766*/
767void G4UIQt::PauseSessionStart (
768 G4String aState
769)
770{
771 if (!aState) return;
772
773 if(aState=="G4_pause> ") { // TO KEEP
774 SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
775 } // TO KEEP
776
777 if(aState=="EndOfEvent") { // TO KEEP
778 // Picking with feed back in event data Done here !!!
779 SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP
780 } // TO KEEP
781}
782
783
784
785/**
786 Begin the secondary loop
787 @param a_prompt : label to display as the prompt label
788 */
789void G4UIQt::SecondaryLoop (
790 G4String aPrompt
791)
792{
793 if (!aPrompt) return;
794
795 G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
796 Prompt(aPrompt); // TO KEEP
797 exitPause = false; // TO KEEP
798 void* event; // TO KEEP
799 while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP
800 interactorManager->DispatchEvent(event); // TO KEEP
801 if(exitPause==true) break; // TO KEEP
802 } // TO KEEP
803 Prompt("Session :"); // TO KEEP
804}
805
806
807
808/**
809 Receive a cout from Geant4. We have to display it in the cout zone
810 @param aString : label to add in the display area
811 @return 0
812*/
813G4int G4UIQt::ReceiveG4cout (
814 G4String aString
815 )
816{
817 if (!aString) return 0;
818
819 QStringList newStr;
820
821 // Add to stringList
822#if QT_VERSION < 0x040000
823 newStr = QStringList(QString((char*)aString.data()).simplifyWhiteSpace());
824#else
825 newStr = QStringList(QString((char*)aString.data()).trimmed());
826#endif
827 fG4cout += newStr;
828
829 QStringList result = newStr.filter(fCoutFilter->text());
830
831 if (result.join("\n").isEmpty()) {
832 return 0;
833 }
834 fCoutTBTextArea->append(result.join("\n"));
835 fCoutTBTextArea->repaint();
836
837#if QT_VERSION < 0x040000
838 fCoutTBTextArea->verticalScrollBar()->setValue(fCoutTBTextArea->verticalScrollBar()->maxValue());
839#else
840 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
841#endif
842
843 return 0;
844}
845
846
847/**
848 Receive a cerr from Geant4. We have to display it in the cout zone
849 @param aString : label to add in the display area
850 @return 0
851*/
852G4int G4UIQt::ReceiveG4cerr (
853 G4String aString
854)
855{
856 if (!aString) return 0;
857
858 QStringList newStr;
859
860 // Add to stringList
861#if QT_VERSION < 0x040000
862 newStr = QStringList(QString((char*)aString.data()).simplifyWhiteSpace());
863#else
864 newStr = QStringList(QString((char*)aString.data()).trimmed());
865#endif
866 fG4cout += newStr;
867
868 QStringList result = newStr.filter(fCoutFilter->text());
869
870#if QT_VERSION < 0x040000
871 QColor previousColor = fCoutTBTextArea->color();
872 fCoutTBTextArea->setColor(Qt::red);
873 fCoutTBTextArea->append(result.join("\n"));
874 fCoutTBTextArea->setColor(previousColor);
875 fCoutTBTextArea->verticalScrollBar()->setValue(fCoutTBTextArea->verticalScrollBar()->maxValue());
876#else
877 QColor previousColor = fCoutTBTextArea->textColor();
878 fCoutTBTextArea->setTextColor(Qt::red);
879 fCoutTBTextArea->append(result.join("\n"));
880 fCoutTBTextArea->setTextColor(previousColor);
881 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
882#endif
883 fCoutTBTextArea->repaint();
884 return 0;
885}
886
887
888
889/**
890 Add a new menu to the menu bar
891 @param aName name of menu
892 @param aLabel label to display
893 */
894void G4UIQt::AddMenu (
895 const char* aName
896,const char* aLabel
897)
898{
899 if (aName == NULL) return;
900 if (aLabel == NULL) return;
901
902#if QT_VERSION < 0x040000
903 QPopupMenu *fileMenu = new QPopupMenu( fMainWindow);
904 fMainWindow->menuBar()->insertItem( aLabel, fileMenu );
905#else
906 QMenu *fileMenu = new QMenu(aLabel);
907 fMainWindow->menuBar()->insertMenu(fMainWindow->menuBar()->actions().last(),fileMenu);
908#endif
909
910 AddInteractor (aName,(G4Interactor)fileMenu);
911}
912
913
914/**
915 Add a new button to a menu
916 @param aMenu : parent menu
917 @param aLabel : label to display
918 @param aCommand : command to execute as a callback
919 */
920void G4UIQt::AddButton (
921 const char* aMenu
922,const char* aLabel
923,const char* aCommand
924)
925{
926 if(aMenu==NULL) return; // TO KEEP
927 if(aLabel==NULL) return; // TO KEEP
928 if(aCommand==NULL) return; // TO KEEP
929
930#if QT_VERSION < 0x040000
931 QPopupMenu *parent = (QPopupMenu*)GetInteractor(aMenu);
932#else
933 QMenu *parent = (QMenu*)GetInteractor(aMenu);
934#endif
935
936 if(parent==NULL) return;
937
938 QSignalMapper *signalMapper = new QSignalMapper(this);
939#if QT_VERSION < 0x030200
940 QAction *action = new QAction(QString(aLabel),QString(aLabel),QKeySequence(),signalMapper, SLOT(map()));
941 action->addTo(parent);
942 connect(action,SIGNAL(activated()),signalMapper,SLOT(map()));
943
944#elif QT_VERSION < 0x040000
945 QAction *action = new QAction(QString(aLabel),QKeySequence(),signalMapper, SLOT(map()));
946 action->addTo(parent);
947 connect(action,SIGNAL(activated()),signalMapper,SLOT(map()));
948
949#else
950 QAction *action = parent->addAction(aLabel, signalMapper, SLOT(map()));
951
952#endif
953 connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ButtonCallback(const QString&)));
954 signalMapper->setMapping(action, QString(aCommand));
955}
956
957
958
959
960void G4UIQt::ActivateCommand(
961 G4String newCommand
962)
963{
964 if (!fHelpTreeWidget) {
965 return;
966 }
967 // Look for the choosen command "newCommand"
968 size_t i = newCommand.index(" ");
969 G4String targetCom ="";
970 if( i != std::string::npos )
971 {
972 G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
973 newValue.strip(G4String::both);
974 targetCom = ModifyToFullPathCommand( newValue );
975 }
976#ifdef G4DEBUG_INTERFACES_BASIC
977 printf("G4UIQt::ActivateCommand found : %s \n",targetCom.data());
978#endif
979 if (targetCom != "") {
980 OpenHelpTreeOnCommand(targetCom.data());
981 }
982
983 fToolBox->setCurrentWidget(fHelpTBWidget);
984}
985
986
987
988/**
989 Create the help tree widget
990 @param parent : parent of tree widget
991 @return the widget containing the tree or NULL if it could not have beeen created
992 */
993
994void G4UIQt::InitHelpTree()
995{
996
997 if (! fHelpTreeWidget ) {
998#if QT_VERSION < 0x040000
999 fHelpTreeWidget = new QListView(splitter);
1000#else
1001 fHelpTreeWidget = new QTreeWidget();
1002#endif
1003 }
1004
1005
1006 // build widget
1007#if QT_VERSION < 0x040000
1008 fHelpTreeWidget->setSelectionMode(QListView::Single);
1009 fHelpTreeWidget->setRootIsDecorated(true);
1010 fHelpTreeWidget->addColumn("Command");
1011 fHelpTreeWidget->header()->setResizeEnabled(FALSE,1);
1012#else
1013 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
1014 QStringList labels;
1015 labels << QString("Command");
1016 fHelpTreeWidget->setHeaderLabels(labels);
1017#endif
1018
1019
1020#if QT_VERSION < 0x040000
1021 connect(fHelpTreeWidget, SIGNAL(selectionChanged ()),this, SLOT(HelpTreeClicCallback()));
1022 connect(fHelpTreeWidget, SIGNAL(doubleClicked (QListViewItem*)),this, SLOT(HelpTreeDoubleClicCallback()));
1023#else
1024 connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),this, SLOT(HelpTreeClicCallback()));
1025 connect(fHelpTreeWidget, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,int)),this, SLOT(HelpTreeDoubleClicCallback()));
1026#endif
1027
1028}
1029/**
1030 Create the help tree widget
1031 @param parent : parent of tree widget
1032 @return the widget containing the tree or NULL if it could not have beeen created
1033 */
1034
1035void G4UIQt::FillHelpTree()
1036{
1037 if (! fHelpTreeWidget ) {
1038 InitHelpTree();
1039 }
1040
1041 G4UImanager* UI = G4UImanager::GetUIpointer();
1042 if(UI==NULL) return;
1043 G4UIcommandTree * treeTop = UI->GetTree();
1044
1045 G4int treeSize = treeTop->GetTreeEntry();
1046#if QT_VERSION < 0x040000
1047 QListViewItem * newItem = NULL;
1048#else
1049 QTreeWidgetItem * newItem = NULL;
1050#endif
1051 QString commandText = "";
1052 for (int a=0;a<treeSize;a++) {
1053 // Creating new item
1054 newItem = NULL;
1055
1056#if QT_VERSION < 0x040000
1057 commandText = QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace();
1058#else
1059 commandText = QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).trimmed();
1060#endif
1061
1062 // if already exist, don't create it !
1063#if QT_VERSION < 0x040000
1064 QListViewItem* tmpAddItem = fHelpTreeWidget->firstChild();
1065 while (tmpAddItem != 0) {
1066 if (!newItem) {
1067 newItem = FindTreeItem(tmpAddItem,commandText);
1068 }
1069 tmpAddItem = tmpAddItem->nextSibling();
1070 }
1071#else
1072 for (int b=0;b<fHelpTreeWidget->topLevelItemCount();b++) {
1073 if (!newItem)
1074 newItem = FindTreeItem(fHelpTreeWidget->topLevelItem(b),commandText);
1075 }
1076#endif
1077
1078 if (newItem == NULL) {
1079
1080#if QT_VERSION < 0x040000
1081 newItem = new QListViewItem(fHelpTreeWidget);
1082#else
1083 newItem = new QTreeWidgetItem(fHelpTreeWidget);
1084#endif
1085 newItem->setText(0,GetShortCommandPath(commandText));
1086 }
1087
1088 // look for childs
1089 CreateChildTree(newItem,treeTop->GetTree(a+1));
1090 }
1091
1092}
1093
1094
1095
1096/** Fill the Help Tree Widget
1097 @param aParent : parent item to fill
1098 @param aCommandTree : commandTree node associate with this part of the Tree
1099*/
1100#if QT_VERSION < 0x040000
1101void G4UIQt::CreateChildTree(
1102 QListViewItem *aParent
1103,G4UIcommandTree *aCommandTree
1104#else
1105void G4UIQt::CreateChildTree(
1106 QTreeWidgetItem *aParent
1107,G4UIcommandTree *aCommandTree
1108#endif
1109)
1110{
1111 if (aParent == NULL) return;
1112 if (aCommandTree == NULL) return;
1113
1114
1115 // Creating new item
1116#if QT_VERSION < 0x040000
1117 QListViewItem * newItem;
1118#else
1119 QTreeWidgetItem * newItem;
1120#endif
1121
1122 QString commandText = "";
1123 // Get the Sub directories
1124 for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
1125
1126#if QT_VERSION < 0x040000
1127 commandText = QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace();
1128#else
1129 commandText = QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).trimmed();
1130#endif
1131
1132 // if already exist, don't create it !
1133 newItem = FindTreeItem(aParent,commandText);
1134 if (newItem == NULL) {
1135#if QT_VERSION < 0x040000
1136 newItem = new QListViewItem(aParent);
1137#else
1138 newItem = new QTreeWidgetItem(aParent);
1139#endif
1140 newItem->setText(0,GetShortCommandPath(commandText));
1141 }
1142 CreateChildTree(newItem,aCommandTree->GetTree(a+1));
1143 }
1144
1145
1146
1147 // Get the Commands
1148
1149 for (int a=0;a<aCommandTree->GetCommandEntry();a++) {
1150
1151 QStringList stringList;
1152#if QT_VERSION < 0x040000
1153 commandText = QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).simplifyWhiteSpace();
1154#else
1155 commandText = QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed();
1156#endif
1157
1158 // if already exist, don't create it !
1159 newItem = FindTreeItem(aParent,commandText);
1160 if (newItem == NULL) {
1161#if QT_VERSION < 0x040000
1162 newItem = new QListViewItem(aParent);
1163 newItem->setText(0,GetShortCommandPath(commandText));
1164 newItem->setOpen(false);
1165
1166#else
1167 newItem = new QTreeWidgetItem(aParent);
1168 newItem->setText(0,GetShortCommandPath(commandText));
1169#if QT_VERSION < 0x040202
1170 fHelpTreeWidget->setItemExpanded(newItem,false);
1171#else
1172 newItem->setExpanded(false);
1173#endif
1174#endif
1175 }
1176 }
1177}
1178
1179
1180/** Find a treeItemWidget in the help tree
1181 @param aCommand item's String to look for
1182 @return item if found, NULL if not
1183*/
1184#if QT_VERSION < 0x040000
1185QListViewItem* G4UIQt::FindTreeItem(
1186 QListViewItem *aParent
1187#else
1188QTreeWidgetItem* G4UIQt::FindTreeItem(
1189 QTreeWidgetItem *aParent
1190#endif
1191,const QString& aCommand
1192)
1193{
1194 if (aParent == NULL) return NULL;
1195
1196 // Suppress last "/"
1197 QString myCommand = aCommand;
1198
1199 if (myCommand.lastIndexOf("/") == (myCommand.size()-1)) {
1200 myCommand = myCommand.left(myCommand.size()-1);
1201 }
1202
1203 if (GetLongCommandPath(aParent) == myCommand)
1204 return aParent;
1205
1206#if QT_VERSION < 0x040000
1207 QListViewItem * tmp = NULL;
1208 QListViewItem* tmpItem = aParent->firstChild();
1209 while (tmpItem != 0) {
1210 if (!tmp)
1211 tmp = FindTreeItem(tmpItem,myCommand);
1212 tmpItem = tmpItem->nextSibling();
1213 }
1214#else
1215 QTreeWidgetItem * tmp = NULL;
1216 for (int a=0;a<aParent->childCount();a++) {
1217 if (!tmp)
1218 tmp = FindTreeItem(aParent->child(a),myCommand);
1219 }
1220#endif
1221 return tmp;
1222}
1223
1224
1225
1226/** Build the command list parameters in a QString<br>
1227 Reimplement partialy the G4UIparameter.cc
1228 @param aCommand : command to list parameters
1229 @see G4UIparameter::List()
1230 @see G4UIcommand::List()
1231 @return the command list parameters, or "" if nothing
1232*/
1233QString G4UIQt::GetCommandList (
1234 const G4UIcommand *aCommand
1235)
1236{
1237
1238 QString txt ="";
1239 if (aCommand == NULL)
1240 return txt;
1241
1242 G4String commandPath = aCommand->GetCommandPath();
1243 G4String rangeString = aCommand->GetRange();
1244 G4int n_guidanceEntry = aCommand->GetGuidanceEntries();
1245 G4int n_parameterEntry = aCommand->GetParameterEntries();
1246
1247 if ((commandPath == "") &&
1248 (rangeString == "") &&
1249 (n_guidanceEntry == 0) &&
1250 (n_parameterEntry == 0)) {
1251 return txt;
1252 }
1253
1254 if((commandPath.length()-1)!='/') {
1255 txt += "Command " + QString((char*)(commandPath).data()) + "\n";
1256 }
1257 txt += "Guidance :\n";
1258
1259 for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
1260 txt += QString((char*)(aCommand->GetGuidanceLine(i_thGuidance)).data()) + "\n";
1261 }
1262 if( ! rangeString.isNull() ) {
1263 txt += " Range of parameters : " + QString((char*)(rangeString).data()) + "\n";
1264 }
1265 if( n_parameterEntry > 0 ) {
1266 G4UIparameter *param;
1267
1268 // Re-implementation of G4UIparameter.cc
1269
1270 for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
1271 param = aCommand->GetParameter(i_thParameter);
1272 txt += "\nParameter : " + QString((char*)(param->GetParameterName()).data()) + "\n";
1273 if( ! param->GetParameterGuidance().isNull() )
1274 txt += QString((char*)(param->GetParameterGuidance()).data())+ "\n" ;
1275 txt += " Parameter type : " + QString(QChar(param->GetParameterType())) + "\n";
1276 if(param->IsOmittable()){
1277 txt += " Omittable : True\n";
1278 } else {
1279 txt += " Omittable : False\n";
1280 }
1281 if( param->GetCurrentAsDefault() ) {
1282 txt += " Default value : taken from the current value\n";
1283 } else if( ! param->GetDefaultValue().isNull() ) {
1284 txt += " Default value : " + QString((char*)(param->GetDefaultValue()).data())+ "\n";
1285 }
1286 if( ! param->GetParameterRange().isNull() ) {
1287 txt += " Parameter range : " + QString((char*)(param->GetParameterRange()).data())+ "\n";
1288 }
1289 if( ! param->GetParameterCandidates().isNull() ) {
1290 txt += " Candidates : " + QString((char*)(param->GetParameterCandidates()).data())+ "\n";
1291 }
1292 }
1293 }
1294 return txt;
1295}
1296
1297
1298
1299/** Implement G4VBasicShell vurtual function
1300 */
1301G4bool G4UIQt::GetHelpChoice(
1302 G4int&
1303)
1304{
1305#ifdef G4DEBUG_INTERFACES_BASIC
1306 printf("G4UIQt::GetHelpChoice SHOULD NEVER GO HERE");
1307#endif
1308 return true;
1309}
1310
1311
1312/** Event filter method. Every event from QtApplication goes here.<br/>
1313 We apply a filter only for the Up and Down Arrow press when the QLineEdit<br/>
1314 is active. If this filter match, Up arrow we give the previous command<br/>
1315 and Down arrow will give the next if exist.<br/>
1316 @param obj Emitter of the event
1317 @param event Kind of event
1318*/
1319bool G4UIQt::eventFilter( // Should stay with a minuscule eventFilter because of Qt
1320 QObject *aObj
1321,QEvent *aEvent
1322)
1323{
1324 bool moveCommandCursor = false;
1325 if (aObj == NULL) return false;
1326 if (aEvent == NULL) return false;
1327
1328 if (aObj == fHistoryTBTableList) {
1329 if (aEvent->type() == QEvent::KeyPress) {
1330 fCommandArea->setFocus();
1331 }
1332 }
1333 if (aObj == fCommandArea) {
1334 if (aEvent->type() == QEvent::KeyPress) {
1335 QKeyEvent *e = static_cast<QKeyEvent*>(aEvent);
1336 if ((e->key() == (Qt::Key_Down)) ||
1337 (e->key() == (Qt::Key_PageDown)) ||
1338 (e->key() == (Qt::Key_Up)) ||
1339 (e->key() == (Qt::Key_PageUp))) {
1340#if QT_VERSION < 0x040000
1341 // count rows...
1342 QListViewItem* tmpItem = fHistoryTBTableList->firstChild();
1343 int selection = -1;
1344 int index = 0;
1345 while (tmpItem != 0) {
1346 if (tmpItem == fHistoryTBTableList->selectedItem()) {
1347 selection = index;
1348 }
1349 index ++;
1350 tmpItem = tmpItem->nextSibling();
1351 }
1352 if (fHistoryTBTableList->childCount()) {
1353 if (selection == -1) {
1354 selection = fHistoryTBTableList->childCount()-1;
1355 } else {
1356 if (e->key() == (Qt::Key_Down)) {
1357 if (selection <(fHistoryTBTableList->childCount()-1))
1358 selection++;
1359 } else if (e->key() == (Qt::Key_PageDown)) {
1360 selection = fHistoryTBTableList->childCount()-1;
1361#else
1362 int selection = fHistoryTBTableList->currentRow();
1363 if (fHistoryTBTableList->count()) {
1364 if (selection == -1) {
1365 selection = fHistoryTBTableList->count()-1;
1366 } else {
1367 if (e->key() == (Qt::Key_Down)) {
1368 if (selection <(fHistoryTBTableList->count()-1))
1369 selection++;
1370 } else if (e->key() == (Qt::Key_PageDown)) {
1371 selection = fHistoryTBTableList->count()-1;
1372#endif
1373 } else if (e->key() == (Qt::Key_Up)) {
1374 if (selection >0)
1375 selection --;
1376 } else if (e->key() == (Qt::Key_PageUp)) {
1377 selection = 0;
1378 }
1379 }
1380 fHistoryTBTableList->clearSelection();
1381#if QT_VERSION < 0x040000
1382 QListViewItem* tmpItem = fHistoryTBTableList->firstChild();
1383 int index = 0;
1384 while (tmpItem != 0) {
1385 if (index == selection) {
1386 tmpItem->setSelected(true);
1387 fHistoryTBTableList->setCurrentItem(tmpItem);
1388 }
1389 index ++;
1390 tmpItem = tmpItem->nextSibling();
1391 }
1392#else
1393#if QT_VERSION < 0x040202
1394 fHistoryTBTableList->setItemSelected(fHistoryTBTableList->item(selection),true);
1395#else
1396 fHistoryTBTableList->item(selection)->setSelected(true);
1397#endif
1398 fHistoryTBTableList->setCurrentItem(fHistoryTBTableList->item(selection));
1399#endif
1400 }
1401 moveCommandCursor = true;
1402 } else if (e->key() == (Qt::Key_Tab)) {
1403#if QT_VERSION < 0x040000
1404 G4String ss = Complete(fCommandArea->text().ascii());
1405#else
1406 G4String ss = Complete(fCommandArea->text().toStdString().c_str());
1407#endif
1408 fCommandArea->setText((char*)(ss.data()));
1409
1410 // do not pass by parent, it will disable widget tab focus !
1411 return true;
1412#if QT_VERSION >= 0x040000
1413 // L.Garnier : MetaModifier is CTRL for MAC, but I don't want to put a MAC
1414 // specific #ifdef
1415 } else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_A)) {
1416 fCommandArea->home(false);
1417 return true;
1418 } else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_E)) {
1419 fCommandArea->end(false);
1420 return true;
1421#endif
1422 }
1423 }
1424 }
1425 bool res= false;
1426 // change cursor position if needed
1427 if (moveCommandCursor == true) {
1428#ifdef G4DEBUG_INTERFACES_BASIC
1429 printf("G4UIQt::eventFilter setCursor Position\n");
1430#endif
1431 fCommandArea->setCursorPosition ( fCommandArea->text().length() );
1432 fCommandArea->setCursorPosition (4);
1433 } else {
1434 // pass the event on to the parent class
1435 res = QObject::eventFilter(aObj, aEvent);
1436 }
1437 return res;
1438}
1439
1440
1441
1442
1443/***************************************************************************/
1444//
1445// SLOTS DEFINITIONS
1446//
1447/***************************************************************************/
1448
1449/** Called when user give "help" command.
1450*/
1451void G4UIQt::ShowHelpCallback (
1452)
1453{
1454 TerminalHelp("");
1455}
1456
1457
1458/** Called when user click on clear button. Clear the text Output area
1459*/
1460void G4UIQt::ClearButtonCallback (
1461)
1462{
1463 fCoutTBTextArea->clear();
1464 fG4cout.clear();
1465}
1466
1467/** Called when user exit session
1468*/
1469void G4UIQt::ExitSession (
1470)
1471{
1472 SessionTerminate();
1473}
1474
1475void G4UIQt::ExitHelp(
1476)
1477{
1478}
1479
1480/** Callback call when "click on a menu entry.<br>
1481 Send the associated command to geant4
1482*/
1483void G4UIQt::CommandEnteredCallback (
1484)
1485{
1486#if QT_VERSION < 0x040000
1487 G4String command (fCommandArea->text().ascii());
1488 if (fCommandArea->text().simplifyWhiteSpace() != "") {
1489
1490 QListViewItem *newItem = new QListViewItem(fHistoryTBTableList);
1491 newItem->setText(0,fCommandArea->text());
1492 fHistoryTBTableList->insertItem(newItem);
1493 // now we have to arrange
1494 QListViewItem *temp= fHistoryTBTableList->lastItem();
1495 for (int i=0; i<fHistoryTBTableList->childCount()-1;i++) {
1496 fHistoryTBTableList->takeItem(temp);
1497 fHistoryTBTableList->insertItem(temp);
1498 temp= fHistoryTBTableList->lastItem();
1499 }
1500#else
1501 G4String command (fCommandArea->text().toStdString().c_str());
1502 if (fCommandArea->text().trimmed() != "") {
1503 fHistoryTBTableList->addItem(fCommandArea->text());
1504#endif
1505 fHistoryTBTableList->clearSelection();
1506 fHistoryTBTableList->setCurrentItem(NULL);
1507 fCommandArea->setText("");
1508
1509 G4Qt* interactorManager = G4Qt::getInstance ();
1510 if (interactorManager) {
1511 interactorManager->FlushAndWaitExecution();
1512 }
1513 if (command(0,4) != "help") {
1514 ApplyShellCommand (command,exitSession,exitPause);
1515 } else {
1516 ActivateCommand(command);
1517 }
1518 // Rebuild help tree
1519 FillHelpTree();
1520
1521 if(exitSession==true)
1522 SessionTerminate();
1523 }
1524}
1525
1526
1527/** Callback call when "enter" clicked on the command zone.<br>
1528 Send the command to geant4
1529 @param aCommand
1530*/
1531void G4UIQt::ButtonCallback (
1532 const QString& aCommand
1533)
1534{
1535#if QT_VERSION < 0x040000
1536 G4String ss = G4String(aCommand.ascii());
1537#else
1538 G4String ss = G4String(aCommand.toStdString().c_str());
1539#endif
1540 ApplyShellCommand(ss,exitSession,exitPause);
1541
1542 // Rebuild help tree
1543 FillHelpTree();
1544
1545 if(exitSession==true)
1546 SessionTerminate();
1547}
1548
1549
1550
1551/** This callback is activated when user selected a item in the help tree
1552*/
1553void G4UIQt::HelpTreeClicCallback (
1554)
1555{
1556#if QT_VERSION < 0x040000
1557 QListViewItem* item = NULL;
1558#else
1559 QTreeWidgetItem* item = NULL;
1560#endif
1561 if (!fHelpTreeWidget)
1562 return ;
1563
1564 if (!fHelpArea)
1565 return;
1566
1567#if QT_VERSION < 0x040000
1568 item =fHelpTreeWidget->selectedItem();
1569#else
1570 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
1571 if (list.isEmpty())
1572 return;
1573 item = list.first();
1574#endif
1575 if (!item)
1576 return;
1577
1578 G4UImanager* UI = G4UImanager::GetUIpointer();
1579 if(UI==NULL) return;
1580 G4UIcommandTree * treeTop = UI->GetTree();
1581
1582 std::string itemText = GetLongCommandPath(item).toStdString();
1583
1584 G4UIcommand* command = treeTop->FindPath(itemText.c_str());
1585
1586 if (command) {
1587#if QT_VERSION >= 0x040000
1588#if QT_VERSION < 0x040200
1589 fHelpArea->clear();
1590 fHelpArea->append(GetCommandList(command));
1591#else
1592 fHelpArea->setText(GetCommandList(command));
1593#endif
1594#else
1595 fHelpArea->setText(GetCommandList(command));
1596#endif
1597 } else { // this is a command
1598 G4UIcommandTree* path = treeTop->FindCommandTree(itemText.c_str());
1599 if ( path) {
1600 // this is not a command, this is a sub directory
1601 // We display the Title
1602#if QT_VERSION >= 0x040000
1603#if QT_VERSION < 0x040200
1604 fHelpArea->clear();
1605 fHelpArea->append(path->GetTitle().data());
1606#else
1607 fHelpArea->setText(path->GetTitle().data());
1608#endif
1609#else
1610 fHelpArea->setText(path->GetTitle().data());
1611#endif
1612 }
1613 }
1614}
1615
1616/** This callback is activated when user double clic on a item in the help tree
1617*/
1618void G4UIQt::HelpTreeDoubleClicCallback (
1619)
1620{
1621 HelpTreeClicCallback();
1622
1623#if QT_VERSION < 0x040000
1624 QListViewItem* item = NULL;
1625#else
1626 QTreeWidgetItem* item = NULL;
1627#endif
1628 if (!fHelpTreeWidget)
1629 return ;
1630
1631 if (!fHelpArea)
1632 return;
1633
1634#if QT_VERSION < 0x040000
1635 item =fHelpTreeWidget->selectedItem();
1636#else
1637 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
1638 if (list.isEmpty())
1639 return;
1640 item = list.first();
1641#endif
1642 if (!item)
1643 return;
1644
1645 fCommandArea->clear();
1646 fCommandArea->setText(GetLongCommandPath(item));
1647}
1648
1649
1650/** Callback called when user select an old command in the command history<br>
1651 Give it to the command area.
1652*/
1653void G4UIQt::CommandHistoryCallback(
1654)
1655{
1656#if QT_VERSION < 0x040000
1657 QListViewItem* item = NULL;
1658#else
1659 QListWidgetItem* item = NULL;
1660#endif
1661 if (!fHistoryTBTableList)
1662 return ;
1663
1664
1665#if QT_VERSION < 0x040000
1666 item =fHistoryTBTableList->selectedItem();
1667#else
1668 QList<QListWidgetItem *> list =fHistoryTBTableList->selectedItems();
1669 if (list.isEmpty())
1670 return;
1671 item = list.first();
1672#endif
1673 if (!item)
1674 return;
1675#if QT_VERSION < 0x040000
1676 fCommandArea->setText(item->text(0));
1677#else
1678 fCommandArea->setText(item->text());
1679#endif
1680#ifdef G4DEBUG_INTERFACES_BASIC
1681 printf("G4UIQt::CommandHistoryCallback change text\n");
1682#endif
1683}
1684
1685
1686void G4UIQt::CoutFilterCallback(
1687const QString & text) {
1688
1689#ifdef G4DEBUG_INTERFACES_BASIC
1690 printf("G4UIQt::CoutFilterCallback : %s\n",text.toStdString().c_str());
1691#endif
1692
1693 QStringList result = fG4cout.filter(text);
1694
1695 fCoutTBTextArea->setText(result.join("\n"));
1696 fCoutTBTextArea->repaint();
1697#if QT_VERSION < 0x040000
1698 fCoutTBTextArea->verticalScrollBar()->setValue(fCoutTBTextArea->verticalScrollBar()->maxValue());
1699#else
1700 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
1701#endif
1702#ifdef G4DEBUG_INTERFACES_BASIC
1703 printf("G4UIQt::CoutFilterCallback textSize:%d resSize:%d \n",fG4cout.join("").size(),result.join("").size());
1704#endif
1705
1706 }
1707
1708/** Callback called when user give a new string to look for<br>
1709 Display a list of matching commands descriptions. If no string is set,
1710 will display the complete help tree
1711*/
1712void G4UIQt::LookForHelpStringCallback(
1713)
1714{
1715 QString searchText = fHelpLine->text();
1716
1717#if QT_VERSION < 0x040200
1718 fHelpArea->clear();
1719#else
1720 fHelpArea->setText("");
1721#endif
1722 if (searchText =="") {
1723 // clear old help tree
1724 fHelpTreeWidget->clear();
1725#if QT_VERSION < 0x040000
1726 fHelpTreeWidget->removeColumn(1);
1727 fHelpTreeWidget->removeColumn(0);
1728#endif
1729
1730 FillHelpTree();
1731
1732 return;
1733 } else {
1734 OpenHelpTreeOnCommand(searchText);
1735 }
1736}
1737
1738
1739void G4UIQt::OpenHelpTreeOnCommand(
1740 const QString & searchText
1741)
1742{
1743
1744 // the help tree
1745 G4UImanager* UI = G4UImanager::GetUIpointer();
1746 if(UI==NULL) return;
1747 G4UIcommandTree * treeTop = UI->GetTree();
1748
1749 G4int treeSize = treeTop->GetTreeEntry();
1750
1751 // clear old help tree
1752 fHelpTreeWidget->clear();
1753#if QT_VERSION < 0x040000
1754 fHelpTreeWidget->removeColumn(1);
1755 fHelpTreeWidget->removeColumn(0);
1756#endif
1757
1758 // look for new items
1759
1760 int tmp = 0;
1761#if QT_VERSION < 0x040000
1762 int multFactor = 1000; // factor special for having double keys in Qt3
1763 int doubleKeyAdd = 0; // decay for doubleKeys in Qt3
1764#endif
1765
1766 QMap<int,QString> commandResultMap;
1767 QMap<int,QString> commandChildResultMap;
1768
1769 for (int a=0;a<treeSize;a++) {
1770 G4UIcommand* command = treeTop->FindPath(treeTop->GetTree(a+1)->GetPathName().data());
1771#if QT_VERSION > 0x040000
1772 tmp = GetCommandList (command).count(searchText,Qt::CaseInsensitive);
1773#else
1774 tmp = GetCommandList (command).contains(searchText,false);
1775#endif
1776 if (tmp >0) {
1777#if QT_VERSION > 0x040000
1778 commandResultMap.insertMulti(tmp,QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()));
1779#else // tricky thing for Qt3...
1780 doubleKeyAdd = 0;
1781 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1782 doubleKeyAdd ++;
1783 }
1784 commandResultMap.insert( tmp*multFactor+doubleKeyAdd,QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()) );
1785#endif
1786 }
1787 // look for childs
1788 commandChildResultMap = LookForHelpStringInChildTree(treeTop->GetTree(a+1),searchText);
1789 // insert new childs
1790 if (!commandChildResultMap.empty()) {
1791#if QT_VERSION > 0x040000
1792 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
1793 while (i != commandChildResultMap.constEnd()) {
1794 commandResultMap.insertMulti(i.key(),i.value());
1795#else // tricky thing for Qt3...
1796 QMap<int,QString>::const_iterator i = commandChildResultMap.begin();
1797 while (i != commandChildResultMap.end()) {
1798 doubleKeyAdd = 0;
1799 while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1800 doubleKeyAdd ++;
1801 }
1802 commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data());
1803#endif
1804 i++;
1805 }
1806 commandChildResultMap.clear();
1807 }
1808 }
1809
1810 // build new help tree
1811#if QT_VERSION < 0x040000
1812 fHelpTreeWidget->setSelectionMode(QListView::Single);
1813 fHelpTreeWidget->setRootIsDecorated(true);
1814 fHelpTreeWidget->addColumn("Command");
1815 fHelpTreeWidget->addColumn("Match");
1816 // fHelpTreeWidget->header()->setResizeEnabled(FALSE,1);
1817#else
1818 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
1819 fHelpTreeWidget->setColumnCount(2);
1820 QStringList labels;
1821 labels << QString("Command") << QString("Match");
1822 fHelpTreeWidget->setHeaderLabels(labels);
1823#endif
1824
1825 if (commandResultMap.empty()) {
1826#if QT_VERSION < 0x040200
1827 fHelpArea->clear();
1828 fHelpArea->append("No match found");
1829#else
1830 fHelpArea->setText("No match found");
1831#endif
1832 return;
1833 }
1834
1835#if QT_VERSION > 0x040000
1836 QMap<int,QString>::const_iterator i = commandResultMap.constEnd();
1837#else
1838 QMap<int,QString>::const_iterator i = commandResultMap.end();
1839#endif
1840 i--;
1841 // 10 maximum progress values
1842 float multValue = 10.0/(float)(i.key());
1843 QString progressChar = "|";
1844 QString progressStr = "|";
1845
1846#if QT_VERSION < 0x040000
1847 QListViewItem * newItem;
1848#else
1849 QTreeWidgetItem * newItem;
1850#endif
1851 bool end = false;
1852 while (!end) {
1853#if QT_VERSION > 0x040000
1854 if (i == commandResultMap.constBegin()) {
1855#else
1856 if (i == commandResultMap.begin()) {
1857#endif
1858 end = true;
1859 }
1860 for(int a=0;a<int(i.key()*multValue);a++) {
1861 progressStr += progressChar;
1862 }
1863#if QT_VERSION < 0x040000
1864 newItem = new QListViewItem(fHelpTreeWidget);
1865 newItem->setText(0,i.data().simplifyWhiteSpace());
1866#else
1867 newItem = new QTreeWidgetItem(fHelpTreeWidget);
1868 newItem->setText(0,i.value().trimmed());
1869#endif
1870 newItem->setText(1,progressStr);
1871
1872#if QT_VERSION >= 0x040200
1873 newItem->setForeground ( 1, QBrush(Qt::blue) );
1874#endif
1875 progressStr = "|";
1876 i--;
1877 }
1878 // FIXME : to be checked on Qt3
1879#if QT_VERSION < 0x040000
1880 fHelpTreeWidget->setColumnWidthMode (1,QListView::Maximum);
1881 fHelpTreeWidget->setSorting(1,false);
1882#else
1883 fHelpTreeWidget->resizeColumnToContents (0);
1884 fHelpTreeWidget->sortItems(1,Qt::DescendingOrder);
1885 // fHelpTreeWidget->setColumnWidth(1,10);//resizeColumnToContents (1);
1886#endif
1887}
1888
1889
1890
1891
1892QMap<int,QString> G4UIQt::LookForHelpStringInChildTree(
1893 G4UIcommandTree *aCommandTree
1894,const QString & text
1895 )
1896{
1897 QMap<int,QString> commandResultMap;
1898 if (aCommandTree == NULL) return commandResultMap;
1899
1900#if QT_VERSION < 0x040000
1901 int multFactor = 1000; // factor special for having double keys in Qt3
1902 int doubleKeyAdd = 0; // decay for doubleKeys in Qt3
1903#endif
1904
1905 // Get the Sub directories
1906 int tmp = 0;
1907 QMap<int,QString> commandChildResultMap;
1908
1909 for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
1910 const G4UIcommand* command = aCommandTree->GetGuidance();
1911#if QT_VERSION > 0x040000
1912 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
1913#else
1914 tmp = GetCommandList (command).contains(text,false);
1915#endif
1916 if (tmp >0) {
1917#if QT_VERSION > 0x040000
1918 commandResultMap.insertMulti(tmp,QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()));
1919#else // tricky thing for Qt3...
1920 doubleKeyAdd = 0;
1921 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1922 doubleKeyAdd ++;
1923 }
1924 commandResultMap.insert(tmp*multFactor+doubleKeyAdd,QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()));
1925#endif
1926 }
1927 // look for childs
1928 commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->GetTree(a+1),text);
1929
1930 if (!commandChildResultMap.empty()) {
1931 // insert new childs
1932#if QT_VERSION > 0x040000
1933 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
1934 while (i != commandChildResultMap.constEnd()) {
1935 commandResultMap.insertMulti(i.key(),i.value());
1936#else // tricky thing for Qt3...
1937 QMap<int,QString>::const_iterator i = commandChildResultMap.begin();
1938 while (i != commandChildResultMap.end()) {
1939 doubleKeyAdd = 0;
1940 while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1941 doubleKeyAdd ++;
1942 }
1943 commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data());
1944#endif
1945 i++;
1946 }
1947 commandChildResultMap.clear();
1948 }
1949 }
1950 // Get the Commands
1951
1952 for (int a=0;a<aCommandTree->GetCommandEntry();a++) {
1953 const G4UIcommand* command = aCommandTree->GetCommand(a+1);
1954#if QT_VERSION > 0x040000
1955 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
1956#else
1957 tmp = GetCommandList (command).contains(text,false);
1958#endif
1959 if (tmp >0) {
1960#if QT_VERSION > 0x040000
1961 commandResultMap.insertMulti(tmp,QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()));
1962#else // tricky thing for Qt3...
1963 doubleKeyAdd = 0;
1964 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1965 doubleKeyAdd ++;
1966 }
1967 commandResultMap.insert(tmp*multFactor+doubleKeyAdd,QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()));
1968#endif
1969 }
1970
1971 }
1972 return commandResultMap;
1973}
1974
1975
1976QString G4UIQt::GetShortCommandPath(
1977QString commandPath
1978)
1979{
1980 if (commandPath.indexOf("/") == 0) {
1981 commandPath = commandPath.right(commandPath.size()-1);
1982 }
1983
1984 commandPath = commandPath.right(commandPath.size()-commandPath.lastIndexOf("/",-2)-1);
1985
1986 if (commandPath.lastIndexOf("/") == (commandPath.size()-1)) {
1987 commandPath = commandPath.left(commandPath.size()-1);
1988 }
1989
1990 return commandPath;
1991}
1992
1993
1994QString G4UIQt::GetLongCommandPath(
1995#if QT_VERSION < 0x040000
1996 QListViewItem* item
1997#else
1998 QTreeWidgetItem* item
1999#endif
2000)
2001{
2002 if (item == NULL) return "";
2003
2004 // rebuild path:
2005 QString itemText = "";
2006 itemText = item->text(0);
2007
2008 while (item->parent() != NULL) {
2009 itemText = item->parent()->text(0)+"/"+itemText;
2010 item = item->parent();
2011 }
2012 itemText = "/"+itemText;
2013
2014 return itemText;
2015}
2016
2017G4QTabWidget::G4QTabWidget(
2018QSplitter*& split
2019):QTabWidget(split)
2020 ,tabSelected(false)
2021 ,lastCreated(-1)
2022{
2023}
2024
2025G4QTabWidget::G4QTabWidget(
2026):QTabWidget()
2027 ,tabSelected(false)
2028 ,lastCreated(-1)
2029{
2030}
2031
2032
2033
2034void G4UIQt::TabCloseCallback(int a){
2035 QWidget* temp = fTabWidget->widget(a);
2036 fTabWidget->removeTab (a);
2037 delete temp;
2038
2039 if (fTabWidget->count() == 0) {
2040 fMyVSplitter->addWidget(fEmptyViewerTabLabel);
2041#if QT_VERSION < 0x040000
2042 fTabWidget->reparent(0,0,QPoint(0,0));
2043#else
2044 fTabWidget->setParent(0);
2045#endif
2046 }
2047}
2048
2049
2050void G4UIQt::ToolBoxActivated(int a){
2051
2052 if (fToolBox->widget(a) == fHelpTBWidget) {
2053 // Rebuild the help tree
2054 FillHelpTree();
2055 }
2056}
2057
2058void G4QTabWidget::paintEvent(
2059QPaintEvent * event
2060)
2061{
2062
2063 if (currentWidget()) {
2064#ifdef G4DEBUG_INTERFACES_BASIC
2065 printf("G4QTabWidget::paintEvent repaint type : %d -- rect %d %d region:%d %d page : %d %d ________________________ i= %d\n", event->type(),event->rect().height(),event->rect().width(),event->region().boundingRect().width(),event->region().boundingRect().height(),currentWidget()->width(),currentWidget()->height(),currentIndex());
2066#endif
2067 if ( isTabSelected()) {
2068
2069#if QT_VERSION < 0x040000
2070 QApplication::sendPostedEvents () ;
2071#else
2072 QCoreApplication::sendPostedEvents () ;
2073#endif
2074
2075#ifdef G4DEBUG_INTERFACES_BASIC
2076 printf("G4QTabWidget::paintEvent OK\n");
2077#endif
2078#if QT_VERSION < 0x040000
2079 QString text = label (currentPageIndex());
2080#else
2081 QString text = tabText (currentIndex());
2082#endif
2083
2084 if (lastCreated == -1) {
2085 QString paramSelect = QString("/vis/viewer/select ")+text;
2086 G4UImanager* UI = G4UImanager::GetUIpointer();
2087 if(UI != NULL) {
2088 UI->ApplyCommand(paramSelect.toStdString().c_str());
2089 }
2090 } else {
2091 lastCreated = -1;
2092 }
2093 unselectTab();
2094 repaint();
2095 }
2096 }
2097}
2098
2099#endif
Note: See TracBrowser for help on using the repository browser.