Index: trunk/geant4/interfaces/basic/include/G4UIQt.hh
===================================================================
--- trunk/geant4/interfaces/basic/include/G4UIQt.hh	(revision 607)
+++ trunk/geant4/interfaces/basic/include/G4UIQt.hh	(revision 608)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4UIQt.hh,v 1.4 2007/11/13 17:48:51 lgarnier Exp $
+// $Id: G4UIQt.hh,v 1.6 2007/11/15 18:24:27 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -144,13 +144,10 @@
 
 private slots :
+  void ExitSession();
   void ClearButtonCallback();
   void CommandEnteredCallback();
   void ButtonCallback(const QString&);
   void HelpTreeClicCallback();
-#if QT_VERSION < 0x040000
-  void HelpTreeDoubleClicCallback( QListViewItem*, int);
-#else
   void HelpTreeDoubleClicCallback( QTreeWidgetItem*, int);
-#endif
   void ShowHelpCallback();
   void CommandHistoryCallback();
Index: trunk/geant4/interfaces/basic/src/G4UIQt.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 607)
+++ trunk/geant4/interfaces/basic/src/G4UIQt.cc	(revision 608)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4UIQt.cc,v 1.9 2007/11/15 10:10:02 lgarnier Exp $
+// $Id: G4UIQt.cc,v 1.12 2007/11/15 18:24:27 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -60,9 +60,9 @@
 #include <qsignalmapper.h>
 
+#include <qmainwindow.h>
 #if QT_VERSION >= 0x040000
 #include <qmenu.h>
 #include <qlistwidget.h>
 #include <qtreewidget.h>
-#include <qmainwindow.h>
 #else
 #include <qaction.h>
@@ -106,5 +106,7 @@
   :fHelpDialog(NULL)
 {
+#ifdef GEANT4_QT_DEBUG
   printf("G4UIQt::Initialise %d %s\n",argc,argv[0]);
+#endif
   G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt");
   G4UImanager* UI = G4UImanager::GetUIpointer();
@@ -113,5 +115,7 @@
   fMainWindow = new QMainWindow();
 
+#ifdef GEANT4_QT_DEBUG
   printf("G4UIQt::Initialise after main window creation\n");
+#endif
 #if QT_VERSION < 0x040000
   fMainWindow->setCaption( tr( "G4UI Session" ));
@@ -132,9 +136,10 @@
   fCommandHistoryArea = new QListView();
   fCommandHistoryArea->setSelectionMode(QListView::Single);
+  connect(fCommandHistoryArea, SIGNAL(selectionChanged()), SLOT(CommandHistoryCallback()));
 #else
   fCommandHistoryArea = new QListWidget();
   fCommandHistoryArea->setSelectionMode(QAbstractItemView::SingleSelection);
-#endif
   connect(fCommandHistoryArea, SIGNAL(itemSelectionChanged()), SLOT(CommandHistoryCallback()));
+#endif
   fCommandHistoryArea->installEventFilter(this);
   fCommandLabel = new QLabel("",fMainWindow);
@@ -200,5 +205,5 @@
   // Add a quit subMenu
   QPopupMenu *fileMenu = new QPopupMenu( fMainWindow);
-  fileMenu->insertItem( "&Quitter",  this, SLOT(close()), CTRL+Key_Q );
+  fileMenu->insertItem( "&Quitter",  this, SLOT(ExitSession()), CTRL+Key_Q );
   fMainWindow->menuBar()->insertItem( QString("&File"), fileMenu );
 
@@ -213,5 +218,5 @@
   // Add a quit subMenu
   QMenu *fileMenu = fMainWindow->menuBar()->addMenu("File");
-  fileMenu->addAction("Quitter", fMainWindow, SLOT(close()));
+  fileMenu->addAction("Quitter", this, SLOT(ExitSession()));
 
   // Add a Help menu
@@ -261,5 +266,9 @@
 
 #if QT_VERSION >= 0x040000
+#if QT_VERSION >= 0x040200
   fMainWindow->setVisible(true);
+#else
+  fMainWindow->show();
+#endif
 #else
   fMainWindow->show();
@@ -269,5 +278,7 @@
 
 
+#ifdef GEANT4_QT_DEBUG
   printf("disable secondary loop\n");
+#endif
   interactorManager->DisableSecondaryLoop (); // TO KEEP
   ((QApplication*)interactorManager->GetMainInteractor())->exec(); 
@@ -282,5 +293,7 @@
 
   interactorManager->EnableSecondaryLoop ();
+#ifdef GEANT4_QT_DEBUG
   printf("enable secondary loop\n");
+#endif
   return this;
 }
@@ -326,5 +339,7 @@
   if (!aState) return;
 
+#ifdef GEANT4_QT_DEBUG
   printf("G4UIQt::PauseSessionStart\n");
+#endif
   if(aState=="G4_pause> ") {  // TO KEEP
     SecondaryLoop ("Pause, type continue to exit this state"); // TO KEEP
@@ -349,5 +364,7 @@
   if (!aPrompt) return;
 
+#ifdef GEANT4_QT_DEBUG
   printf("G4UIQt::SecondaryLoop\n");
+#endif
   G4Qt* interactorManager = G4Qt::getInstance (); // TO KEEP ?
   Prompt(aPrompt); // TO KEEP
@@ -376,5 +393,4 @@
   if (!interactorManager) return 0;
   
-  //  printf(" **************** G4 Cout : %s\n",(char*)aString.data());
 #if QT_VERSION < 0x040000
   fTextArea->append(QString((char*)aString.data()).simplifyWhiteSpace());
@@ -895,5 +911,7 @@
 )
 {
+#ifdef GEANT4_QT_DEBUG
   printf("G4UIQt::GetHelpChoice SHOULD NEVER GO HERE");
+#endif
   return true;
 }
@@ -905,5 +923,7 @@
 )
 {
+#ifdef GEANT4_QT_DEBUG
   printf("G4UIQt::ExitHelp SHOULD NEVER GO HERE");
+#endif
 }
 
@@ -1040,4 +1060,12 @@
 }
 
+/**   Called when user exit session
+*/
+void G4UIQt::ExitSession (
+)
+{
+  SessionTerminate();
+}
+
 
 /**   Callback call when "click on a menu entry.<br>
@@ -1071,5 +1099,7 @@
       TerminalHelp(command);
     }
+#ifdef GEANT4_QT_DEBUG
     printf("after \n");
+#endif
     if(exitSession==true) 
       SessionTerminate();
@@ -1172,5 +1202,7 @@
 )
 {
+#ifdef GEANT4_QT_DEBUG
   printf("G4UIQt::HelpTreeDoubleClicCallback");
+#endif
   HelpTreeClicCallback();
   fCommandArea->setText(item->text (1));
Index: trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc
===================================================================
--- trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc	(revision 607)
+++ trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc	(revision 608)
@@ -3,5 +3,5 @@
 **
 ** Created: Tue Nov 13 18:13:09 2007
-**      by: The Qt MOC ($Id: G4UIQt_moc.cc,v 1.6 2007/11/14 10:38:49 lgarnier Exp $)
+**      by: The Qt MOC ($Id: G4UIQt_moc.cc,v 1.8 2007/11/15 18:24:28 lgarnier Exp $)
 **
 ** WARNING! All changes made in this file will be lost!
@@ -19,5 +19,5 @@
 #include <private/qucomextra_p.h>
 #if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
-#error "This file was generated using the moc from 3.3.5. It"
+#error "This file was generated using the moc from 3.3.8. It"
 #error "cannot be used with the include files from this version of Qt."
 #error "(The moc has changed too much.)"
@@ -57,26 +57,28 @@
 	return metaObj;
     QMetaObject* parentObject = QObject::staticMetaObject();
-    static const QUMethod slot_0 = {"ClearButtonCallback", 0, 0 };
-    static const QUMethod slot_1 = {"CommandEnteredCallback", 0, 0 };
-    static const QUParameter param_slot_2[] = {
+    static const QUMethod slot_0 = {"ExitSession", 0, 0 };
+    static const QUMethod slot_1 = {"ClearButtonCallback", 0, 0 };
+    static const QUMethod slot_2 = {"CommandEnteredCallback", 0, 0 };
+    static const QUParameter param_slot_3[] = {
 	{ 0, &static_QUType_QString, 0, QUParameter::In }
     };
-    static const QUMethod slot_2 = {"ButtonCallback", 1, param_slot_2 };
-    static const QUMethod slot_3 = {"HelpTreeClicCallback", 0, 0 };
-    static const QUParameter param_slot_4[] = {
-	{ 0, &static_QUType_ptr, "QTreeWidgetItem", QUParameter::In },
+    static const QUMethod slot_3 = {"ButtonCallback", 1, param_slot_3 };
+    static const QUMethod slot_4 = {"HelpTreeClicCallback", 0, 0 };
+    static const QUParameter param_slot_5[] = {
+	{ 0, &static_QUType_ptr, "QListViewItem", QUParameter::In },
 	{ 0, &static_QUType_int, 0, QUParameter::In }
     };
-    static const QUMethod slot_4 = {"HelpTreeDoubleClicCallback", 2, param_slot_4 };
-    static const QUMethod slot_5 = {"ShowHelpCallback", 0, 0 };
-    static const QUMethod slot_6 = {"CommandHistoryCallback", 0, 0 };
+    static const QUMethod slot_5 = {"HelpTreeDoubleClicCallback", 2, param_slot_5 };
+    static const QUMethod slot_6 = {"ShowHelpCallback", 0, 0 };
+    static const QUMethod slot_7 = {"CommandHistoryCallback", 0, 0 };
     static const QMetaData slot_tbl[] = {
-	{ "ClearButtonCallback()", &slot_0, QMetaData::Private },
-	{ "CommandEnteredCallback()", &slot_1, QMetaData::Private },
-	{ "ButtonCallback(const QString&)", &slot_2, QMetaData::Private },
-	{ "HelpTreeClicCallback()", &slot_3, QMetaData::Private },
-	{ "HelpTreeDoubleClicCallback(QTreeWidgetItem*,int)", &slot_4, QMetaData::Private },
-	{ "ShowHelpCallback()", &slot_5, QMetaData::Private },
-	{ "CommandHistoryCallback()", &slot_6, QMetaData::Private }
+	{ "ExitSession()", &slot_0, QMetaData::Private },
+	{ "ClearButtonCallback()", &slot_1, QMetaData::Private },
+	{ "CommandEnteredCallback()", &slot_2, QMetaData::Private },
+	{ "ButtonCallback(const QString&)", &slot_3, QMetaData::Private },
+	{ "HelpTreeClicCallback()", &slot_4, QMetaData::Private },
+	{ "HelpTreeDoubleClicCallback(QListViewItem*,int)", &slot_5, QMetaData::Private },
+	{ "ShowHelpCallback()", &slot_6, QMetaData::Private },
+	{ "CommandHistoryCallback()", &slot_7, QMetaData::Private }
     };
     static const QUParameter param_signal_0[] = {
@@ -89,5 +91,5 @@
     metaObj = QMetaObject::new_metaobject(
 	"G4UIQt", parentObject,
-	slot_tbl, 7,
+	slot_tbl, 8,
 	signal_tbl, 1,
 #ifndef QT_NO_PROPERTIES
@@ -120,15 +122,12 @@
 {
     switch ( _id - staticMetaObject()->slotOffset() ) {
-    case 0: ClearButtonCallback(); break;
-    case 1: CommandEnteredCallback(); break;
-    case 2: ButtonCallback((const QString&)static_QUType_QString.get(_o+1)); break;
-    case 3: HelpTreeClicCallback(); break;
-#if QT_VERSION < 0x040000
-    case 4: HelpTreeDoubleClicCallback((QListViewItem*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
-#else
-    case 4: HelpTreeDoubleClicCallback((QTreeWidgetItem*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
-#endif
-    case 5: ShowHelpCallback(); break;
-    case 6: CommandHistoryCallback(); break;
+    case 0: ExitSession(); break;
+    case 1: ClearButtonCallback(); break;
+    case 2: CommandEnteredCallback(); break;
+    case 3: ButtonCallback((const QString&)static_QUType_QString.get(_o+1)); break;
+    case 4: HelpTreeClicCallback(); break;
+    case 5: HelpTreeDoubleClicCallback((QListViewItem*)static_QUType_ptr.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
+    case 6: ShowHelpCallback(); break;
+    case 7: CommandHistoryCallback(); break;
     default:
 	return QObject::qt_invoke( _id, _o );
@@ -155,4 +154,5 @@
 bool G4UIQt::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
 #endif // QT_NO_PROPERTIES
+
 
 #endif
@@ -188,5 +188,5 @@
        0,       // classname
        0,    0, // classinfo
-       8,   10, // methods
+       9,   10, // methods
        0,    0, // properties
        0,    0, // enums/sets
@@ -197,10 +197,11 @@
  // slots: signature, parameters, type, tag, flags
       32,   31,   31,   31, 0x08,
-      54,   31,   31,   31, 0x08,
-      79,   31,   31,   31, 0x08,
-     103,   31,   31,   31, 0x08,
-     126,  175,   31,   31, 0x08,
-     177,   31,   31,   31, 0x08,
-     196,   31,   31,   31, 0x08,
+      46,   31,   31,   31, 0x08,
+      68,   31,   31,   31, 0x08,
+      93,   31,   31,   31, 0x08,
+     117,   31,   31,   31, 0x08,
+     140,  189,   31,   31, 0x08,
+     191,   31,   31,   31, 0x08,
+     210,   31,   31,   31, 0x08,
 
        0        // eod
@@ -209,5 +210,6 @@
 static const char qt_meta_stringdata_G4UIQt[] = {
     "G4UIQt\0myClicked(QString)\0text\0\0"
-    "ClearButtonCallback()\0CommandEnteredCallback()\0"
+    "ExitSession()\0ClearButtonCallback()\0"
+    "CommandEnteredCallback()\0"
     "ButtonCallback(QString)\0HelpTreeClicCallback()\0"
     "HelpTreeDoubleClicCallback(QTreeWidgetItem*,int)\0"
@@ -245,13 +247,14 @@
         switch (_id) {
         case 0: myClicked((*reinterpret_cast< const QString(*)>(_a[1]))); break;
-        case 1: ClearButtonCallback(); break;
-        case 2: CommandEnteredCallback(); break;
-        case 3: ButtonCallback((*reinterpret_cast< const QString(*)>(_a[1]))); break;
-        case 4: HelpTreeClicCallback(); break;
-        case 5: HelpTreeDoubleClicCallback((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
-        case 6: ShowHelpCallback(); break;
-        case 7: CommandHistoryCallback(); break;
+        case 1: ExitSession(); break;
+        case 2: ClearButtonCallback(); break;
+        case 3: CommandEnteredCallback(); break;
+        case 4: ButtonCallback((*reinterpret_cast< const QString(*)>(_a[1]))); break;
+        case 5: HelpTreeClicCallback(); break;
+        case 6: HelpTreeDoubleClicCallback((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
+        case 7: ShowHelpCallback(); break;
+        case 8: CommandHistoryCallback(); break;
         }
-        _id -= 8;
+        _id -= 9;
     }
     return _id;
