Index: /trunk/source/interfaces/History
===================================================================
--- /trunk/source/interfaces/History	(revision 1311)
+++ /trunk/source/interfaces/History	(revision 1312)
@@ -1,3 +1,3 @@
-$Id: History,v 1.143 2010/06/04 15:12:09 lgarnier Exp $
+$Id: History,v 1.147 2010/06/10 16:01:38 lgarnier Exp $
 -------------------------------------------------------------------
 
@@ -18,6 +18,21 @@
      ----------------------------------------------------------
 
-4th June  L. Garnier
+10th June L. Garnier
+- G4UIQt : Fix crash when del all viewer tabs and create a new one.
+           Fix widget QLabel strange effect on OSX 10.5
+
+10th June L. Garnier
+- G4UIQt : Improvments on OpenGL tab at initialisation (tab size was 
+  too small). Remove some flicker effect at initialisation. Remove a
+  compilation warning. Improvment on Cout Filter for Qt3 
+
+8, June, 2010 K.Murakami (interfaces-V09-03-08)
+- G4VBasicShell : wrong version is in the cvs head.
+                  back to previous version (1.14) which includes 
+                  a correct bug fix.
+
+4th June  L. Garnier (interfaces-V09-03-07)
 - G4UIQt : Fix recursive repaint on windows and linux
+  Also fixed compilation problem for Qt3.
 - G4VBasicShell : Command completion improvments (was solve in
   v1.14 of G4VBasicShell but don't know why I go one step back)
Index: /trunk/source/interfaces/basic/include/G4UIQt.hh
===================================================================
--- /trunk/source/interfaces/basic/include/G4UIQt.hh	(revision 1311)
+++ /trunk/source/interfaces/basic/include/G4UIQt.hh	(revision 1312)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4UIQt.hh,v 1.22 2010/06/02 15:13:51 lgarnier Exp $
+// $Id: G4UIQt.hh,v 1.23 2010/06/10 15:37:13 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -195,4 +195,6 @@
   QSplitter * fMyVSplitter;
   QSplitter * fHelpVSplitter;
+  int fLastQTabSizeX;
+  int fLastQTabSizeY;
 
 private slots :
Index: /trunk/source/interfaces/basic/src/G4UIQt.cc
===================================================================
--- /trunk/source/interfaces/basic/src/G4UIQt.cc	(revision 1311)
+++ /trunk/source/interfaces/basic/src/G4UIQt.cc	(revision 1312)
@@ -25,5 +25,5 @@
 //
 //
-// $Id: G4UIQt.cc,v 1.42 2010/06/04 15:12:09 lgarnier Exp $
+// $Id: G4UIQt.cc,v 1.45 2010/06/10 16:01:38 lgarnier Exp $
 // GEANT4 tag $Name:  $
 //
@@ -171,14 +171,4 @@
   // Set layouts
 
-  // Add a empty tabwidget
-  fTabWidget = new G4QTabWidget(fMyVSplitter);
-#if QT_VERSION >= 0x040500
-  fTabWidget->setTabsClosable (true); 
-#endif
-
-#if QT_VERSION >= 0x040200
-  fTabWidget->setUsesScrollButtons (true);
-#endif
-
   QWidget* commandLineWidget = new QWidget(mainWidget);
 #if QT_VERSION < 0x040000
@@ -212,8 +202,9 @@
   layoutCommandLine->addWidget(fCommandLabel);
   layoutCommandLine->addWidget(fCommandArea);
+  QVBoxLayout *mainLayout;
 #if QT_VERSION >= 0x040000
-  QVBoxLayout *mainLayout = new QVBoxLayout();
-#else
-  QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
+  mainLayout = new QVBoxLayout();
+#else
+  mainLayout = new QVBoxLayout(mainWidget);
 #endif
 
@@ -240,15 +231,4 @@
 
   fToolBox->setSizePolicy (QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
-  fTabWidget->setSizePolicy (QSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum));
-
-  QSizePolicy policy = fTabWidget->sizePolicy();
-#if QT_VERSION < 0x040000
-  policy.setHorStretch(1);
-  policy.setVerStretch(1);
-#else
-  policy.setHorizontalStretch(1);
-  policy.setVerticalStretch(1);
-#endif
-  fTabWidget->setSizePolicy(policy);
 
 #if QT_VERSION < 0x040000
@@ -261,25 +241,16 @@
 #if QT_VERSION >= 0x040000
  #if QT_VERSION >= 0x040200
-  fTabWidget->setVisible(false);
   fEmptyViewerTabLabel->setVisible(false);
  #else
-  fTabWidget->hide();
   fEmptyViewerTabLabel->hide();
  #endif
 #else
-  fTabWidget->hide();
   fEmptyViewerTabLabel->hide();
 #endif
 
 
-  //  fMyVSplitter->addWidget(fTabWidget);
-
-  // unset parent fot TabWidget
-#if QT_VERSION < 0x040000
-  fTabWidget->reparent(0,0,QPoint(0,0));  
-#else
+#if QT_VERSION >= 0x040000
   fMyVSplitter->addWidget(fToolBox);
   fMyVSplitter->addWidget(fEmptyViewerTabLabel);
-  fTabWidget->setParent(0);
 #endif
 
@@ -324,8 +295,4 @@
   // Connect signal
   connect(fCommandArea, SIGNAL(returnPressed()), SLOT(CommandEnteredCallback()));
-#if QT_VERSION >= 0x040500
-  connect(fTabWidget,   SIGNAL(tabCloseRequested(int)), this, SLOT(TabCloseCallback(int)));
-#endif
-  connect(fTabWidget, SIGNAL(currentChanged ( int ) ), SLOT(UpdateTabWidget(int)));
   connect(fToolBox, SIGNAL(currentChanged(int)), SLOT(ToolBoxActivated(int)));
 
@@ -342,14 +309,6 @@
 #endif
 
-  // Set visible
-#if QT_VERSION >= 0x040000
- #if QT_VERSION >= 0x040200
-  fMainWindow->setVisible(true);
- #else
-  fMainWindow->show();
- #endif
-#else
-  fMainWindow->show();
-#endif
+  // Set not visible until session start
+  fMainWindow->setVisible(false);
 
 #ifdef G4DEBUG_INTERFACES_BASIC
@@ -542,4 +501,39 @@
   printf("G4UIQt::AddTabWidget %d %d\n",sizeX, sizeY);
 #endif
+
+  if (fTabWidget == NULL) {
+#ifdef G4DEBUG_INTERFACES_BASIC
+    printf("G4UIQt::AddTabWidget +++++\n");
+#endif
+    fTabWidget = new G4QTabWidget(fMyVSplitter);
+#if QT_VERSION >= 0x040500
+    fTabWidget->setTabsClosable (true); 
+#endif
+    
+#if QT_VERSION >= 0x040200
+    fTabWidget->setUsesScrollButtons (true);
+#endif
+    
+    fTabWidget->setSizePolicy (QSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum));
+    
+    QSizePolicy policy = fTabWidget->sizePolicy();
+#if QT_VERSION < 0x040000
+    policy.setHorStretch(1);
+    policy.setVerStretch(1);
+#else
+    policy.setHorizontalStretch(1);
+    policy.setVerticalStretch(1);
+#endif
+    fTabWidget->setSizePolicy(policy);
+    
+#if QT_VERSION >= 0x040500
+    connect(fTabWidget,   SIGNAL(tabCloseRequested(int)), this, SLOT(TabCloseCallback(int)));
+#endif
+    connect(fTabWidget, SIGNAL(currentChanged ( int ) ), SLOT(UpdateTabWidget(int))); 
+  }
+
+  fLastQTabSizeX = sizeX;
+  fLastQTabSizeY = sizeY;
+
   if (!aWidget) {
     return false;
@@ -556,6 +550,14 @@
 #if QT_VERSION < 0x040000
     fEmptyViewerTabLabel->reparent(0,0,QPoint(0,0));  
-#else
-    fEmptyViewerTabLabel->setParent(0);
+    fEmptyViewerTabLabel->hide();
+    delete fEmptyViewerTabLabel;
+    fEmptyViewerTabLabel = NULL;
+
+#else
+    fEmptyViewerTabLabel->hide();
+    fEmptyViewerTabLabel->setParent(NULL);
+    delete fEmptyViewerTabLabel;
+    fEmptyViewerTabLabel = NULL;
+
     fMyVSplitter->addWidget(fTabWidget);
 #endif
@@ -575,5 +577,21 @@
 #endif
   
-  fMainWindow->resize(fMainWindow->width()+sizeX-fTabWidget->width(),fMainWindow->height()+sizeY-fTabWidget->height());
+  if (fMainWindow->isVisible()) {
+
+    // get the size of the tabbar
+    int tabBarX = 0;
+    int tabBarY = 0;
+    if (fTabWidget->count() >0) {
+#if QT_VERSION < 0x040000
+      tabBarX = fTabWidget->width()-fTabWidget->page(0)->width();
+      tabBarY = fTabWidget->height()-fTabWidget->page(0)->height();
+#else
+      tabBarX = fTabWidget->width()-fTabWidget->widget(0)->width();
+      tabBarY = fTabWidget->height()-fTabWidget->widget(0)->height();
+#endif
+    }
+
+    fMainWindow->resize(tabBarX+fMainWindow->width()+sizeX-fTabWidget->width(),tabBarY+fMainWindow->height()+sizeY-fTabWidget->height());
+  }
 
   // Problems with resize. The widgets are not realy drawn at this step,
@@ -596,24 +614,11 @@
  #if QT_VERSION >= 0x040200
    fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
-   fMainWindow->setVisible(true);
  #else
    fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
-   fMainWindow->show();
  #endif
 #else
   fTabWidget->setLastTabCreated(fTabWidget->currentPageIndex());
-  fMainWindow->show();
-#endif
-  
-#if QT_VERSION >= 0x040000
- #if QT_VERSION >= 0x040200
-   fTabWidget->setVisible(true);
- #else
-   fTabWidget->show();
- #endif
-#else
-   fTabWidget->show();
-#endif
-
+#endif
+  
   return true;
 }
@@ -642,13 +647,5 @@
   fTabWidget->setTabSelected(false);
 
-#if QT_VERSION >= 0x040000
- #if QT_VERSION >= 0x040200
-   fTabWidget->setVisible(true);
- #else
-   fTabWidget->show();
- #endif
-#else
-   fTabWidget->show();
-#endif
+  fTabWidget->setVisible(true);
 
   // This will send a paintEvent to OGL Viewers
@@ -697,27 +694,25 @@
   exitSession = false;
 
-#if QT_VERSION >= 0x040000
- #if QT_VERSION >= 0x040200
-  fTabWidget->setVisible(true);
-  fEmptyViewerTabLabel->setVisible(true);
- #else
-  fTabWidget->show();
-  fEmptyViewerTabLabel->show();
- #endif
-#else
-  fTabWidget->show();
-  fEmptyViewerTabLabel->show();
-#endif
-
-
-#if QT_VERSION >= 0x040000
- #if QT_VERSION >= 0x040200
+  if (fEmptyViewerTabLabel != NULL) {
+    if (fTabWidget->isVisible()) {
+      fEmptyViewerTabLabel->setVisible(false);
+    } else {
+      fEmptyViewerTabLabel->setVisible(true);
+    }
+  }
+
   fMainWindow->setVisible(true);
- #else
-  fMainWindow->show();
- #endif
-#else
-  fMainWindow->show();
-#endif
+  // get the size of the tabbar
+  int tabBarX;
+  int tabBarY;
+#if QT_VERSION < 0x040000
+  tabBarX = fTabWidget->width()-fTabWidget->page(0)->width();
+  tabBarY = fTabWidget->height()-fTabWidget->page(0)->height();
+#else
+  tabBarX = fTabWidget->width()-fTabWidget->widget(0)->width();
+  tabBarY = fTabWidget->height()-fTabWidget->widget(0)->height();
+#endif
+
+  fMainWindow->resize(tabBarX+fMainWindow->width()+fLastQTabSizeX-fTabWidget->width(),tabBarY+fMainWindow->height()+fLastQTabSizeY-fTabWidget->height());
 
 #if QT_VERSION < 0x040000
@@ -1731,7 +1726,7 @@
 #else
   QStringList result = fG4cout.filter(text);
-#endif
-
   fCoutTBTextArea->setPlainText(result.join("\n"));
+#endif
+
   fCoutTBTextArea->repaint();
 #if QT_VERSION < 0x040000
@@ -2092,6 +2087,19 @@
 
   if (fTabWidget->count() == 0) {
+    if (fEmptyViewerTabLabel == NULL) {
+#if QT_VERSION < 0x040000
+      fEmptyViewerTabLabel = new QLabel(fToolBox,"         If you want to have a Viewer, please use /vis/open commands. ");
+#else
+      fEmptyViewerTabLabel = new QLabel("         If you want to have a Viewer, please use /vis/open commands. ");
+#endif
+    }
+
     fMyVSplitter->addWidget(fEmptyViewerTabLabel);
+    fMyVSplitter->show();
+    fEmptyViewerTabLabel->show();
     fTabWidget->setParent(0);
+    fTabWidget->setVisible(false);
+    delete fTabWidget;
+    fTabWidget = NULL;
   }
 #endif
