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

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

test qt3

  • Property svn:mime-type set to text/cpp
File size: 54.9 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#if QT_VERSION < 0x040000
549 // L.Garnier 26/05/2010 : not exactly the same in qt4. Could cause some
550 // troubles
551 if ( fMyVSplitter->idAfter(fEmptyViewerTabLabel) != -1) {
552#else
553 if ( fMyVSplitter->indexOf(fEmptyViewerTabLabel) != -1) {
554#endif
555#if QT_VERSION < 0x040000
556 fEmptyViewerTabLabel->reparent(0,0,QPoint(0,0));
557#else
558 fEmptyViewerTabLabel->setParent(0);
559 fMyVSplitter->addWidget(fTabWidget);
560#endif
561#if QT_VERSION < 0x040000
562 aWidget->reparent(fTabWidget,0,QPoint(0,0));
563#else
564 aWidget->setParent(fTabWidget);
565#endif
566 }
567
568
569
570#ifdef G4DEBUG_INTERFACES_BASIC
571 printf("G4UIQt::AddTabWidget ADD %d %d + %d %d---------------------------------------------------\n",sizeX, sizeY,sizeX-fTabWidget->width(),sizeY-fTabWidget->height());
572#endif
573
574 fMainWindow->resize(fMainWindow->width()+sizeX-fTabWidget->width(),fMainWindow->height()+sizeY-fTabWidget->height());
575
576 // Problems with resize. The widgets are not realy drawn at this step,
577 // then we have to force them on order to check the size
578
579#if QT_VERSION < 0x040000
580 fTabWidget->insertTab(aWidget,name,fTabWidget->count());
581#else
582 fTabWidget->insertTab(fTabWidget->count(),aWidget,name);
583#endif
584
585#if QT_VERSION < 0x040000
586 fTabWidget->setCurrentPage(fTabWidget->count()-1);
587#else
588 fTabWidget->setCurrentIndex(fTabWidget->count()-1);
589#endif
590
591 // Set visible
592#if QT_VERSION >= 0x040000
593 #if QT_VERSION >= 0x040200
594 fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
595 fMainWindow->setVisible(true);
596 #else
597 fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
598 fMainWindow->show();
599 #endif
600#else
601 fTabWidget->setLastTabCreated(fTabWidget->currentPageIndex());
602 fMainWindow->show();
603#endif
604
605#if QT_VERSION >= 0x040000
606 #if QT_VERSION >= 0x040200
607 fTabWidget->setVisible(true);
608 #else
609 fTabWidget->show;
610 #endif
611#else
612 fTabWidget->show;
613#endif
614
615 return true;
616}
617
618
619void G4UIQt::UpdateTabWidget(int tabNumber) {
620#ifdef G4DEBUG_INTERFACES_BASIC
621 printf("G4UIQt::UpdateTabWidget %d\n",tabNumber);
622#endif
623 if ( fTabWidget == NULL) {
624 fTabWidget = new G4QTabWidget;
625 }
626
627
628#ifdef G4DEBUG_INTERFACES_BASIC
629 printf("G4UIQt::UpdateTabWidget CALL REPAINT tabGL\n");
630#endif
631
632#if QT_VERSION < 0x040000
633 fTabWidget->setCurrentPage(tabNumber);
634#else
635 fTabWidget->setCurrentIndex(tabNumber);
636#endif
637
638 // Send this signal to unblock graphic updates !
639#if QT_VERSION >= 0x040000
640 #if QT_VERSION >= 0x040200
641 fTabWidget->setVisible(true);
642 #else
643 fTabWidget->show;
644 #endif
645#else
646 fTabWidget->show;
647#endif
648
649 // This will send a paintEvent to OGL Viewers
650 fTabWidget->setTabSelected();
651
652#if QT_VERSION < 0x040000
653 QApplication::sendPostedEvents () ;
654#else
655 QCoreApplication::sendPostedEvents () ;
656#endif
657
658#ifdef G4DEBUG_INTERFACES_BASIC
659 printf("G4UIQt::UpdateTabWidget END\n");
660#endif
661}
662
663
664/** Send resize event to all tabs
665 */
666void G4UIQt::ResizeTabWidget( QResizeEvent* e) {
667 for (int a=0;a<fTabWidget->count() ;a++) {
668#ifdef G4DEBUG_INTERFACES_BASIC
669 printf("G4UIQt::ResizeTabWidget +++++++++++++++++++++++++++++++++++++++\n");
670#endif
671 fTabWidget->widget(a)->resize(e->size());
672 }
673}
674
675
676/** Start the Qt main loop
677*/
678G4UIsession* G4UIQt::SessionStart (
679)
680{
681#ifdef G4DEBUG_INTERFACES_BASIC
682 printf("G4UIQt::G4UIQt SessionStart\n");
683#endif
684
685 G4Qt* interactorManager = G4Qt::getInstance ();
686
687 Prompt("Session :");
688 exitSession = false;
689
690 fTabWidget->setVisible(true);
691 fEmptyViewerTabLabel->setVisible(true);
692
693#if QT_VERSION >= 0x040000
694#if QT_VERSION >= 0x040200
695 fMainWindow->setVisible(true);
696#else
697 fMainWindow->show();
698#endif
699#else
700 fMainWindow->show();
701#endif
702
703#if QT_VERSION < 0x040000
704 QApplication::sendPostedEvents () ;
705#else
706 QCoreApplication::sendPostedEvents () ;
707#endif
708
709#ifdef G4DEBUG_INTERFACES_BASIC
710 printf("G4UIQt::G4UIQt SessionStart2\n");
711#endif
712 interactorManager->DisableSecondaryLoop (); // TO KEEP
713 if ((QApplication*)interactorManager->GetMainInteractor())
714 ((QApplication*)interactorManager->GetMainInteractor())->exec();
715
716 // on ne passe pas le dessous ? FIXME ????
717 // je ne pense pas 13/06
718
719 // void* event; // TO KEEP
720 // while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP
721 // interactorManager->DispatchEvent(event); // TO KEEP
722 // if(exitSession==true) break; // TO KEEP
723 // } // TO KEEP
724
725 interactorManager->EnableSecondaryLoop ();
726 return this;
727}
728
729
730/** Display the prompt in the prompt area
731 @param aPrompt : string to display as the promt label
732 //FIXME : probablement inutile puisque le seul a afficher qq chose d'autre
733 que "session" est SecondaryLoop()
734*/
735void G4UIQt::Prompt (
736 G4String aPrompt
737)
738{
739 if (!aPrompt) return;
740
741 fCommandLabel->setText((char*)aPrompt.data());
742}
743
744
745
746void G4UIQt::SessionTerminate (
747)
748{
749 G4Qt* interactorManager = G4Qt::getInstance ();
750 fMainWindow->close();
751 ((QApplication*)interactorManager->GetMainInteractor())->exit();
752}
753
754
755
756/**
757 Called by intercoms/src/G4UImanager.cc<br>
758 Called by visualization/management/src/G4VisCommands.cc with "EndOfEvent" argument<br>
759 It have to pause the session command terminal.<br>
760 Call SecondaryLoop to wait for exit event<br>
761 @param aState
762 @see : G4VisCommandReviewKeptEvents::SetNewValue
763*/
764void G4UIQt::PauseSessionStart (
765 G4String aState
766)
767{
768 if (!aState) return;
769
770 if(aState=="G4_pause> ") { // TO KEEP
771 SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
772 } // TO KEEP
773
774 if(aState=="EndOfEvent") { // TO KEEP
775 // Picking with feed back in event data Done here !!!
776 SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP
777 } // TO KEEP
778}
779
780
781
782/**
783 Begin the secondary loop
784 @param a_prompt : label to display as the prompt label
785 */
786void G4UIQt::SecondaryLoop (
787 G4String aPrompt
788)
789{
790 if (!aPrompt) return;
791
792 G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
793 Prompt(aPrompt); // TO KEEP
794 exitPause = false; // TO KEEP
795 void* event; // TO KEEP
796 while((event = interactorManager->GetEvent())!=NULL) { // TO KEEP
797 interactorManager->DispatchEvent(event); // TO KEEP
798 if(exitPause==true) break; // TO KEEP
799 } // TO KEEP
800 Prompt("Session :"); // TO KEEP
801}
802
803
804
805/**
806 Receive a cout from Geant4. We have to display it in the cout zone
807 @param aString : label to add in the display area
808 @return 0
809*/
810G4int G4UIQt::ReceiveG4cout (
811 G4String aString
812 )
813{
814 if (!aString) return 0;
815
816 QStringList newStr;
817
818 // Add to stringList
819#if QT_VERSION < 0x040000
820 newStr = QStringList(QString((char*)aString.data()).simplifyWhiteSpace());
821#else
822 newStr = QStringList(QString((char*)aString.data()).trimmed());
823#endif
824 fG4cout += newStr;
825
826 QStringList result = newStr.filter(fCoutFilter->text());
827
828 if (result.join("\n").isEmpty()) {
829 return 0;
830 }
831 fCoutTBTextArea->append(result.join("\n"));
832 fCoutTBTextArea->repaint();
833
834#if QT_VERSION < 0x040000
835 fCoutTBTextArea->verticalScrollBar()->setValue(fCoutTBTextArea->verticalScrollBar()->maxValue());
836#else
837 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
838#endif
839
840 return 0;
841}
842
843
844/**
845 Receive a cerr from Geant4. We have to display it in the cout zone
846 @param aString : label to add in the display area
847 @return 0
848*/
849G4int G4UIQt::ReceiveG4cerr (
850 G4String aString
851)
852{
853 if (!aString) return 0;
854
855 QStringList newStr;
856
857 // Add to stringList
858#if QT_VERSION < 0x040000
859 newStr = QStringList(QString((char*)aString.data()).simplifyWhiteSpace());
860#else
861 newStr = QStringList(QString((char*)aString.data()).trimmed());
862#endif
863 fG4cout += newStr;
864
865 QStringList result = newStr.filter(fCoutFilter->text());
866
867#if QT_VERSION < 0x040000
868 QColor previousColor = fCoutTBTextArea->color();
869 fCoutTBTextArea->setColor(Qt::red);
870 fCoutTBTextArea->append(result.join("\n"));
871 fCoutTBTextArea->setColor(previousColor);
872 fCoutTBTextArea->verticalScrollBar()->setValue(fCoutTBTextArea->verticalScrollBar()->maxValue());
873#else
874 QColor previousColor = fCoutTBTextArea->textColor();
875 fCoutTBTextArea->setTextColor(Qt::red);
876 fCoutTBTextArea->append(result.join("\n"));
877 fCoutTBTextArea->setTextColor(previousColor);
878 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
879#endif
880 fCoutTBTextArea->repaint();
881 return 0;
882}
883
884
885
886/**
887 Add a new menu to the menu bar
888 @param aName name of menu
889 @param aLabel label to display
890 */
891void G4UIQt::AddMenu (
892 const char* aName
893,const char* aLabel
894)
895{
896 if (aName == NULL) return;
897 if (aLabel == NULL) return;
898
899#if QT_VERSION < 0x040000
900 QPopupMenu *fileMenu = new QPopupMenu( fMainWindow);
901 fMainWindow->menuBar()->insertItem( aLabel, fileMenu );
902#else
903 QMenu *fileMenu = new QMenu(aLabel);
904 fMainWindow->menuBar()->insertMenu(fMainWindow->menuBar()->actions().last(),fileMenu);
905#endif
906
907 AddInteractor (aName,(G4Interactor)fileMenu);
908}
909
910
911/**
912 Add a new button to a menu
913 @param aMenu : parent menu
914 @param aLabel : label to display
915 @param aCommand : command to execute as a callback
916 */
917void G4UIQt::AddButton (
918 const char* aMenu
919,const char* aLabel
920,const char* aCommand
921)
922{
923 if(aMenu==NULL) return; // TO KEEP
924 if(aLabel==NULL) return; // TO KEEP
925 if(aCommand==NULL) return; // TO KEEP
926
927#if QT_VERSION < 0x040000
928 QPopupMenu *parent = (QPopupMenu*)GetInteractor(aMenu);
929#else
930 QMenu *parent = (QMenu*)GetInteractor(aMenu);
931#endif
932
933 if(parent==NULL) return;
934
935 QSignalMapper *signalMapper = new QSignalMapper(this);
936#if QT_VERSION < 0x030200
937 QAction *action = new QAction(QString(aLabel),QString(aLabel),QKeySequence(),signalMapper, SLOT(map()));
938 action->addTo(parent);
939 connect(action,SIGNAL(activated()),signalMapper,SLOT(map()));
940
941#elif QT_VERSION < 0x040000
942 QAction *action = new QAction(QString(aLabel),QKeySequence(),signalMapper, SLOT(map()));
943 action->addTo(parent);
944 connect(action,SIGNAL(activated()),signalMapper,SLOT(map()));
945
946#else
947 QAction *action = parent->addAction(aLabel, signalMapper, SLOT(map()));
948
949#endif
950 connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ButtonCallback(const QString&)));
951 signalMapper->setMapping(action, QString(aCommand));
952}
953
954
955
956
957void G4UIQt::ActivateCommand(
958 G4String newCommand
959)
960{
961 if (!fHelpTreeWidget) {
962 return;
963 }
964 // Look for the choosen command "newCommand"
965 size_t i = newCommand.index(" ");
966 G4String targetCom ="";
967 if( i != std::string::npos )
968 {
969 G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
970 newValue.strip(G4String::both);
971 targetCom = ModifyToFullPathCommand( newValue );
972 }
973#ifdef G4DEBUG_INTERFACES_BASIC
974 printf("G4UIQt::ActivateCommand found : %s \n",targetCom.data());
975#endif
976 if (targetCom != "") {
977 OpenHelpTreeOnCommand(targetCom.data());
978 }
979
980 fToolBox->setCurrentWidget(fHelpTBWidget);
981}
982
983
984
985/**
986 Create the help tree widget
987 @param parent : parent of tree widget
988 @return the widget containing the tree or NULL if it could not have beeen created
989 */
990
991void G4UIQt::InitHelpTree()
992{
993
994 if (! fHelpTreeWidget ) {
995#if QT_VERSION < 0x040000
996 fHelpTreeWidget = new QListView(splitter);
997#else
998 fHelpTreeWidget = new QTreeWidget();
999#endif
1000 }
1001
1002
1003 // build widget
1004#if QT_VERSION < 0x040000
1005 fHelpTreeWidget->setSelectionMode(QListView::Single);
1006 fHelpTreeWidget->setRootIsDecorated(true);
1007 fHelpTreeWidget->addColumn("Command");
1008 fHelpTreeWidget->header()->setResizeEnabled(FALSE,1);
1009#else
1010 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
1011 QStringList labels;
1012 labels << QString("Command");
1013 fHelpTreeWidget->setHeaderLabels(labels);
1014#endif
1015
1016
1017#if QT_VERSION < 0x040000
1018 connect(fHelpTreeWidget, SIGNAL(selectionChanged ()),this, SLOT(HelpTreeClicCallback()));
1019 connect(fHelpTreeWidget, SIGNAL(doubleClicked (QListViewItem*)),this, SLOT(HelpTreeDoubleClicCallback()));
1020#else
1021 connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),this, SLOT(HelpTreeClicCallback()));
1022 connect(fHelpTreeWidget, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,int)),this, SLOT(HelpTreeDoubleClicCallback()));
1023#endif
1024
1025}
1026/**
1027 Create the help tree widget
1028 @param parent : parent of tree widget
1029 @return the widget containing the tree or NULL if it could not have beeen created
1030 */
1031
1032void G4UIQt::FillHelpTree()
1033{
1034 if (! fHelpTreeWidget ) {
1035 InitHelpTree();
1036 }
1037
1038 G4UImanager* UI = G4UImanager::GetUIpointer();
1039 if(UI==NULL) return;
1040 G4UIcommandTree * treeTop = UI->GetTree();
1041
1042 G4int treeSize = treeTop->GetTreeEntry();
1043#if QT_VERSION < 0x040000
1044 QListViewItem * newItem = NULL;
1045#else
1046 QTreeWidgetItem * newItem = NULL;
1047#endif
1048 QString commandText = "";
1049 for (int a=0;a<treeSize;a++) {
1050 // Creating new item
1051 newItem = NULL;
1052
1053#if QT_VERSION < 0x040000
1054 commandText = QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace();
1055#else
1056 commandText = QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).trimmed();
1057#endif
1058
1059 // if already exist, don't create it !
1060#if QT_VERSION < 0x040000
1061 QListViewItem* tmpAddItem = fHelpTreeWidget->firstChild();
1062 while (tmpAddItem != 0) {
1063 if (!newItem) {
1064 newItem = FindTreeItem(tmpAddItem,commandText);
1065 }
1066 tmpAddItem = tmpAddItem->nextSibling();
1067 }
1068#else
1069 for (int b=0;b<fHelpTreeWidget->topLevelItemCount();b++) {
1070 if (!newItem)
1071 newItem = FindTreeItem(fHelpTreeWidget->topLevelItem(b),commandText);
1072 }
1073#endif
1074
1075 if (newItem == NULL) {
1076
1077#if QT_VERSION < 0x040000
1078 newItem = new QListViewItem(fHelpTreeWidget);
1079#else
1080 newItem = new QTreeWidgetItem(fHelpTreeWidget);
1081#endif
1082 newItem->setText(0,GetShortCommandPath(commandText));
1083 }
1084
1085 // look for childs
1086 CreateChildTree(newItem,treeTop->GetTree(a+1));
1087 }
1088
1089}
1090
1091
1092
1093/** Fill the Help Tree Widget
1094 @param aParent : parent item to fill
1095 @param aCommandTree : commandTree node associate with this part of the Tree
1096*/
1097#if QT_VERSION < 0x040000
1098void G4UIQt::CreateChildTree(
1099 QListViewItem *aParent
1100,G4UIcommandTree *aCommandTree
1101#else
1102void G4UIQt::CreateChildTree(
1103 QTreeWidgetItem *aParent
1104,G4UIcommandTree *aCommandTree
1105#endif
1106)
1107{
1108 if (aParent == NULL) return;
1109 if (aCommandTree == NULL) return;
1110
1111
1112 // Creating new item
1113#if QT_VERSION < 0x040000
1114 QListViewItem * newItem;
1115#else
1116 QTreeWidgetItem * newItem;
1117#endif
1118
1119 QString commandText = "";
1120 // Get the Sub directories
1121 for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
1122
1123#if QT_VERSION < 0x040000
1124 commandText = QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace();
1125#else
1126 commandText = QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).trimmed();
1127#endif
1128
1129 // if already exist, don't create it !
1130 newItem = FindTreeItem(aParent,commandText);
1131 if (newItem == NULL) {
1132#if QT_VERSION < 0x040000
1133 newItem = new QListViewItem(aParent);
1134#else
1135 newItem = new QTreeWidgetItem(aParent);
1136#endif
1137 newItem->setText(0,GetShortCommandPath(commandText));
1138 }
1139 CreateChildTree(newItem,aCommandTree->GetTree(a+1));
1140 }
1141
1142
1143
1144 // Get the Commands
1145
1146 for (int a=0;a<aCommandTree->GetCommandEntry();a++) {
1147
1148 QStringList stringList;
1149#if QT_VERSION < 0x040000
1150 commandText = QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).simplifyWhiteSpace();
1151#else
1152 commandText = QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed();
1153#endif
1154
1155 // if already exist, don't create it !
1156 newItem = FindTreeItem(aParent,commandText);
1157 if (newItem == NULL) {
1158#if QT_VERSION < 0x040000
1159 newItem = new QListViewItem(aParent);
1160 newItem->setText(0,GetShortCommandPath(commandText));
1161 newItem->setOpen(false);
1162
1163#else
1164 newItem = new QTreeWidgetItem(aParent);
1165 newItem->setText(0,GetShortCommandPath(commandText));
1166#if QT_VERSION < 0x040202
1167 fHelpTreeWidget->setItemExpanded(newItem,false);
1168#else
1169 newItem->setExpanded(false);
1170#endif
1171#endif
1172 }
1173 }
1174}
1175
1176
1177/** Find a treeItemWidget in the help tree
1178 @param aCommand item's String to look for
1179 @return item if found, NULL if not
1180*/
1181#if QT_VERSION < 0x040000
1182QListViewItem* G4UIQt::FindTreeItem(
1183 QListViewItem *aParent
1184#else
1185QTreeWidgetItem* G4UIQt::FindTreeItem(
1186 QTreeWidgetItem *aParent
1187#endif
1188,const QString& aCommand
1189)
1190{
1191 if (aParent == NULL) return NULL;
1192
1193 // Suppress last "/"
1194 QString myCommand = aCommand;
1195
1196 if (myCommand.lastIndexOf("/") == (myCommand.size()-1)) {
1197 myCommand = myCommand.left(myCommand.size()-1);
1198 }
1199
1200 if (GetLongCommandPath(aParent) == myCommand)
1201 return aParent;
1202
1203#if QT_VERSION < 0x040000
1204 QListViewItem * tmp = NULL;
1205 QListViewItem* tmpItem = aParent->firstChild();
1206 while (tmpItem != 0) {
1207 if (!tmp)
1208 tmp = FindTreeItem(tmpItem,myCommand);
1209 tmpItem = tmpItem->nextSibling();
1210 }
1211#else
1212 QTreeWidgetItem * tmp = NULL;
1213 for (int a=0;a<aParent->childCount();a++) {
1214 if (!tmp)
1215 tmp = FindTreeItem(aParent->child(a),myCommand);
1216 }
1217#endif
1218 return tmp;
1219}
1220
1221
1222
1223/** Build the command list parameters in a QString<br>
1224 Reimplement partialy the G4UIparameter.cc
1225 @param aCommand : command to list parameters
1226 @see G4UIparameter::List()
1227 @see G4UIcommand::List()
1228 @return the command list parameters, or "" if nothing
1229*/
1230QString G4UIQt::GetCommandList (
1231 const G4UIcommand *aCommand
1232)
1233{
1234
1235 QString txt ="";
1236 if (aCommand == NULL)
1237 return txt;
1238
1239 G4String commandPath = aCommand->GetCommandPath();
1240 G4String rangeString = aCommand->GetRange();
1241 G4int n_guidanceEntry = aCommand->GetGuidanceEntries();
1242 G4int n_parameterEntry = aCommand->GetParameterEntries();
1243
1244 if ((commandPath == "") &&
1245 (rangeString == "") &&
1246 (n_guidanceEntry == 0) &&
1247 (n_parameterEntry == 0)) {
1248 return txt;
1249 }
1250
1251 if((commandPath.length()-1)!='/') {
1252 txt += "Command " + QString((char*)(commandPath).data()) + "\n";
1253 }
1254 txt += "Guidance :\n";
1255
1256 for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) {
1257 txt += QString((char*)(aCommand->GetGuidanceLine(i_thGuidance)).data()) + "\n";
1258 }
1259 if( ! rangeString.isNull() ) {
1260 txt += " Range of parameters : " + QString((char*)(rangeString).data()) + "\n";
1261 }
1262 if( n_parameterEntry > 0 ) {
1263 G4UIparameter *param;
1264
1265 // Re-implementation of G4UIparameter.cc
1266
1267 for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) {
1268 param = aCommand->GetParameter(i_thParameter);
1269 txt += "\nParameter : " + QString((char*)(param->GetParameterName()).data()) + "\n";
1270 if( ! param->GetParameterGuidance().isNull() )
1271 txt += QString((char*)(param->GetParameterGuidance()).data())+ "\n" ;
1272 txt += " Parameter type : " + QString(QChar(param->GetParameterType())) + "\n";
1273 if(param->IsOmittable()){
1274 txt += " Omittable : True\n";
1275 } else {
1276 txt += " Omittable : False\n";
1277 }
1278 if( param->GetCurrentAsDefault() ) {
1279 txt += " Default value : taken from the current value\n";
1280 } else if( ! param->GetDefaultValue().isNull() ) {
1281 txt += " Default value : " + QString((char*)(param->GetDefaultValue()).data())+ "\n";
1282 }
1283 if( ! param->GetParameterRange().isNull() ) {
1284 txt += " Parameter range : " + QString((char*)(param->GetParameterRange()).data())+ "\n";
1285 }
1286 if( ! param->GetParameterCandidates().isNull() ) {
1287 txt += " Candidates : " + QString((char*)(param->GetParameterCandidates()).data())+ "\n";
1288 }
1289 }
1290 }
1291 return txt;
1292}
1293
1294
1295
1296/** Implement G4VBasicShell vurtual function
1297 */
1298G4bool G4UIQt::GetHelpChoice(
1299 G4int&
1300)
1301{
1302#ifdef G4DEBUG_INTERFACES_BASIC
1303 printf("G4UIQt::GetHelpChoice SHOULD NEVER GO HERE");
1304#endif
1305 return true;
1306}
1307
1308
1309/** Event filter method. Every event from QtApplication goes here.<br/>
1310 We apply a filter only for the Up and Down Arrow press when the QLineEdit<br/>
1311 is active. If this filter match, Up arrow we give the previous command<br/>
1312 and Down arrow will give the next if exist.<br/>
1313 @param obj Emitter of the event
1314 @param event Kind of event
1315*/
1316bool G4UIQt::eventFilter( // Should stay with a minuscule eventFilter because of Qt
1317 QObject *aObj
1318,QEvent *aEvent
1319)
1320{
1321 bool moveCommandCursor = false;
1322 if (aObj == NULL) return false;
1323 if (aEvent == NULL) return false;
1324
1325 if (aObj == fHistoryTBTableList) {
1326 if (aEvent->type() == QEvent::KeyPress) {
1327 fCommandArea->setFocus();
1328 }
1329 }
1330 if (aObj == fCommandArea) {
1331 if (aEvent->type() == QEvent::KeyPress) {
1332 QKeyEvent *e = static_cast<QKeyEvent*>(aEvent);
1333 if ((e->key() == (Qt::Key_Down)) ||
1334 (e->key() == (Qt::Key_PageDown)) ||
1335 (e->key() == (Qt::Key_Up)) ||
1336 (e->key() == (Qt::Key_PageUp))) {
1337#if QT_VERSION < 0x040000
1338 // count rows...
1339 QListViewItem* tmpItem = fHistoryTBTableList->firstChild();
1340 int selection = -1;
1341 int index = 0;
1342 while (tmpItem != 0) {
1343 if (tmpItem == fHistoryTBTableList->selectedItem()) {
1344 selection = index;
1345 }
1346 index ++;
1347 tmpItem = tmpItem->nextSibling();
1348 }
1349 if (fHistoryTBTableList->childCount()) {
1350 if (selection == -1) {
1351 selection = fHistoryTBTableList->childCount()-1;
1352 } else {
1353 if (e->key() == (Qt::Key_Down)) {
1354 if (selection <(fHistoryTBTableList->childCount()-1))
1355 selection++;
1356 } else if (e->key() == (Qt::Key_PageDown)) {
1357 selection = fHistoryTBTableList->childCount()-1;
1358#else
1359 int selection = fHistoryTBTableList->currentRow();
1360 if (fHistoryTBTableList->count()) {
1361 if (selection == -1) {
1362 selection = fHistoryTBTableList->count()-1;
1363 } else {
1364 if (e->key() == (Qt::Key_Down)) {
1365 if (selection <(fHistoryTBTableList->count()-1))
1366 selection++;
1367 } else if (e->key() == (Qt::Key_PageDown)) {
1368 selection = fHistoryTBTableList->count()-1;
1369#endif
1370 } else if (e->key() == (Qt::Key_Up)) {
1371 if (selection >0)
1372 selection --;
1373 } else if (e->key() == (Qt::Key_PageUp)) {
1374 selection = 0;
1375 }
1376 }
1377 fHistoryTBTableList->clearSelection();
1378#if QT_VERSION < 0x040000
1379 QListViewItem* tmpItem = fHistoryTBTableList->firstChild();
1380 int index = 0;
1381 while (tmpItem != 0) {
1382 if (index == selection) {
1383 tmpItem->setSelected(true);
1384 fHistoryTBTableList->setCurrentItem(tmpItem);
1385 }
1386 index ++;
1387 tmpItem = tmpItem->nextSibling();
1388 }
1389#else
1390#if QT_VERSION < 0x040202
1391 fHistoryTBTableList->setItemSelected(fHistoryTBTableList->item(selection),true);
1392#else
1393 fHistoryTBTableList->item(selection)->setSelected(true);
1394#endif
1395 fHistoryTBTableList->setCurrentItem(fHistoryTBTableList->item(selection));
1396#endif
1397 }
1398 moveCommandCursor = true;
1399 } else if (e->key() == (Qt::Key_Tab)) {
1400#if QT_VERSION < 0x040000
1401 G4String ss = Complete(fCommandArea->text().ascii());
1402#else
1403 G4String ss = Complete(fCommandArea->text().toStdString().c_str());
1404#endif
1405 fCommandArea->setText((char*)(ss.data()));
1406
1407 // do not pass by parent, it will disable widget tab focus !
1408 return true;
1409#if QT_VERSION >= 0x040000
1410 // L.Garnier : MetaModifier is CTRL for MAC, but I don't want to put a MAC
1411 // specific #ifdef
1412 } else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_A)) {
1413 fCommandArea->home(false);
1414 return true;
1415 } else if (((e->modifiers () == Qt::ControlModifier) || (e->modifiers () == Qt::MetaModifier)) && (e->key() == Qt::Key_E)) {
1416 fCommandArea->end(false);
1417 return true;
1418#endif
1419 }
1420 }
1421 }
1422 bool res= false;
1423 // change cursor position if needed
1424 if (moveCommandCursor == true) {
1425#ifdef G4DEBUG_INTERFACES_BASIC
1426 printf("G4UIQt::eventFilter setCursor Position\n");
1427#endif
1428 fCommandArea->setCursorPosition ( fCommandArea->text().length() );
1429 fCommandArea->setCursorPosition (4);
1430 } else {
1431 // pass the event on to the parent class
1432 res = QObject::eventFilter(aObj, aEvent);
1433 }
1434 return res;
1435}
1436
1437
1438
1439
1440/***************************************************************************/
1441//
1442// SLOTS DEFINITIONS
1443//
1444/***************************************************************************/
1445
1446/** Called when user give "help" command.
1447*/
1448void G4UIQt::ShowHelpCallback (
1449)
1450{
1451 TerminalHelp("");
1452}
1453
1454
1455/** Called when user click on clear button. Clear the text Output area
1456*/
1457void G4UIQt::ClearButtonCallback (
1458)
1459{
1460 fCoutTBTextArea->clear();
1461 fG4cout.clear();
1462}
1463
1464/** Called when user exit session
1465*/
1466void G4UIQt::ExitSession (
1467)
1468{
1469 SessionTerminate();
1470}
1471
1472void G4UIQt::ExitHelp(
1473)
1474{
1475}
1476
1477/** Callback call when "click on a menu entry.<br>
1478 Send the associated command to geant4
1479*/
1480void G4UIQt::CommandEnteredCallback (
1481)
1482{
1483#if QT_VERSION < 0x040000
1484 G4String command (fCommandArea->text().ascii());
1485 if (fCommandArea->text().simplifyWhiteSpace() != "") {
1486
1487 QListViewItem *newItem = new QListViewItem(fHistoryTBTableList);
1488 newItem->setText(0,fCommandArea->text());
1489 fHistoryTBTableList->insertItem(newItem);
1490 // now we have to arrange
1491 QListViewItem *temp= fHistoryTBTableList->lastItem();
1492 for (int i=0; i<fHistoryTBTableList->childCount()-1;i++) {
1493 fHistoryTBTableList->takeItem(temp);
1494 fHistoryTBTableList->insertItem(temp);
1495 temp= fHistoryTBTableList->lastItem();
1496 }
1497#else
1498 G4String command (fCommandArea->text().toStdString().c_str());
1499 if (fCommandArea->text().trimmed() != "") {
1500 fHistoryTBTableList->addItem(fCommandArea->text());
1501#endif
1502 fHistoryTBTableList->clearSelection();
1503 fHistoryTBTableList->setCurrentItem(NULL);
1504 fCommandArea->setText("");
1505
1506 G4Qt* interactorManager = G4Qt::getInstance ();
1507 if (interactorManager) {
1508 interactorManager->FlushAndWaitExecution();
1509 }
1510 if (command(0,4) != "help") {
1511 ApplyShellCommand (command,exitSession,exitPause);
1512 } else {
1513 ActivateCommand(command);
1514 }
1515 // Rebuild help tree
1516 FillHelpTree();
1517
1518 if(exitSession==true)
1519 SessionTerminate();
1520 }
1521}
1522
1523
1524/** Callback call when "enter" clicked on the command zone.<br>
1525 Send the command to geant4
1526 @param aCommand
1527*/
1528void G4UIQt::ButtonCallback (
1529 const QString& aCommand
1530)
1531{
1532#if QT_VERSION < 0x040000
1533 G4String ss = G4String(aCommand.ascii());
1534#else
1535 G4String ss = G4String(aCommand.toStdString().c_str());
1536#endif
1537 ApplyShellCommand(ss,exitSession,exitPause);
1538
1539 // Rebuild help tree
1540 FillHelpTree();
1541
1542 if(exitSession==true)
1543 SessionTerminate();
1544}
1545
1546
1547
1548/** This callback is activated when user selected a item in the help tree
1549*/
1550void G4UIQt::HelpTreeClicCallback (
1551)
1552{
1553#if QT_VERSION < 0x040000
1554 QListViewItem* item = NULL;
1555#else
1556 QTreeWidgetItem* item = NULL;
1557#endif
1558 if (!fHelpTreeWidget)
1559 return ;
1560
1561 if (!fHelpArea)
1562 return;
1563
1564#if QT_VERSION < 0x040000
1565 item =fHelpTreeWidget->selectedItem();
1566#else
1567 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
1568 if (list.isEmpty())
1569 return;
1570 item = list.first();
1571#endif
1572 if (!item)
1573 return;
1574
1575 G4UImanager* UI = G4UImanager::GetUIpointer();
1576 if(UI==NULL) return;
1577 G4UIcommandTree * treeTop = UI->GetTree();
1578
1579 std::string itemText = GetLongCommandPath(item).toStdString();
1580
1581 G4UIcommand* command = treeTop->FindPath(itemText.c_str());
1582
1583 if (command) {
1584#if QT_VERSION >= 0x040000
1585#if QT_VERSION < 0x040200
1586 fHelpArea->clear();
1587 fHelpArea->append(GetCommandList(command));
1588#else
1589 fHelpArea->setText(GetCommandList(command));
1590#endif
1591#else
1592 fHelpArea->setText(GetCommandList(command));
1593#endif
1594 } else { // this is a command
1595 G4UIcommandTree* path = treeTop->FindCommandTree(itemText.c_str());
1596 if ( path) {
1597 // this is not a command, this is a sub directory
1598 // We display the Title
1599#if QT_VERSION >= 0x040000
1600#if QT_VERSION < 0x040200
1601 fHelpArea->clear();
1602 fHelpArea->append(path->GetTitle().data());
1603#else
1604 fHelpArea->setText(path->GetTitle().data());
1605#endif
1606#else
1607 fHelpArea->setText(path->GetTitle().data());
1608#endif
1609 }
1610 }
1611}
1612
1613/** This callback is activated when user double clic on a item in the help tree
1614*/
1615void G4UIQt::HelpTreeDoubleClicCallback (
1616)
1617{
1618 HelpTreeClicCallback();
1619
1620#if QT_VERSION < 0x040000
1621 QListViewItem* item = NULL;
1622#else
1623 QTreeWidgetItem* item = NULL;
1624#endif
1625 if (!fHelpTreeWidget)
1626 return ;
1627
1628 if (!fHelpArea)
1629 return;
1630
1631#if QT_VERSION < 0x040000
1632 item =fHelpTreeWidget->selectedItem();
1633#else
1634 QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
1635 if (list.isEmpty())
1636 return;
1637 item = list.first();
1638#endif
1639 if (!item)
1640 return;
1641
1642 fCommandArea->clear();
1643 fCommandArea->setText(GetLongCommandPath(item));
1644}
1645
1646
1647/** Callback called when user select an old command in the command history<br>
1648 Give it to the command area.
1649*/
1650void G4UIQt::CommandHistoryCallback(
1651)
1652{
1653#if QT_VERSION < 0x040000
1654 QListViewItem* item = NULL;
1655#else
1656 QListWidgetItem* item = NULL;
1657#endif
1658 if (!fHistoryTBTableList)
1659 return ;
1660
1661
1662#if QT_VERSION < 0x040000
1663 item =fHistoryTBTableList->selectedItem();
1664#else
1665 QList<QListWidgetItem *> list =fHistoryTBTableList->selectedItems();
1666 if (list.isEmpty())
1667 return;
1668 item = list.first();
1669#endif
1670 if (!item)
1671 return;
1672#if QT_VERSION < 0x040000
1673 fCommandArea->setText(item->text(0));
1674#else
1675 fCommandArea->setText(item->text());
1676#endif
1677#ifdef G4DEBUG_INTERFACES_BASIC
1678 printf("G4UIQt::CommandHistoryCallback change text\n");
1679#endif
1680}
1681
1682
1683void G4UIQt::CoutFilterCallback(
1684const QString & text) {
1685
1686#ifdef G4DEBUG_INTERFACES_BASIC
1687 printf("G4UIQt::CoutFilterCallback : %s\n",text.toStdString().c_str());
1688#endif
1689
1690 QStringList result = fG4cout.filter(text);
1691
1692 fCoutTBTextArea->setText(result.join("\n"));
1693 fCoutTBTextArea->repaint();
1694#if QT_VERSION < 0x040000
1695 fCoutTBTextArea->verticalScrollBar()->setValue(fCoutTBTextArea->verticalScrollBar()->maxValue());
1696#else
1697 fCoutTBTextArea->verticalScrollBar()->setSliderPosition(fCoutTBTextArea->verticalScrollBar()->maximum());
1698#endif
1699#ifdef G4DEBUG_INTERFACES_BASIC
1700 printf("G4UIQt::CoutFilterCallback textSize:%d resSize:%d \n",fG4cout.join("").size(),result.join("").size());
1701#endif
1702
1703 }
1704
1705/** Callback called when user give a new string to look for<br>
1706 Display a list of matching commands descriptions. If no string is set,
1707 will display the complete help tree
1708*/
1709void G4UIQt::LookForHelpStringCallback(
1710)
1711{
1712 QString searchText = fHelpLine->text();
1713
1714#if QT_VERSION < 0x040200
1715 fHelpArea->clear();
1716#else
1717 fHelpArea->setText("");
1718#endif
1719 if (searchText =="") {
1720 // clear old help tree
1721 fHelpTreeWidget->clear();
1722#if QT_VERSION < 0x040000
1723 fHelpTreeWidget->removeColumn(1);
1724 fHelpTreeWidget->removeColumn(0);
1725#endif
1726
1727 FillHelpTree();
1728
1729 return;
1730 } else {
1731 OpenHelpTreeOnCommand(searchText);
1732 }
1733}
1734
1735
1736void G4UIQt::OpenHelpTreeOnCommand(
1737 const QString & searchText
1738)
1739{
1740
1741 // the help tree
1742 G4UImanager* UI = G4UImanager::GetUIpointer();
1743 if(UI==NULL) return;
1744 G4UIcommandTree * treeTop = UI->GetTree();
1745
1746 G4int treeSize = treeTop->GetTreeEntry();
1747
1748 // clear old help tree
1749 fHelpTreeWidget->clear();
1750#if QT_VERSION < 0x040000
1751 fHelpTreeWidget->removeColumn(1);
1752 fHelpTreeWidget->removeColumn(0);
1753#endif
1754
1755 // look for new items
1756
1757 int tmp = 0;
1758#if QT_VERSION < 0x040000
1759 int multFactor = 1000; // factor special for having double keys in Qt3
1760 int doubleKeyAdd = 0; // decay for doubleKeys in Qt3
1761#endif
1762
1763 QMap<int,QString> commandResultMap;
1764 QMap<int,QString> commandChildResultMap;
1765
1766 for (int a=0;a<treeSize;a++) {
1767 G4UIcommand* command = treeTop->FindPath(treeTop->GetTree(a+1)->GetPathName().data());
1768#if QT_VERSION > 0x040000
1769 tmp = GetCommandList (command).count(searchText,Qt::CaseInsensitive);
1770#else
1771 tmp = GetCommandList (command).contains(searchText,false);
1772#endif
1773 if (tmp >0) {
1774#if QT_VERSION > 0x040000
1775 commandResultMap.insertMulti(tmp,QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()));
1776#else // tricky thing for Qt3...
1777 doubleKeyAdd = 0;
1778 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1779 doubleKeyAdd ++;
1780 }
1781 commandResultMap.insert( tmp*multFactor+doubleKeyAdd,QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()) );
1782#endif
1783 }
1784 // look for childs
1785 commandChildResultMap = LookForHelpStringInChildTree(treeTop->GetTree(a+1),searchText);
1786 // insert new childs
1787 if (!commandChildResultMap.empty()) {
1788#if QT_VERSION > 0x040000
1789 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
1790 while (i != commandChildResultMap.constEnd()) {
1791 commandResultMap.insertMulti(i.key(),i.value());
1792#else // tricky thing for Qt3...
1793 QMap<int,QString>::const_iterator i = commandChildResultMap.begin();
1794 while (i != commandChildResultMap.end()) {
1795 doubleKeyAdd = 0;
1796 while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1797 doubleKeyAdd ++;
1798 }
1799 commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data());
1800#endif
1801 i++;
1802 }
1803 commandChildResultMap.clear();
1804 }
1805 }
1806
1807 // build new help tree
1808#if QT_VERSION < 0x040000
1809 fHelpTreeWidget->setSelectionMode(QListView::Single);
1810 fHelpTreeWidget->setRootIsDecorated(true);
1811 fHelpTreeWidget->addColumn("Command");
1812 fHelpTreeWidget->addColumn("Match");
1813 // fHelpTreeWidget->header()->setResizeEnabled(FALSE,1);
1814#else
1815 fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
1816 fHelpTreeWidget->setColumnCount(2);
1817 QStringList labels;
1818 labels << QString("Command") << QString("Match");
1819 fHelpTreeWidget->setHeaderLabels(labels);
1820#endif
1821
1822 if (commandResultMap.empty()) {
1823#if QT_VERSION < 0x040200
1824 fHelpArea->clear();
1825 fHelpArea->append("No match found");
1826#else
1827 fHelpArea->setText("No match found");
1828#endif
1829 return;
1830 }
1831
1832#if QT_VERSION > 0x040000
1833 QMap<int,QString>::const_iterator i = commandResultMap.constEnd();
1834#else
1835 QMap<int,QString>::const_iterator i = commandResultMap.end();
1836#endif
1837 i--;
1838 // 10 maximum progress values
1839 float multValue = 10.0/(float)(i.key());
1840 QString progressChar = "|";
1841 QString progressStr = "|";
1842
1843#if QT_VERSION < 0x040000
1844 QListViewItem * newItem;
1845#else
1846 QTreeWidgetItem * newItem;
1847#endif
1848 bool end = false;
1849 while (!end) {
1850#if QT_VERSION > 0x040000
1851 if (i == commandResultMap.constBegin()) {
1852#else
1853 if (i == commandResultMap.begin()) {
1854#endif
1855 end = true;
1856 }
1857 for(int a=0;a<int(i.key()*multValue);a++) {
1858 progressStr += progressChar;
1859 }
1860#if QT_VERSION < 0x040000
1861 newItem = new QListViewItem(fHelpTreeWidget);
1862 newItem->setText(0,i.data().simplifyWhiteSpace());
1863#else
1864 newItem = new QTreeWidgetItem(fHelpTreeWidget);
1865 newItem->setText(0,i.value().trimmed());
1866#endif
1867 newItem->setText(1,progressStr);
1868
1869#if QT_VERSION >= 0x040200
1870 newItem->setForeground ( 1, QBrush(Qt::blue) );
1871#endif
1872 progressStr = "|";
1873 i--;
1874 }
1875 // FIXME : to be checked on Qt3
1876#if QT_VERSION < 0x040000
1877 fHelpTreeWidget->setColumnWidthMode (1,QListView::Maximum);
1878 fHelpTreeWidget->setSorting(1,false);
1879#else
1880 fHelpTreeWidget->resizeColumnToContents (0);
1881 fHelpTreeWidget->sortItems(1,Qt::DescendingOrder);
1882 // fHelpTreeWidget->setColumnWidth(1,10);//resizeColumnToContents (1);
1883#endif
1884}
1885
1886
1887
1888
1889QMap<int,QString> G4UIQt::LookForHelpStringInChildTree(
1890 G4UIcommandTree *aCommandTree
1891,const QString & text
1892 )
1893{
1894 QMap<int,QString> commandResultMap;
1895 if (aCommandTree == NULL) return commandResultMap;
1896
1897#if QT_VERSION < 0x040000
1898 int multFactor = 1000; // factor special for having double keys in Qt3
1899 int doubleKeyAdd = 0; // decay for doubleKeys in Qt3
1900#endif
1901
1902 // Get the Sub directories
1903 int tmp = 0;
1904 QMap<int,QString> commandChildResultMap;
1905
1906 for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
1907 const G4UIcommand* command = aCommandTree->GetGuidance();
1908#if QT_VERSION > 0x040000
1909 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
1910#else
1911 tmp = GetCommandList (command).contains(text,false);
1912#endif
1913 if (tmp >0) {
1914#if QT_VERSION > 0x040000
1915 commandResultMap.insertMulti(tmp,QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()));
1916#else // tricky thing for Qt3...
1917 doubleKeyAdd = 0;
1918 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1919 doubleKeyAdd ++;
1920 }
1921 commandResultMap.insert(tmp*multFactor+doubleKeyAdd,QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()));
1922#endif
1923 }
1924 // look for childs
1925 commandChildResultMap = LookForHelpStringInChildTree(aCommandTree->GetTree(a+1),text);
1926
1927 if (!commandChildResultMap.empty()) {
1928 // insert new childs
1929#if QT_VERSION > 0x040000
1930 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin();
1931 while (i != commandChildResultMap.constEnd()) {
1932 commandResultMap.insertMulti(i.key(),i.value());
1933#else // tricky thing for Qt3...
1934 QMap<int,QString>::const_iterator i = commandChildResultMap.begin();
1935 while (i != commandChildResultMap.end()) {
1936 doubleKeyAdd = 0;
1937 while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1938 doubleKeyAdd ++;
1939 }
1940 commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data());
1941#endif
1942 i++;
1943 }
1944 commandChildResultMap.clear();
1945 }
1946 }
1947 // Get the Commands
1948
1949 for (int a=0;a<aCommandTree->GetCommandEntry();a++) {
1950 const G4UIcommand* command = aCommandTree->GetCommand(a+1);
1951#if QT_VERSION > 0x040000
1952 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);
1953#else
1954 tmp = GetCommandList (command).contains(text,false);
1955#endif
1956 if (tmp >0) {
1957#if QT_VERSION > 0x040000
1958 commandResultMap.insertMulti(tmp,QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()));
1959#else // tricky thing for Qt3...
1960 doubleKeyAdd = 0;
1961 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) {
1962 doubleKeyAdd ++;
1963 }
1964 commandResultMap.insert(tmp*multFactor+doubleKeyAdd,QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()));
1965#endif
1966 }
1967
1968 }
1969 return commandResultMap;
1970}
1971
1972
1973QString G4UIQt::GetShortCommandPath(
1974QString commandPath
1975)
1976{
1977 if (commandPath.indexOf("/") == 0) {
1978 commandPath = commandPath.right(commandPath.size()-1);
1979 }
1980
1981 commandPath = commandPath.right(commandPath.size()-commandPath.lastIndexOf("/",-2)-1);
1982
1983 if (commandPath.lastIndexOf("/") == (commandPath.size()-1)) {
1984 commandPath = commandPath.left(commandPath.size()-1);
1985 }
1986
1987 return commandPath;
1988}
1989
1990
1991QString G4UIQt::GetLongCommandPath(
1992#if QT_VERSION < 0x040000
1993 QListViewItem* item
1994#else
1995 QTreeWidgetItem* item
1996#endif
1997)
1998{
1999 if (item == NULL) return "";
2000
2001 // rebuild path:
2002 QString itemText = "";
2003 itemText = item->text(0);
2004
2005 while (item->parent() != NULL) {
2006 itemText = item->parent()->text(0)+"/"+itemText;
2007 item = item->parent();
2008 }
2009 itemText = "/"+itemText;
2010
2011 return itemText;
2012}
2013
2014G4QTabWidget::G4QTabWidget(
2015QSplitter*& split
2016):QTabWidget(split)
2017 ,tabSelected(false)
2018 ,lastCreated(-1)
2019{
2020}
2021
2022G4QTabWidget::G4QTabWidget(
2023):QTabWidget()
2024 ,tabSelected(false)
2025 ,lastCreated(-1)
2026{
2027}
2028
2029
2030
2031void G4UIQt::TabCloseCallback(int a){
2032 QWidget* temp = fTabWidget->widget(a);
2033 fTabWidget->removeTab (a);
2034 delete temp;
2035
2036 if (fTabWidget->count() == 0) {
2037 fMyVSplitter->addWidget(fEmptyViewerTabLabel);
2038#if QT_VERSION < 0x040000
2039 fTabWidget->reparent(0,0,QPoint(0,0));
2040#else
2041 fTabWidget->setParent(0);
2042#endif
2043 }
2044}
2045
2046
2047void G4UIQt::ToolBoxActivated(int a){
2048
2049 if (fToolBox->widget(a) == fHelpTBWidget) {
2050 // Rebuild the help tree
2051 FillHelpTree();
2052 }
2053}
2054
2055void G4QTabWidget::paintEvent(
2056QPaintEvent * event
2057)
2058{
2059
2060 if (currentWidget()) {
2061#ifdef G4DEBUG_INTERFACES_BASIC
2062 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());
2063#endif
2064 if ( isTabSelected()) {
2065
2066#if QT_VERSION < 0x040000
2067 QApplication::sendPostedEvents () ;
2068#else
2069 QCoreApplication::sendPostedEvents () ;
2070#endif
2071
2072#ifdef G4DEBUG_INTERFACES_BASIC
2073 printf("G4QTabWidget::paintEvent OK\n");
2074#endif
2075#if QT_VERSION < 0x040000
2076 QString text = label (currentPageIndex());
2077#else
2078 QString text = tabText (currentIndex());
2079#endif
2080
2081 if (lastCreated == -1) {
2082 QString paramSelect = QString("/vis/viewer/select ")+text;
2083 G4UImanager* UI = G4UImanager::GetUIpointer();
2084 if(UI != NULL) {
2085 UI->ApplyCommand(paramSelect.toStdString().c_str());
2086 }
2087 } else {
2088 lastCreated = -1;
2089 }
2090 unselectTab();
2091 repaint();
2092 }
2093 }
2094}
2095
2096#endif
Note: See TracBrowser for help on using the repository browser.