Ignore:
Timestamp:
Nov 6, 2008, 11:06:50 AM (16 years ago)
Author:
garnier
Message:

G4Qt : Fix some problems. See History file

Location:
trunk/source/interfaces
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/interfaces/History

    r874 r876  
    1 $Id: History,v 1.102 2008/10/24 13:23:22 lgarnier Exp $
     1$Id: History,v 1.103 2008/11/06 10:06:33 lgarnier Exp $
    22-------------------------------------------------------------------
    33
     
    1818     ----------------------------------------------------------
    1919
     206 November, Laurent Garnier
     21 - G4Qt : Re-fix problem on some linux with QApplication, should be better
     22 - G4Qt : Add availabity to launch a G4Qt without a G4UIQt
     23
    202424 October, Laurent Garnier
    2125 - Change GEANT4_QT_DEBUG flag by QTDEBUG
     
    2529 - Fix a problem on some linux with QApplication. But this is NOT the good way to do it...
    2630 - Fix a qt3 backward compatibility on G4UIQt.cc
    27 
    2831
    29327 October, Laurent Garnier
  • trunk/source/interfaces/basic/include/G4UIQt.hh

    r874 r876  
    2525//
    2626//
    27 // $Id: G4UIQt.hh,v 1.14 2008/10/15 09:09:47 lgarnier Exp $
     27// $Id: G4UIQt.hh,v 1.15 2008/11/06 10:06:33 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
  • trunk/source/interfaces/basic/src/G4UIQt.cc

    r874 r876  
    2525//
    2626//
    27 // $Id: G4UIQt.cc,v 1.21 2008/10/24 13:23:22 lgarnier Exp $
     27// $Id: G4UIQt.cc,v 1.22 2008/11/06 10:06:33 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
  • trunk/source/interfaces/basic/src/G4UIXm.cc

    r850 r876  
    2626//
    2727// $Id: G4UIXm.cc,v 1.14 2006/06/29 19:09:49 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     28// GEANT4 tag $Name: $
    2929//
    3030// G.Barrand
  • trunk/source/interfaces/common/include/G4Qt.hh

    r874 r876  
    2525//
    2626//
    27 // $Id: G4Qt.hh,v 1.3 2008/10/15 09:09:47 lgarnier Exp $
     27// $Id: G4Qt.hh,v 1.4 2008/11/06 10:06:33 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    5959  G4Qt (int,char**,char*);                     
    6060  static G4Qt* instance; // Pointer to single instance.
     61  int    argn;
     62  char** args;
    6163};
    6264
  • trunk/source/interfaces/common/src/G4Qt.cc

    r874 r876  
    2525//
    2626//
    27 // $Id: G4Qt.cc,v 1.10 2008/10/24 13:23:22 lgarnier Exp $
     27// $Id: G4Qt.cc,v 1.11 2008/11/06 10:06:33 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7777/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    7878{
     79  argn = 0;
     80  args = NULL;
     81
    7982#ifdef G4DEBUG
    8083  printf("G4Qt::G4Qt try to inited Qt\n");
     
    8285  // Check if Qt already init in another external app
    8386  if(qApp) {
    84       QtInited  = TRUE;
    85       //#if QT_VERSION < 0x040000
    86       //      SetMainInteractor (&qApp);
    87       //#else
    88       SetMainInteractor (qApp);
    89       //#endif
    90       SetArguments      (a_argn,a_args);
    91 
    92 #ifdef G4DEBUG
    93       printf("G4Qt::G4Qt alredy inited in external \n");
     87    QtInited  = TRUE;
     88    //#if QT_VERSION < 0x040000
     89    //      SetMainInteractor (&qApp);
     90    //#else
     91    SetMainInteractor (qApp);
     92    //#endif
     93    SetArguments      (a_argn,a_args);
     94   
     95#ifdef G4DEBUG
     96    printf("G4Qt::G4Qt alredy inited in external \n");
    9497#endif
    9598  } else {
    96 
     99   
    97100    if(QtInited==FALSE) {  //Qt should be Inited once !
    98101      // Then two cases :
    99102      // - It is the first time we create G4UI  (argc!=0)
    100103      //   -> Inited and register
    101       // - It is the first time we create G4VIS  (arc == 0)
     104      // - It is the first time we create G4VIS  (argc == 0)
    102105      //   -> Inited and NOT register
    103 
    104       int argc;
    105       char ** test;
     106     
    106107      if (a_argn != 0) {
    107         SetArguments      (a_argn,a_args);
    108 #ifdef G4DEBUG
    109       printf("G4Qt::G4Qt inited, first time creating UI \n");
    110 #endif
     108        argn = a_argn;
     109        args = a_args;
     110
    111111      } else { //argc = 0
    112         test = GetArguments(&argc);
    113 
    114 #ifdef G4DEBUG
    115 
    116         printf("G4Qt::G4Qt inited, create new QtVis\n");
    117         printf("G4Qt::G4Qt arguments avant %s\n",a_args[0]);
    118         printf("G4Qt::G4Qt arguments avant %s\n",a_args[1]);
    119         printf("G4Qt::G4Qt arguments avant %s\n",a_args[2]);
    120         printf("G4Qt::G4Qt arguments avant %s\n",a_args[3]);
    121         printf("G4Qt::G4Qt arguments apres %d\n",argc);
    122         printf("G4Qt::G4Qt arguments apres %s \n",test[0]);
    123         printf("G4Qt::G4Qt arguments apres %s \n",test[1]);
    124         printf("G4Qt::G4Qt arguments apres %s \n",test[2]);
    125         printf("G4Qt::G4Qt arguments apres %s \n",test[3]);
    126 #endif
    127         if (argc == 0) {
    128           G4cout        << "G4Qt : Unable to init Qt." << G4endl;
    129           return;
    130         }
     112
     113        // FIXME : That's not the good arguments, but I don't know how to get args from other Interactor.
     114        // Ex: How to get them from G4Xt ?
     115        argn = 1;
     116        args = (char **)malloc( 1 * sizeof(char *) );
     117        args[0] = (char *)malloc(10 * sizeof(char));
     118        strncpy(args[0], "my_app \0", 9);
    131119      }
     120
     121      int *p_argn = (int*)malloc(sizeof(int));
     122      *p_argn = argn;
    132123#if QT_VERSION < 0x040000
    133       qApp = new QApplication (a_argn, a_args);
    134       //    QApplication qApp(a_argn, a_args);
    135       //    if(&qApp == NULL) {
     124      qApp = new QApplication (argn, args);
    136125#else
    137       new QApplication (a_argn, a_args);
    138 #endif
    139      
     126      new QApplication (argn, args);
     127#endif
    140128      if(!qApp) {
    141129       
    142130        G4cout        << "G4Qt : Unable to init Qt." << G4endl;
    143131      } else {
     132        QtInited  = TRUE;
    144133        if (a_argn != 0) {
    145134          SetMainInteractor (qApp);
    146           SetArguments      (a_argn,a_args);
    147135        }
    148         QtInited  = TRUE;
     136        SetArguments      (a_argn,a_args);
    149137#ifdef G4DEBUG
    150138        printf("G4Qt::G4Qt inited Qt END\n");
  • trunk/source/interfaces/common/src/G4Xt.cc

    r850 r876  
    2626//
    2727// $Id: G4Xt.cc,v 1.11 2006/06/29 19:10:28 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     28// GEANT4 tag $Name: $
    2929//
    3030// G.Barrand
Note: See TracChangeset for help on using the changeset viewer.