Changeset 489


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

r582@mac-90108: laurentgarnier | 2007-06-07 11:10:12 +0200
version de test avec 2 classes

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

Legend:

Unmodified
Added
Removed
  • trunk/geant4/interfaces/basic/include/G4UIQt.hh

    r488 r489  
    3131#define G4UIQt_h
    3232
    33 #if defined(G4UI_BUILD_QT_SESSION) || defined(G4UI_USE_QT)
     33//#if defined(G4UI_BUILD_QT_SESSION) || defined(G4UI_USE_QT)
    3434
    3535#include <map>
     
    4141#include <QtGui/qlineedit.h>
    4242#include <QtGui/qtextedit.h>
     43#include <QObject>
    4344class G4UIsession;
    4445
     
    6465
    6566class G4UIQt : public G4VBasicShell, public G4VInteractiveSession {
    66 //  Q_OBJECT
    6767
    6868public: // With description
     
    102102  G4bool fHelp;
    103103  G4int fHelpChoice;
    104   QMainWindow * mainWindow;
    105   QLineEdit * promptArea;
     104  QMainWindow *fMainWindow;
     105  UIQtCentralWidget *fCentralWidget;
     106};
     107
     108class UIQtCentralWidget : public QWidget, public QObject {
     109
     110Q_OBJECT
     111
     112  QLineEdit *promptArea;
    106113  QTextEdit *textArea;
    107   //  static void ButtonCallback(Widget,XtPointer,XtPointer);
     114
     115private slots:
     116  void clearButtonCallback();
    108117
    109118};
    110119
    111 #endif
     120//#endif
    112121
    113122#endif
  • trunk/geant4/interfaces/basic/src/G4UIQt.cc

    r488 r489  
    6464static G4bool exitPause = true;
    6565static G4bool exitHelp = true;
     66
     67
     68UIQtCentralWidget::UIQtCentralWidget (
     69) : QWidget()
     70/***************************************************************************/
     71/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
     72{
     73  QVBoxLayout* vBox = new QVBoxLayout();
     74  textArea = new QTextEdit();
     75  QLabel *sessionLabel = new QLabel("Session : ");
     76  QPushButton *clearButton = new QPushButton("clear");
     77  connect(clearButton, SIGNAL(clicked()), SLOT(textArea->clear()));
     78
     79//  QMenu *menuFile = new QMenu("File");
     80//  mainWindow->menuBar()->addMenu(menuFile);
     81
     82  promptArea = new QLineEdit();
     83  textArea->setReadOnly(FALSE);
     84  vBox->addWidget(textArea);
     85  vBox->addWidget(clearButton);
     86  vBox->addWidget(sessionLabel);
     87  vBox->addWidget(promptArea);
     88  setLayout(vBox);
     89}
     90
    6691/***************************************************************************/
    6792/**
     
    94119  G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt");  // TO KEEP ?
    95120
    96   mainWindow = new QMainWindow();
    97   mainWindow->setWindowTitle( "G4UI Session" );
    98   mainWindow->setBaseSize(300,200);
    99   QWidget* centralWidget = new QWidget();
    100   QVBoxLayout* vBox = new QVBoxLayout();
    101   textArea = new QTextEdit();
    102   QLabel *sessionLabel = new QLabel("Session : ");
    103   QPushButton *clearButton = new QPushButton("clear");
    104 //  mainWindow->connect(clearButton, SIGNAL(clicked()), SLOT(textArea->clear()));
    105 
    106 //  QMenu *menuFile = new QMenu("File");
    107 //  mainWindow->menuBar()->addMenu(menuFile);
    108 
    109   promptArea = new QLineEdit();
    110   textArea->setReadOnly(FALSE);
    111   vBox->addWidget(textArea);
    112   vBox->addWidget(clearButton);
    113   vBox->addWidget(sessionLabel);
    114   vBox->addWidget(promptArea);
    115   centralWidget->setLayout(vBox);
    116   mainWindow->setCentralWidget(centralWidget);
     121  fMainWindow = new QMainWindow();
     122  fMainWindow->setWindowTitle( "G4UI Session" );
     123  fMainWindow->setBaseSize(300,200);
     124  centralWidget = new UIQtCentralWidget();
     125  fMainWindow->setCentralWidget(centralWidget);
    117126
    118127//  QMainWindow top = (QMainWindow)interactorManager->GetMainInteractor();
     
    202211
    203212 
    204   if (mainWindow!=NULL)
    205     delete mainWindow;
     213  if (fMainWindow!=NULL)
     214    delete fMainWindow;
    206215}
    207216/***************************************************************************/
     
    215224{
    216225
    217   mainWindow->show();
     226  fMainWindow->show();
    218227  qApp->exec();
    219228
     
    455464//}
    456465
     466/** Callback activated when user click on the clear button
     467*/
    457468 /***************************************************************************/
    458 // void clearButtonCallback (
    459 // )
    460 /***************************************************************************/
    461 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    462 //{
    463 //}
     469 void clearButtonCallback (
     470 )
     471/***************************************************************************/
     472/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
     473{
     474  textArea->clear()
     475}
    464476/***************************************************************************/
    465477// TODO !
Note: See TracChangeset for help on using the changeset viewer.