Ignore:
Timestamp:
Sep 24, 2008, 5:31:43 PM (16 years ago)
Author:
garnier
Message:

now we could have a external QApplication

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/interfaces/common/src/G4Qt.cc

    r850 r856  
    9191  printf("G4Qt::G4Qt try to inited Qt\n");
    9292#endif
    93   if(QtInited==FALSE) {  //Qt should be Inited once !
    94 #ifdef GEANT4_QT_DEBUG
    95     printf("G4Qt::G4Qt inited Qt\n");
    96 #endif
    97 #if QT_VERSION < 0x040000
    98     qApp = new QApplication (a_argn, a_args);
    99     //    QApplication qApp(a_argn, a_args);
    100     //    if(&qApp == NULL) {
    101 #else
    102     new QApplication (a_argn, a_args);
    103 #endif
    104     if(!qApp) {
    105 
    106       G4cout        << "G4Qt : Unable to init Qt." << G4endl;
    107     } else {
     93  // Check if Qt already init in another external app
     94  if(qApp) {
    10895      QtInited  = TRUE;
    10996      //#if QT_VERSION < 0x040000
     
    114101      SetArguments      (a_argn,a_args);
    115102#ifdef GEANT4_QT_DEBUG
    116       printf("G4Qt::G4Qt inited Qt END\n");
     103      printf("G4Qt::G4Qt alredy inited in external \n");
    117104#endif
     105  } else {
     106
     107    if(QtInited==FALSE) {  //Qt should be Inited once !
     108#ifdef GEANT4_QT_DEBUG
     109      printf("G4Qt::G4Qt inited Qt\n");
     110#endif
     111#if QT_VERSION < 0x040000
     112      qApp = new QApplication (a_argn, a_args);
     113      //    QApplication qApp(a_argn, a_args);
     114      //    if(&qApp == NULL) {
     115#else
     116      new QApplication (a_argn, a_args);
     117#endif
     118      if(!qApp) {
     119       
     120        G4cout        << "G4Qt : Unable to init Qt." << G4endl;
     121      } else {
     122        QtInited  = TRUE;
     123        //#if QT_VERSION < 0x040000
     124        //      SetMainInteractor (&qApp);
     125        //#else
     126        SetMainInteractor (qApp);
     127        //#endif
     128        SetArguments      (a_argn,a_args);
     129#ifdef GEANT4_QT_DEBUG
     130        printf("G4Qt::G4Qt inited Qt END\n");
     131#endif
     132      }
    118133    }
    119134  }
Note: See TracChangeset for help on using the changeset viewer.