Index: trunk/geant4/interfaces/basic/src/G4UIQt.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 609)
+++ trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 610)
@@ -30,5 +30,5 @@
 // L. Garnier
 
-//#define DEBUG
+#define GEANT4_QT_DEBUG
 
 #ifdef G4UI_BUILD_QT_SESSION
@@ -128,11 +128,39 @@
 #endif
 
+  // Set layouts
+
+#if QT_VERSION < 0x040000
   QSplitter *splitter = new QSplitter(Qt::Vertical);
-  fTextArea = new QTextEdit(fMainWindow);
-  QPushButton *clearButton = new QPushButton("clear",fMainWindow);
+
+  QWidget* topWidget = new QWidget(splitter);
+  QWidget* bottomWidget = new QWidget(splitter);
+
+  QVBoxLayout *layoutTop = new QVBoxLayout(topWidget);
+  QVBoxLayout *layoutBottom = new QVBoxLayout(bottomWidget);
+#else
+  QWidget* topWidget = new QWidget();
+  QWidget* bottomWidget = new QWidget();
+
+  QVBoxLayout *layoutTop = new QVBoxLayout;
+  QVBoxLayout *layoutBottom = new QVBoxLayout;
+#endif
+
+  // fill them
+
+  fTextArea = new QTextEdit(topWidget);
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt:: end\n");
+#endif
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::PushButton 1\n");
+#endif
+  QPushButton *clearButton = new QPushButton("clear",topWidget);
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::end1\n");
+#endif
   connect(clearButton, SIGNAL(clicked()), SLOT(ClearButtonCallback()));
 
 #if QT_VERSION < 0x040000
-  fCommandHistoryArea = new QListView();
+  fCommandHistoryArea = new QListView(bottomWidget);
   fCommandHistoryArea->setSelectionMode(QListView::Single);
   connect(fCommandHistoryArea, SIGNAL(selectionChanged()), SLOT(CommandHistoryCallback()));
@@ -143,8 +171,11 @@
 #endif
   fCommandHistoryArea->installEventFilter(this);
-  fCommandLabel = new QLabel("",fMainWindow);
-
-  fCommandArea = new QLineEdit(fMainWindow);
+  fCommandLabel = new QLabel("",bottomWidget);
+
+  fCommandArea = new QLineEdit(bottomWidget);
   fCommandArea->installEventFilter(this);
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   1\n");
+#endif
 #if QT_VERSION < 0x040000
   fCommandArea->setActiveWindow();
@@ -163,20 +194,11 @@
 
 
-  // Set layouts
-
-#if QT_VERSION < 0x040000
-  QWidget* topWidget = new QWidget(splitter);
-  QWidget* bottomWidget = new QWidget(splitter);
-
-  QVBoxLayout *layoutTop = new QVBoxLayout(topWidget);
-  QVBoxLayout *layoutBottom = new QVBoxLayout(bottomWidget);
-#else
-  QWidget* topWidget = new QWidget();
-  QWidget* bottomWidget = new QWidget();
-
-  QVBoxLayout *layoutTop = new QVBoxLayout;
-  QVBoxLayout *layoutBottom = new QVBoxLayout;
-#endif
-
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   2\n");
+#endif
+
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   3\n");
+#endif
 
 
@@ -188,4 +210,7 @@
 #endif
 
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   4\n");
+#endif
   layoutBottom->addWidget(fCommandHistoryArea);
   layoutBottom->addWidget(fCommandLabel);
@@ -199,4 +224,7 @@
 
 
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   5\n");
+#endif
   fMainWindow->setCentralWidget(splitter);
 
@@ -213,4 +241,7 @@
   fMainWindow->menuBar()->insertItem( QString("&Help"), helpMenu );
 
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   6\n");
+#endif
 
 #else
@@ -223,4 +254,7 @@
   QMenu *helpMenu = fMainWindow->menuBar()->addMenu("Help");
   helpMenu->addAction("Show Help", this, SLOT(ShowHelpCallback()));
+#endif
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   7\n");
 #endif
 
@@ -236,4 +270,7 @@
     splitter->setSizes(vals);
   }
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::   8\n");
+#endif
 
   if(UI!=NULL) UI->SetCoutDestination(this);  // TO KEEP
@@ -282,5 +319,7 @@
 #endif
   interactorManager->DisableSecondaryLoop (); // TO KEEP
-  ((QApplication*)interactorManager->GetMainInteractor())->exec(); 
+  if ((QApplication*)interactorManager->GetMainInteractor())
+    ((QApplication*)interactorManager->GetMainInteractor())->exec();
+
   // on ne passe pas le dessous ? FIXME ????
   // je ne pense pas 13/06
@@ -548,7 +587,19 @@
 
 #if QT_VERSION < 0x040000
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::QTextEdit 1\n");
+#endif
     fHelpArea = new QTextEdit(splitter);
-#else
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::end 1\n");
+#endif
+#else
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::QTextEdit 2\n");
+#endif
     fHelpArea = new QTextEdit();
+#ifdef GEANT4_QT_DEBUG
+  printf("G4UIQt::end 2\n");
+#endif
 #endif
     fHelpArea->setReadOnly(true);
