Changeset 494 for trunk/geant4


Ignore:
Timestamp:
Jun 8, 2007, 4:43:45 PM (17 years ago)
Author:
garnier
Message:

r587@mac-90108: laurentgarnier | 2007-06-07 17:22:03 +0200
on avance

Location:
trunk/geant4/interfaces/basic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/interfaces/basic/GNUmakefile

    r493 r494  
    33# GNUmakefile for interfaces/basic library.  John Allison, 6/7/98.
    44
    5 ifdef G4UI_USE_QT
     5#ifdef G4UI_USE_QT
    66# This is not  good solution, we have to 'make' twice, but it works...
    7 moc :
    8         @$(MOC) -DG4UI_USE_QT include/G4UIQt.hh -o src/G4UIQt_moc.cc
    9 endif
     7#moc :
     8#       @$(MOC) -DG4UI_USE_QT include/G4UIQt.hh -o src/G4UIQt_moc.cc
     9#endif
    1010
    1111name := G4UIbasic
  • trunk/geant4/interfaces/basic/include/G4UIQt.hh

    r491 r494  
    4141#include <QtGui/qlineedit.h>
    4242#include <QtGui/qtextedit.h>
     43#include <QtGui/qlabel.h>
    4344#include <QObject>
    4445
     
    104105  G4bool fHelp;
    105106  G4int fHelpChoice;
    106   QMainWindow * mainWindow;
    107   QLineEdit * promptArea;
    108   QTextEdit *textArea;
     107  QMainWindow * fMainWindow;
     108  QLabel *fCommandLabel;
     109  QLineEdit * fCommandArea;
     110  QTextEdit *fTextArea;
     111  QTextEdit *fCommandHistoryArea;
    109112
    110113private slots :
    111114  void clearButtonCallback();
     115  void commandEnteredCallback();
    112116};
    113117
  • trunk/geant4/interfaces/basic/src/G4UIQt.cc

    r491 r494  
    7777      |     | clear |         |
    7878      | +-------------------+ |
     79      | |  promt history    | |
     80      | +-------------------+ |
     81      | +-------------------+ |
    7982      | |> promt area       | |
    8083      | +-------------------+ |
     
    9497  G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt");  // TO KEEP ?
    9598
    96   mainWindow = new QMainWindow();
    97   mainWindow->setWindowTitle( "G4UI Session" );
    98   mainWindow->setBaseSize(300,200);
     99  fMainWindow = new QMainWindow();
     100  fMainWindow->setWindowTitle( "G4UI Session" );
     101  fMainWindow->setBaseSize(300,200);
    99102  QWidget* centralWidget = new QWidget();
    100103  QVBoxLayout* vBox = new QVBoxLayout();
    101   textArea = new QTextEdit();
    102   QLabel *sessionLabel = new QLabel("Session : ");
     104  fTextArea = new QTextEdit();
     105  fCommandHistoryArea = new QTextEdit();
     106  fCommandLabel = new QLabel();
     107
    103108  QPushButton *clearButton = new QPushButton("clear");
    104109  connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonCallback()));
    105110
     111  fTextArea->setReadOnly(true);
     112  fCommandHistoryArea->setReadOnly(true);
     113
    106114//  QMenu *menuFile = new QMenu("File");
    107 //  mainWindow->menuBar()->addMenu(menuFile);
    108 
    109   promptArea = new QLineEdit();
    110   textArea->setReadOnly(FALSE);
    111   vBox->addWidget(textArea);
     115//  fMainWindow->menuBar()->addMenu(menuFile);
     116
     117  fCommandArea = new QLineEdit();
     118  connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback()));
     119
     120  vBox->addWidget(fTextArea);
    112121  vBox->addWidget(clearButton);
    113   vBox->addWidget(sessionLabel);
    114   vBox->addWidget(promptArea);
     122  vBox->addWidget(fCommandHistoryArea);
     123  vBox->addWidget(fCommandLabel);
     124  vBox->addWidget(fCommandArea);
    115125  centralWidget->setLayout(vBox);
    116   mainWindow->setCentralWidget(centralWidget);
     126  fMainWindow->setCentralWidget(centralWidget);
    117127
    118128//  QMainWindow top = (QMainWindow)interactorManager->GetMainInteractor();
     
    202212
    203213 
    204   if (mainWindow!=NULL)
    205     delete mainWindow;
     214  if (fMainWindow!=NULL)
     215    delete fMainWindow;
    206216}
    207217/***************************************************************************/
     
    215225{
    216226
    217   mainWindow->show();
     227  fMainWindow->show();
     228  Prompt("session");
     229  exitSession = false;
    218230  qApp->exec();
    219231
    220 //   Prompt("session"); // TO KEEP
    221 //   exitSession = false; // TO KEEP
    222232//   interactorManager->DisableSecondaryLoop (); // TO KEEP
    223233//   void* event; // TO KEEP
     
    230240}
    231241/***************************************************************************/
     242
    232243/**
    233244  Display the prompt in the prompt area
     
    239250/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    240251{
    241 // TODO !
    242 //  Arg args[1];
    243 //  char* str = (char*)XtNewString(aPrompt.data());
    244 //  XmString cps = XmStringLtoRCreate(str,XmSTRING_DEFAULT_CHARSET);
    245 //  XtFree(str);
    246 //  XtSetArg(args[0],XmNpromptString,cps);
    247 //  XtSetValues(command,args,1);
    248 //  XmStringFree(cps);
     252  fCommandLabel->setText((char*)aPrompt.data());
    249253}
    250254/***************************************************************************/
     
    404408/***************************************************************************/
    405409/***************************************************************************/
     410
    406411/**
    407   Callback call when "enter" clicked on the prompt zone.
     412  Callback call when "enter" clicked on the command zone.
    408413  Send the command to geant4
    409414 */
    410415// TODO !
    411 //void G4UIQt::commandEnteredCallback (
    412 // Widget    a_widget
    413 //,XtPointer a_tag
    414 //,XtPointer a_data
    415 //)
    416 /***************************************************************************/
    417 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    418 //{
    419 //  G4UIQt*  This = (G4UIQt*)a_tag;
    420 
    421 //   XmString cps  = ((XmCommandCallbackStruct*)a_data)->value;
    422 //   char*    ss = XmConvertCompoundStringToString(cps,0);
    423 //   G4String command (ss);
    424 //   XtFree   (ss);
    425 
    426 //   if(This->fHelp==true) {
    427 //     exitHelp = true;
    428 //     This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice);
    429 //   } else {
    430 //     This->ApplyShellCommand (command,exitSession,exitPause);
    431 //   }
    432 
    433 //   a_widget = NULL;
    434 //   a_tag    = NULL;
    435 //}
     416void G4UIQt::commandEnteredCallback (
     417)
     418/***************************************************************************/
     419/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
     420{
     421 
     422   G4String command (fCommandArea->text().toStdString().c_str());
     423   if(fHelp==true) {
     424     exitHelp = true;
     425     fHelp = ConvertStringToInt(command.data(),fHelpChoice);
     426   } else {
     427printf("*******************3\n");
     428     ApplyShellCommand (command,exitSession,exitPause);
     429printf("*******************4\n");
     430   }
     431
     432}
    436433// /***************************************************************************/
    437434// void G4UIXm::keyHandler (
     
    461458/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    462459{
    463   textArea->clear();
     460  fTextArea->clear();
    464461}
    465462
Note: See TracChangeset for help on using the changeset viewer.