Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# G4UIQt Class Reference

`#include <G4UIQt.hh>`

Inheritance diagram for G4UIQt:

[legend]
Collaboration diagram for G4UIQt:

[legend]
List of all members.

## Signals
void | myClicked (const QString &text)
## Public Member Functions
| G4UIQt (int, char **)
G4UIsession * | SessionStart ()
void | AddMenu (const char *, const char *)
void | AddButton (const char *, const char *, const char *)
| ~G4UIQt ()
void | Prompt (G4String)
void | SessionTerminate ()
void | PauseSessionStart (G4String)
G4int | ReceiveG4cout (G4String)
G4int | ReceiveG4cerr (G4String)
## Private Slots
void | clearButtonCallback ()
void | commandEnteredCallback ()
void | buttonCallback (const QString &)
void | helpTreeCallback ()
void | showHelpCallback ()
void | commandHistoryCallback ()
## Private Member Functions
void | SecondaryLoop (G4String)
void | TerminalHelp (G4String)
void | CreateChildTree (QTreeWidgetItem *, G4UIcommandTree *)
QString | GetCommandList (G4UIcommand *)
G4bool | GetHelpChoice (G4int &)
void | ExitHelp ()
bool | eventFilter (QObject *, QEvent *)
## Private Attributes
QMainWindow * | fMainWindow
QLabel * | fCommandLabel
QLineEdit * | fCommandArea
QTextEdit * | fTextArea
QTextEdit * | fHelpArea
QListWidget * | fCommandHistoryArea
QSignalMapper * | signalMapper
QTreeWidget * | fHelpTreeWidget
QDialog * | fHelpDialog

## Constructor & Destructor Documentation

G4UIQt::G4UIQt | ( | int | argc,
|  | char ** | argv
| ) |

| Build a Qt window with a menubar, output area and promt area
       +-----------------------+
       |exit menu|             |
       |                       |
       | +-------------------+ |
       | |                   | |
       | |  Output area      | |
       | |                   | |
       | +-------------------+ |
       |      | clear |        |
       | +-------------------+ |
       | |  promt history    | |
       | +-------------------+ |
       | +-------------------+ |
       | |> promt area       | |
       | +-------------------+ |
       +-----------------------+
Definition at line 87 of file G4UIQt.cc. References clearButtonCallback(), commandEnteredCallback(), commandHistoryCallback(), fCommandArea, fCommandHistoryArea, fCommandLabel, fMainWindow, fTextArea, G4Qt::getInstance(), and showHelpCallback().
    00091   :fHelpDialog(NULL)
    00092 {
    00093   G4Qt* interactorManager = G4Qt::getInstance ();
    00094   G4UImanager* UI = G4UImanager::GetUIpointer();
    00095   if(UI!=NULL) UI->SetSession(this);
    00096
    00097   fMainWindow = new QMainWindow();
    00098   fMainWindow->setWindowTitle( "G4UI Session" );
    00099   fMainWindow->resize(800,600);
    00100   fMainWindow->move(QPoint(200,100));
    00101
    00102   QSplitter *splitter = new QSplitter(Qt::Vertical);
    00103   fTextArea = new QTextEdit();
    00104   QPushButton *clearButton = new QPushButton("clear");
    00105   connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonCallback()));
    00106
    00107   fCommandHistoryArea = new QListWidget();
    00108   fCommandHistoryArea->setSelectionMode(QAbstractItemView::SingleSelection);
    00109   connect(fCommandHistoryArea, SIGNAL(itemSelectionChanged()), SLOT(commandHistoryCallback()));
    00110   fCommandHistoryArea->installEventFilter(this);
    00111   fCommandLabel = new QLabel();
    00112
    00113   fCommandArea = new QLineEdit();
    00114   fCommandArea->installEventFilter(this);
    00115   fCommandArea->activateWindow();
    00116   connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback()));
    00117   //  fCommandArea->setFocusPolicy ( Qt::StrongFocus );
    00118   //  fCommandArea->setFocus(Qt::TabFocusReason);
    00119   fTextArea->setReadOnly(true);
    00120
    00121
    00122   // Set layouts
    00123
    00124   QWidget* topWidget = new QWidget();
    00125   QVBoxLayout *layoutTop = new QVBoxLayout;
    00126
    00127   QWidget* bottomWidget = new QWidget();
    00128   QVBoxLayout *layoutBottom = new QVBoxLayout;
    00129
    00130
    00131   layoutTop->addWidget(fTextArea);
    00132   layoutTop->addWidget(clearButton);
    00133   topWidget->setLayout(layoutTop);
    00134
    00135   layoutBottom->addWidget(fCommandHistoryArea);
    00136   layoutBottom->addWidget(fCommandLabel);
    00137   layoutBottom->addWidget(fCommandArea);
    00138   bottomWidget->setLayout(layoutBottom);
    00139
    00140
    00141   splitter->addWidget(topWidget);
    00142   splitter->addWidget(bottomWidget);
    00143   fMainWindow->setCentralWidget(splitter);
    00144
    00145   // Add a quit subMenu
    00146   QMenu *fileMenu = fMainWindow->menuBar()->addMenu("File");
    00147   fileMenu->addAction("Quitter", fMainWindow, SLOT(close()));
    00148
    00149   // Add a Help menu
    00150   QMenu *helpMenu = fMainWindow->menuBar()->addMenu("Help");
    00151   helpMenu->addAction("Show Help", this, SLOT(showHelpCallback()));
    00152
    00153   // Set the splitter size. The fTextArea sould be 2/3 on the fMainWindow
    00154   QList<int> vals = splitter->sizes();
    00155   if(vals.size()==2) {
    00156     vals[0] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*3/4;
    00157     vals[1] = (splitter->orientation()==Qt::Vertical ? splitter->height() : splitter->width())*1/4;
    00158     splitter->setSizes(vals);
    00159   }
    00160
    00161
    00162   if(UI!=NULL) UI->SetCoutDestination(this);  // TO KEEP
    00163 }

Here is the call graph for this function:

G4UIQt::~G4UIQt | ( |  | ) |

| Definition at line 167 of file G4UIQt.cc. References fMainWindow.
    00169 {
    00170   G4UImanager* UI = G4UImanager::GetUIpointer();  // TO KEEP
    00171   if(UI!=NULL) {  // TO KEEP
    00172     UI->SetSession(NULL);  // TO KEEP
    00173     UI->SetCoutDestination(NULL);  // TO KEEP
    00174   }
    00175
    00176
    00177   if (fMainWindow!=NULL)
    00178     delete fMainWindow;
    00179 }

## Member Function Documentation

void G4UIQt::AddButton | ( | const char * | aMenu,
|  | const char * | aLabel,
|  | const char * | aCommand
| ) | `[virtual]`

  | Add a new button to a menu Parameters:
  aMenu | : parent menu
  aLabel | : label to display
  aCommand | : command to execute as a callback
Reimplemented from G4VInteractiveSession. Definition at line 340 of file G4UIQt.cc. References buttonCallback(), G4VInteractiveSession::GetInteractor(), and signalMapper.
    00345 {
    00346   if(aMenu==NULL) return; // TO KEEP
    00347   if(aLabel==NULL) return; // TO KEEP
    00348   if(aCommand==NULL) return; // TO KEEP
    00349   QMenu *parent = (QMenu*)GetInteractor(aMenu);
    00350   if(parent==NULL) return;
    00351
    00352   signalMapper = new QSignalMapper(this);
    00353   QAction *action = parent->addAction(aLabel, signalMapper, SLOT(map()));
    00354   signalMapper->setMapping(action, QString(aCommand));
    00355   connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(buttonCallback(const QString&)));
    00356 }

Here is the call graph for this function:

void G4UIQt::AddMenu | ( | const char * | aName,
|  | const char * | aLabel
| ) | `[virtual]`

  | Add a new menu to the menu bar Parameters:
  aName | name of menu
  aLabel | label to display
Reimplemented from G4VInteractiveSession. Definition at line 323 of file G4UIQt.cc. References G4VInteractiveSession::AddInteractor(), fMainWindow, and G4Interactor.
    00327 {
    00328   QMenu *fileMenu = new QMenu(aLabel);
    00329   fMainWindow->menuBar()->insertMenu(fMainWindow->menuBar()->actions().last(),fileMenu);
    00330   AddInteractor (aName,(G4Interactor)fileMenu);
    00331 }

Here is the call graph for this function:

void G4UIQt::buttonCallback | ( | const QString & | aCommand | ) | `[private, slot]`

  | Callback call when "enter" clicked on the command zone. Send the command to geant4 Parameters:
  aCommand |
Definition at line 715 of file G4UIQt.cc. References G4VBasicShell::ApplyShellCommand(), exitPause, exitSession, and SessionTerminate(). Referenced by AddButton().
    00718 {
    00719   G4String ss = G4String(aCommand.toStdString().c_str());
    00720   printf ("debug : execute:\n-%s- %d %d \n",ss.data(),exitSession,exitPause);
    00721   ApplyShellCommand(ss,exitSession,exitPause);
    00722   if(exitSession==true)
    00723     SessionTerminate();
    00724 }

void G4UIQt::clearButtonCallback | ( |  | ) | `[private, slot]`

| Called when user click on clear button. Clear the text Output area Definition at line 677 of file G4UIQt.cc. References fTextArea. Referenced by G4UIQt().
    00679 {
    00680   fTextArea->clear();
    00681 }

void G4UIQt::commandEnteredCallback | ( |  | ) | `[private, slot]`

| Callback call when "click on a menu entry. Send the associated command to geant4 Definition at line 688 of file G4UIQt.cc. References G4VBasicShell::ApplyShellCommand(), exitPause, exitSession, fCommandArea, fCommandHistoryArea, SessionTerminate(), and TerminalHelp(). Referenced by G4UIQt().
    00690 {
    00691   G4String command (fCommandArea->text().toStdString().c_str());
    00692   if (fCommandArea->text().trimmed() != "") {
    00693     fCommandHistoryArea->addItem(fCommandArea->text());
    00694     fCommandHistoryArea->clearSelection();
    00695     fCommandHistoryArea->item(fCommandHistoryArea->count()-1)->setSelected(true);
    00696     fCommandHistoryArea->setCurrentItem(fCommandHistoryArea->item(fCommandHistoryArea->count()-1));
    00697
    00698     if (command(0,4) != "help") {
    00699       ApplyShellCommand (command,exitSession,exitPause);
    00700     } else {
    00701       TerminalHelp(command);
    00702     }
    00703     if(exitSession==true)
    00704       SessionTerminate();
    00705   }
    00706   fCommandArea->setText("");
    00707 }

void G4UIQt::commandHistoryCallback | ( |  | ) | `[private, slot]`

| Callback called when user select an old command in the command history Give it to the command area. Definition at line 767 of file G4UIQt.cc. References fCommandArea, and fCommandHistoryArea. Referenced by G4UIQt().
    00769 {
    00770   QListWidgetItem* item =  NULL;
    00771   if (!fCommandHistoryArea)
    00772     return ;
    00773
    00774
    00775   QList<QListWidgetItem *> list =fCommandHistoryArea->selectedItems();
    00776   if (list.isEmpty())
    00777     return;
    00778   item = list.first();
    00779   if (!item)
    00780     return;
    00781   fCommandArea->setText(item->text());
    00782
    00783 }

void G4UIQt::CreateChildTree | ( | QTreeWidgetItem * | aParent,
|  | G4UIcommandTree * | aCommandTree
| ) | `[private]`

  | Fill the Help Tree Widget Parameters:
  aParent | : parent item to fill
  aCommandTree | : commandTree node associate with this part of the Tree
Definition at line 480 of file G4UIQt.cc. Referenced by TerminalHelp().
    00484 {
    00485
    00486   // Creating new item
    00487   QTreeWidgetItem * newItem;
    00488
    00489
    00490   // Get the Sub directories
    00491   for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
    00492
    00493     QStringList stringList;
    00494     stringList << QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).trimmed()  ;
    00495     stringList << QString((char*)(aCommandTree->GetTree(a+1)->GetTitle()).data()).trimmed()  ;
    00496     newItem = new QTreeWidgetItem(stringList);
    00497
    00498     CreateChildTree(newItem,aCommandTree->GetTree(a+1));
    00499     aParent->addChild(newItem);
    00500   }
    00501
    00502
    00503
    00504   // Get the Commands
    00505
    00506   for (int a=0;a<aCommandTree->GetCommandEntry();a++) {
    00507
    00508     QStringList stringList;
    00509     stringList << QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed()  ;
    00510     stringList << QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed()  ;
    00511     newItem = new QTreeWidgetItem(stringList);
    00512
    00513     aParent->addChild(newItem);
    00514     newItem->setExpanded(false);
    00515   }
    00516 }

bool G4UIQt::eventFilter | ( | QObject * | obj,
|  | QEvent * | event
| ) | `[private]`

  | Event filter method. Every event from QtApplication goes here.<br/> We apply a filter only for the Up and Down Arrow press when the QLineEdit<br/> is active. If this filter match, Up arrow we give the previous command<br/> and Down arrow will give the next if exist.<br/> Parameters:
  obj | Emitter of the event
  event | Kind of event
Definition at line 608 of file G4UIQt.cc. References fCommandArea, and fCommandHistoryArea.
    00612 {
    00613   if (obj == fCommandHistoryArea) {
    00614     if (event->type() == QEvent::KeyPress) {
    00615       fCommandArea->setFocus();
    00616     }
    00617   }
    00618   if (obj == fCommandArea) {
    00619     if (event->type() == QEvent::KeyPress) {
    00620       QKeyEvent *e = static_cast<QKeyEvent*>(event);
    00621       if ((e->key() == (Qt::Key_Down)) ||
    00622           (e->key() == (Qt::Key_PageDown)) ||
    00623           (e->key() == (Qt::Key_Up)) ||
    00624           (e->key() == (Qt::Key_PageUp))) {
    00625         int selection = fCommandHistoryArea->currentRow();
    00626         for (int a=0;a<fCommandHistoryArea->count();a++) {
    00627
    00628         }
    00629         if (fCommandHistoryArea->count()) {
    00630           if (selection == -1) {
    00631             selection = fCommandHistoryArea->count()-1;
    00632           }
    00633           if (e->key() == (Qt::Key_Down)) {
    00634             if (selection <(fCommandHistoryArea->count()-1))
    00635               selection++;
    00636           } else if (e->key() == (Qt::Key_PageDown)) {
    00637             selection = fCommandHistoryArea->count()-1;
    00638           } else if (e->key() == (Qt::Key_Up)) {
    00639             if (selection >0)
    00640               selection --;
    00641           } else if (e->key() == (Qt::Key_PageUp)) {
    00642             selection = 0;
    00643           }
    00644           fCommandHistoryArea->clearSelection();
    00645           fCommandHistoryArea->item(selection)->setSelected(true);
    00646           fCommandHistoryArea->setCurrentItem(fCommandHistoryArea->item(selection));
    00647         }
    00648       }
    00649     }
    00650   }
    00651   // pass the event on to the parent class
    00652   return QObject::eventFilter(obj, event);
    00653 }

void G4UIQt::ExitHelp | ( |  | ) | `[private, virtual]`

| Implement G4VBasicShell vurtual function Implements G4VBasicShell. Definition at line 593 of file G4UIQt.cc.
    00595 {
    00596   printf("G4UIQt::ExitHelp SHOULD NEVER GO HERE");
    00597 }

QString G4UIQt::GetCommandList | ( | G4UIcommand * | aCommand | ) | `[private]`

  | Build the command list parameters in a QString Reimplement partialy the G4UIparameter.cc Parameters:
  aCommand | : command to list parameters
See also: G4UIparameter::List() Returns: the command list parameters Definition at line 526 of file G4UIQt.cc. Referenced by helpTreeCallback().
    00529 {
    00530
    00531   QString txt;
    00532   G4String commandPath = aCommand->GetCommandPath();
    00533   G4String rangeString = aCommand->GetRange();
    00534
    00535   if((commandPath.length()-1)!='/')
    00536     {
    00537       txt += "Command " + QString((char*)(commandPath).data()) + "\n";
    00538     }
    00539   txt += "Guidance :\n";
    00540   G4int n_guidanceEntry = aCommand->GetGuidanceEntries();
    00541
    00542   for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ )
    00543     { txt += QString((char*)(aCommand->GetGuidanceLine(i_thGuidance)).data()) + "\n"; }
    00544   if( ! rangeString.isNull() )
    00545     { txt += " Range of parameters : " + QString((char*)(rangeString).data()) + "\n"; }
    00546   G4int n_parameterEntry = aCommand->GetParameterEntries();
    00547   if( n_parameterEntry > 0 )
    00548     {
    00549       G4UIparameter *param;
    00550
    00551       // Re-implementation of G4UIparameter.cc
    00552
    00553       for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ )
    00554         { param = aCommand->GetParameter(i_thParameter);
    00555           txt += "\nParameter : " + QString((char*)(param->GetParameterName()).data()) + "\n";
    00556           if( ! param->GetParameterGuidance().isNull() )
    00557             txt += QString((char*)(param->GetParameterGuidance()).data())+ "\n" ;
    00558           txt += " Parameter type  : " + QString(param->GetParameterType())+ "\n";
    00559           if(param->IsOmittable())
    00560             { txt += " Omittable       : True\n"; }
    00561           else
    00562             { txt += " Omittable       : False\n"; }
    00563           if( param->GetCurrentAsDefault() )
    00564             { txt += " Default value   : taken from the current value\n"; }
    00565           else if( ! param->GetDefaultValue().isNull() )
    00566             { txt += " Default value   : " + QString((char*)(param->GetDefaultValue()).data())+ "\n"; }
    00567           if( ! param->GetParameterRange().isNull() )
    00568             txt += " Parameter range : " + QString((char*)(param->GetParameterRange()).data())+ "\n";
    00569           if( ! param->GetParameterCandidates().isNull() )
    00570             txt += " Candidates      : " + QString((char*)(param->GetParameterCandidates()).data())+ "\n";
    00571         }
    00572     }
    00573   return txt;
    00574 }

G4bool G4UIQt::GetHelpChoice | ( | G4int & | aInt | ) | `[private, virtual]`

| Implement G4VBasicShell vurtual function Implements G4VBasicShell. Definition at line 581 of file G4UIQt.cc.
    00584 {
    00585   printf("G4UIQt::GetHelpChoice SHOULD NEVER GO HERE");
    00586   return true;
    00587 }

void G4UIQt::helpTreeCallback | ( |  | ) | `[private, slot]`

| This callback is activated when user selected a item in the help tree Definition at line 731 of file G4UIQt.cc. References fHelpArea, fHelpTreeWidget, and GetCommandList(). Referenced by TerminalHelp().
    00733 {
    00734   //  G4bool GetHelpChoice(G4int&);
    00735   QTreeWidgetItem* item =  NULL;
    00736   if (!fHelpTreeWidget)
    00737     return ;
    00738
    00739   if (!fHelpArea)
    00740     return;
    00741
    00742   QList<QTreeWidgetItem *> list =fHelpTreeWidget->selectedItems();
    00743   if (list.isEmpty())
    00744     return;
    00745   item = list.first();
    00746   if (!item)
    00747     return;
    00748
    00749   G4UImanager* UI = G4UImanager::GetUIpointer();
    00750   if(UI==NULL) return;
    00751   G4UIcommandTree * treeTop = UI->GetTree();
    00752   G4UIcommand* command = treeTop->FindPath(item->text (1).toStdString().c_str());
    00753   if (command) {
    00754     fHelpArea->setText(GetCommandList(command));
    00755   } else {
    00756     // this is not a command, this is a sub directory
    00757     // We display the Title
    00758     fHelpArea->setText(item->text (1).toStdString().c_str());
    00759   }
    00760 }

void G4UIQt::myClicked | ( | const QString & | text | ) | `[signal]`

| Definition at line 93 of file G4UIQt_moc.cc.
    00094 {
    00095     void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
    00096     QMetaObject::activate(this, &staticMetaObject, 0, _a);
    00097 }

void G4UIQt::PauseSessionStart | ( | G4String | aState | ) | `[virtual]`

  | Called by intercoms/src/G4UImanager.cc Called by visualization/management/src/G4VisCommands.cc with "EndOfEvent" argument It have to pause the session command terminal. Call SecondaryLoop to wait for exit event Parameters:
  aState |
See also: : G4VisCommandReviewKeptEvents::SetNewValue Implements G4VBasicShell. Definition at line 247 of file G4UIQt.cc. References SecondaryLoop().
    00250 {
    00251   printf("G4UIQt::PauseSessionStart\n");
    00252   if(aState=="G4_pause> ") {  // TO KEEP
    00253     SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
    00254   } // TO KEEP
    00255
    00256   if(aState=="EndOfEvent") { // TO KEEP
    00257     // Picking with feed back in event data Done here !!!
    00258     SecondaryLoop ("End of event, type continue to exit this state"); // TO KEEP
    00259   } // TO KEEP
    00260 }

Here is the call graph for this function:

void G4UIQt::Prompt | ( | G4String | aPrompt | ) |

  | Display the prompt in the prompt area Parameters:
  aPrompt | : string to display as the promt label FIXME : probablement inutile puisque le seul a afficher qq chose d'autre que "session" est SecondaryLoop()
Definition at line 221 of file G4UIQt.cc. References fCommandLabel. Referenced by SecondaryLoop(), and SessionStart().
    00224 {
    00225   fCommandLabel->setText((char*)aPrompt.data());
    00226 }

G4int G4UIQt::ReceiveG4cerr | ( | G4String | aString | ) |

  | Receive a cerr from Geant4. We have to display it in the cout zone Parameters:
  aString | : label to add in the display area
Definition at line 304 of file G4UIQt.cc. References fTextArea.
    00307 {
    00308   QColor previousColor = fTextArea->textColor();
    00309   fTextArea->setTextColor(Qt::red);
    00310   fTextArea->append(QString((char*)aString.data()).trimmed());
    00311   fTextArea->setTextColor(previousColor);
    00312   fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
    00313   return 0;
    00314 }

G4int G4UIQt::ReceiveG4cout | ( | G4String | aString | ) |

  | Receive a cout from Geant4. We have to display it in the cout zone Parameters:
  aString | : label to add in the display area
Definition at line 290 of file G4UIQt.cc. References fTextArea.
    00293 {
    00294   fTextArea->append(QString((char*)aString.data()).trimmed());
    00295   fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
    00296   return 0;
    00297 }

void G4UIQt::SecondaryLoop | ( | G4String | aPrompt | ) | `[private]`

  | Begin the secondary loop Parameters:
  a_prompt | : label to display as the prompt label
Definition at line 268 of file G4UIQt.cc. References G4VInteractorManager::DispatchEvent(), exitPause, G4Qt::GetEvent(), G4Qt::getInstance(), and Prompt(). Referenced by PauseSessionStart().
    00271 {
    00272   printf("G4UIQt::SecondaryLoop\n");
    00273   G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
    00274   Prompt(aPrompt); // TO KEEP
    00275   exitPause = false; // TO KEEP
    00276   void* event; // TO KEEP
    00277   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
    00278     interactorManager->DispatchEvent(event); // TO KEEP
    00279     if(exitPause==true) break; // TO KEEP
    00280   } // TO KEEP
    00281   Prompt("session"); // TO KEEP
    00282 }

Here is the call graph for this function:

G4UIsession * G4UIQt::SessionStart | ( |  | ) | `[virtual]`

| Start the Qt main loop Implements G4VBasicShell. Definition at line 187 of file G4UIQt.cc. References G4VInteractorManager::DisableSecondaryLoop(), G4VInteractorManager::EnableSecondaryLoop(), exitSession, fMainWindow, G4Qt::getInstance(), G4VInteractorManager::GetMainInteractor(), and Prompt().
    00189 {
    00190
    00191   G4Qt* interactorManager = G4Qt::getInstance ();
    00192   fMainWindow->show();
    00193   Prompt("session");
    00194   exitSession = false;
    00195
    00196
    00197   printf("disable secondary loop\n");
    00198   interactorManager->DisableSecondaryLoop (); // TO KEEP
    00199   ((QApplication*)interactorManager->GetMainInteractor())->exec();
    00200   // on ne passe pas le dessous ? FIXME ????
    00201   // je ne pense pas 13/06
    00202
    00203   //   void* event; // TO KEEP
    00204   //   while((event = interactorManager->GetEvent())!=NULL) {  // TO KEEP
    00205   //     interactorManager->DispatchEvent(event); // TO KEEP
    00206   //     if(exitSession==true) break; // TO KEEP
    00207   //   } // TO KEEP
    00208
    00209   interactorManager->EnableSecondaryLoop ();
    00210   printf("enable secondary loop\n");
    00211   return this;
    00212 }

Here is the call graph for this function:

void G4UIQt::SessionTerminate | ( |  | ) |

| Definition at line 229 of file G4UIQt.cc. References fMainWindow, G4Qt::getInstance(), and G4VInteractorManager::GetMainInteractor(). Referenced by buttonCallback(), and commandEnteredCallback().
    00231 {
    00232   G4Qt* interactorManager = G4Qt::getInstance ();
    00233   fMainWindow->close();
    00234   ((QApplication*)interactorManager->GetMainInteractor())->exit();
    00235 }

Here is the call graph for this function:

void G4UIQt::showHelpCallback | ( |  | ) | `[private, slot]`

| Called when user give "help" command. Definition at line 667 of file G4UIQt.cc. References TerminalHelp(). Referenced by G4UIQt().
    00669 {
    00670   TerminalHelp("");
    00671 }

void G4UIQt::TerminalHelp | ( | G4String | newCommand | ) | `[private]`

  | Open the help dialog in a separate window. This will be display as a tree widget. Implementation of void G4VBasicShell::TerminalHelp(G4String newCommand) Parameters:
  newCommand | : open the tree widget item on this command if is set
Reimplemented from G4VBasicShell. Definition at line 368 of file G4UIQt.cc. References CreateChildTree(), fHelpArea, fHelpDialog, fHelpTreeWidget, helpTreeCallback(), and G4VBasicShell::ModifyToFullPathCommand(). Referenced by commandEnteredCallback(), and showHelpCallback().
    00371 {
    00372   if (!fHelpDialog) {
    00373     fHelpDialog = new QDialog;
    00374
    00375     QSplitter *splitter = new QSplitter(Qt::Horizontal);
    00376     fHelpArea = new QTextEdit();
    00377     QPushButton *exitButton = new QPushButton("Exit");
    00378     connect(exitButton, SIGNAL(clicked()), fHelpDialog,SLOT(close()));
    00379     fHelpArea->setReadOnly(true);
    00380
    00381     // the help tree
    00382     G4UImanager* UI = G4UImanager::GetUIpointer();
    00383     if(UI==NULL) return;
    00384     G4UIcommandTree * treeTop = UI->GetTree();
    00385
    00386     // build widget
    00387     fHelpTreeWidget = new QTreeWidget();
    00388     fHelpTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
    00389     fHelpTreeWidget->setColumnCount(2);
    00390     fHelpTreeWidget->setColumnHidden(1,true);
    00391     QStringList labels;
    00392     labels << QString("Command") << QString("Description");
    00393     fHelpTreeWidget->setHeaderLabels(labels);
    00394
    00395     QList<QTreeWidgetItem *> items;
    00396     G4int treeSize = treeTop->GetTreeEntry();
    00397     QTreeWidgetItem * newItem;
    00398     for (int a=0;a<treeSize;a++) {
    00399       // Creating new item
    00400       QStringList stringList;
    00401       stringList << QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).trimmed()  ;
    00402       stringList << QString((char*)(treeTop->GetTree(a+1)->GetTitle()).data()).trimmed()  ;
    00403
    00404       newItem = new QTreeWidgetItem(stringList);
    00405
    00406       // look for childs
    00407       CreateChildTree(newItem,treeTop->GetTree(a+1));
    00408       items.append(newItem);
    00409     }
    00410     fHelpTreeWidget->insertTopLevelItems(0, items);
    00411
    00412     //connecting callback
    00413     //  QSignalMapper signalMapper = new QSignalMapper(this);
    00414
    00415     connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),this, SLOT(helpTreeCallback()));
    00416
    00417     // Set layouts
    00418
    00419     QVBoxLayout *vLayout = new QVBoxLayout;
    00420
    00421     splitter->addWidget(fHelpTreeWidget);
    00422     splitter->addWidget(fHelpArea);
    00423
    00424     vLayout->addWidget(splitter);
    00425     vLayout->addWidget(exitButton);
    00426     fHelpDialog->setLayout(vLayout);
    00427
    00428   }
    00429
    00430   // Look for the choosen command "newCommand"
    00431   size_t i = newCommand.index(" ");
    00432   G4String targetCom="";
    00433   if( i != std::string::npos )
    00434     {
    00435       G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
    00436       newValue.strip(G4String::both);
    00437       targetCom = ModifyToFullPathCommand( newValue );
    00438       printf("test : av:%s-- ap:%s--\n",((char*)newValue.data()),((char*)targetCom.data()));
    00439     }
    00440   if (targetCom != "") {
    00441     QList<QTreeWidgetItem *> list = fHelpTreeWidget->findItems(QString(((char*)targetCom.data())),Qt::MatchFixedString,0);
    00442     for (int a=0;a<13;a++) {
    00443       printf("verif.... =%s= +%s+\n",fHelpTreeWidget->topLevelItem(a)->text(0).toStdString().c_str(),((char*)targetCom.data()));
    00444     }
    00445
    00446     if (!list.isEmpty()) {
    00447       if (list.first()->childCount() >0)
    00448         list.first()->setExpanded(true);
    00449
    00450       //collapsed open item
    00451       QList<QTreeWidgetItem *> selected;
    00452       selected = fHelpTreeWidget->selectedItems();
    00453       if ( selected.count() != 0 ) {
    00454         fHelpTreeWidget->collapseItem (selected.at( 0 ) );
    00455       }
    00456
    00457       // clear old selection
    00458       fHelpTreeWidget->clearSelection();
    00459       list.first()->setSelected(true);
    00460
    00461       // Call the update of the right textArea
    00462       helpTreeCallback();
    00463     }
    00464   }
    00465   fHelpDialog->setWindowTitle("Help on commands");
    00466   fHelpDialog->resize(800,600);
    00467   fHelpDialog->move(QPoint(400,150));
    00468   fHelpDialog->show();
    00469   fHelpDialog->raise();
    00470   fHelpDialog->activateWindow();
    00471 }

Here is the call graph for this function:

## Member Data Documentation

QLineEdit* G4UIQt::fCommandArea`[private]`

| Definition at line 118 of file G4UIQt.hh. Referenced by commandEnteredCallback(), commandHistoryCallback(), eventFilter(), and G4UIQt().

QListWidget* G4UIQt::fCommandHistoryArea`[private]`

| Definition at line 121 of file G4UIQt.hh. Referenced by commandEnteredCallback(), commandHistoryCallback(), eventFilter(), and G4UIQt().

QLabel* G4UIQt::fCommandLabel`[private]`

| Definition at line 117 of file G4UIQt.hh. Referenced by G4UIQt(), and Prompt().

QTextEdit* G4UIQt::fHelpArea`[private]`

| Definition at line 120 of file G4UIQt.hh. Referenced by helpTreeCallback(), and TerminalHelp().

QDialog* G4UIQt::fHelpDialog`[private]`

| Definition at line 124 of file G4UIQt.hh. Referenced by TerminalHelp().

QTreeWidget* G4UIQt::fHelpTreeWidget`[private]`

| Definition at line 123 of file G4UIQt.hh. Referenced by helpTreeCallback(), and TerminalHelp().

QMainWindow* G4UIQt::fMainWindow`[private]`

| Definition at line 116 of file G4UIQt.hh. Referenced by AddMenu(), G4UIQt(), SessionStart(), SessionTerminate(), and ~G4UIQt().

QTextEdit* G4UIQt::fTextArea`[private]`

| Definition at line 119 of file G4UIQt.hh. Referenced by clearButtonCallback(), G4UIQt(), ReceiveG4cerr(), and ReceiveG4cout().

QSignalMapper* G4UIQt::signalMapper`[private]`

| Definition at line 122 of file G4UIQt.hh. Referenced by AddButton().

The documentation for this class was generated from the following files:

- G4UIQt.hh
- G4UIQt.cc
- G4UIQt_moc.cc