Ignore:
Timestamp:
May 19, 2010, 5:06:31 PM (14 years ago)
Author:
garnier
Message:

avant commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/interfaces/basic/src/G4UIQt.cc

    r1251 r1252  
    2525//
    2626//
    27 // $Id: G4UIQt.cc,v 1.33 2010/04/27 13:49:02 lgarnier Exp $
     27// $Id: G4UIQt.cc,v 1.36 2010/05/19 07:18:50 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    125125 
    126126  G4UImanager* UI = G4UImanager::GetUIpointer();
     127
     128  // L.Garnier : This statement does not give the good pointer I think
    127129  if(UI!=NULL) UI->SetSession(this);
     130  if(UI!=NULL) UI->SetG4UIWindow(this);
     131
     132  //  if(UI!=NULL) UI->SetG4UIWindow(this);
     133
     134#ifdef G4DEBUG_INTERFACES_BASIC
     135  printf("G4UIQt:: recheck Session : this %d UImanager:%d\n",this,UI);
     136  G4UIQt * uiQt2 =  static_cast<G4UIQt*> (UI->GetG4UIWindow());
     137  printf("G4UIQt:: recheck Session : %d UImanager:%d\n",uiQt2,UI);
     138#endif
    128139
    129140  // Check if already define in external app QMainWindow
     
    157168
    158169#ifdef G4DEBUG_INTERFACES_BASIC
    159   printf("G4UIQt::Initialise after main window creation +++++++++++\n");
     170  printf("G4UIQt::Initialise after main window creation +++++++++++ \n");
    160171#endif
    161172
     
    310321  if(UI!=NULL) UI->SetCoutDestination(this);  // TO KEEP
    311322
    312   interactorManager->SetG4UI(this);
     323//   interactorManager->SetG4UI(this);
    313324
    314325#if QT_VERSION < 0x040000
     
    336347  printf("G4UIQt::G4UIQt END\n");
    337348#endif
     349#ifdef G4DEBUG_INTERFACES_BASIC
     350  printf("G4UIQt:: this : %d UImanager:%d\n",this,UI);
     351#endif
    338352}
    339353
     
    349363  if(UI!=NULL) {  // TO KEEP
    350364    UI->SetSession(NULL);  // TO KEEP
     365    UI->SetG4UIWindow(NULL);  // TO KEEP
    351366    UI->SetCoutDestination(NULL);  // TO KEEP
    352367  }
     
    520535{
    521536#ifdef G4DEBUG_INTERFACES_BASIC
    522   printf("G4UIQt::AddTabWidget %d %d\n",sizeX, sizeY);
     537  printf("G4UIQt::AddTabWidget %d %d G4UIQt:%d fMyVSplitter:%d\n",sizeX, sizeY, this,fMyVSplitter);
    523538#endif
    524539  if (!aWidget) {
     
    568583  // Set visible
    569584#if QT_VERSION >= 0x040000
    570 #if QT_VERSION >= 0x040200
    571   fMainWindow->setVisible(true);
    572 #else
    573   fMainWindow->show();
    574 #endif
    575 #else
     585 #if QT_VERSION >= 0x040200
     586   fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
     587   fMainWindow->setVisible(true);
     588 #else
     589   fTabWidget->setLastTabCreated(fTabWidget->currentIndex());
     590   fMainWindow->show();
     591 #endif
     592#else
     593  fTabWidget->setLastTabCreated(fTabWidget->currentPageIndex());
    576594  fMainWindow->show();
    577595 #endif
     
    605623// //   printf("G4UIQt::AddTabWidget resize ^^^^^^^^^^^^ W:%d + sx:%d -fwx:%d   H:%d + sy:%d -fwy:%d    TabW:%d TabH:%d G4UIQt G4UIQt offX:%d  offY:%d aWX:%d aWY:%d\n",fMainWindow->width(),sizeX,fTabWidget->width(),fMainWindow->height(),sizeY,fTabWidget->height(),fTabWidget->width(),fTabWidget->height(),offX,offY,aWidget->size().height(),aWidget->size().width());
    606624// // #endif
    607 printf("G4UIQt::AddTabWidget  END\n");
    608625// // #endif
    609626 
     
    634651  // This will send a paintEvent to OGL Viewers
    635652  fTabWidget->setTabSelected();
     653
     654  QCoreApplication::sendPostedEvents () ;
    636655
    637656#ifdef G4DEBUG_INTERFACES_BASIC
     
    967986{
    968987
    969 #ifdef G4DEBUG_INTERFACES_BASIC
    970   printf("G4UIQt::InitHelpTree\n");
    971 #endif
    972 
    973988  if (! fHelpTreeWidget ) {
    974989#if QT_VERSION < 0x040000
     
    978993#endif
    979994  }
     995
    980996
    981997  // build widget
     
    10101026void G4UIQt::FillHelpTree()
    10111027{
    1012 #ifdef G4DEBUG_INTERFACES_BASIC
    1013   printf("G4UIQt::FillHelpTree\n");
    1014 #endif
    1015 
    10161028  if (! fHelpTreeWidget ) {
    10171029    InitHelpTree();
     
    10221034  G4UIcommandTree * treeTop = UI->GetTree();
    10231035
    1024 
    1025   // Remove all previous children
    1026   //  fHelpTreeWidget->clear();
    1027 
    10281036  G4int treeSize = treeTop->GetTreeEntry();
    10291037#if QT_VERSION < 0x040000
     
    10341042  QString commandText = "";
    10351043  for (int a=0;a<treeSize;a++) {
    1036 
    10371044    // Creating new item
    10381045    newItem = NULL;
     
    10441051#endif
    10451052
    1046 #ifdef G4DEBUG_INTERFACES_BASIC
    1047     printf("G4UIQt::FillHelpTree for %s\n",commandText.toStdString().c_str());
    1048 #endif
    10491053    // if already exist, don't create it !
    10501054#if QT_VERSION < 0x040000
    1051     QListViewItem* tmpItem = fHelpTreeWidget->firstChild();
    1052     while (tmpItem != 0) {
     1055    QListViewItem* tmpAddItem = fHelpTreeWidget->firstChild();
     1056    while (tmpAddItem != 0) {
    10531057      if (!newItem) {
    1054         newItem = FindTreeItem(tmpItem,commandText);
     1058        newItem = FindTreeItem(tmpAddItem,commandText);
    10551059      }
    1056       tmpItem = tmpItem->nextSibling();
    1057     }
    1058 #else
    1059 #ifdef G4DEBUG_INTERFACES_BASIC
    1060     printf("G4UIQt::FillHelpTree topCount %d\n",fHelpTreeWidget->topLevelItemCount());
    1061 #endif
     1060      tmpAddItem = tmpAddItem->nextSibling();
     1061    }
     1062#else
    10621063    for (int b=0;b<fHelpTreeWidget->topLevelItemCount();b++) {
    10631064      if (!newItem)
     
    10671068
    10681069    if (newItem == NULL) {
    1069 #ifdef G4DEBUG_INTERFACES_BASIC
    1070   printf("G4UIQt::FillHelpTree NOT present\n");
    1071 #endif
    10721070     
    10731071#if QT_VERSION < 0x040000
     
    10781076      newItem->setText(0,GetShortCommandPath(commandText));
    10791077    }
    1080 #ifdef G4DEBUG_INTERFACES_BASIC
    1081     else {
    1082       printf("G4UIQt::FillHelpTree ALREADY present\n");
    1083     }
    1084 #endif
    10851078
    10861079    // look for childs
    10871080    CreateChildTree(newItem,treeTop->GetTree(a+1));
    1088     //      items.append(newItem);
    1089   }
     1081  }
     1082
    10901083}
    10911084
     
    11281121#endif
    11291122   
    1130 #ifdef G4DEBUG_INTERFACES_BASIC
    1131     printf("G4UIQt::CreateChildTree for %s \n",commandText.toStdString().c_str());
    1132 #endif
    11331123    // if already exist, don't create it !
    11341124    newItem = FindTreeItem(aParent,commandText);
    11351125    if (newItem == NULL) {
    1136 #ifdef G4DEBUG_INTERFACES_BASIC
    1137       printf("G4UIQt::CreateChildTree NOT present\n");
    1138 #endif
    11391126#if QT_VERSION < 0x040000
    11401127      newItem = new QListViewItem(aParent);
     
    11441131      newItem->setText(0,GetShortCommandPath(commandText));
    11451132    }
    1146 #ifdef G4DEBUG_INTERFACES_BASIC
    1147     else {
    1148       printf("G4UIQt::CreateChildTree ALREADY present\n");
    1149     }
    1150 #endif
    11511133    CreateChildTree(newItem,aCommandTree->GetTree(a+1));
    11521134  }
     
    12101192  }
    12111193
    1212 #ifdef G4DEBUG_INTERFACES_BASIC
    1213   printf("G4UIQt::FindTreeItem check -%s=%s-\n",myCommand.toStdString().c_str(),GetLongCommandPath(aParent).toStdString().c_str());
    1214 #endif
    12151194  if (GetLongCommandPath(aParent) == myCommand)
    12161195    return aParent;
     
    15341513      SessionTerminate();
    15351514  }
    1536 
    15371515}
    15381516
     
    15721550  QTreeWidgetItem* item =  NULL;
    15731551#endif
    1574 
    15751552  if (!fHelpTreeWidget)
    15761553    return ;
     
    20322009QSplitter*& split
    20332010):QTabWidget(split)
     2011 ,tabSelected(false)
     2012 ,lastCreated(-1)
    20342013{
    20352014}
     
    20372016G4QTabWidget::G4QTabWidget(
    20382017):QTabWidget()
     2018 ,tabSelected(false)
     2019 ,lastCreated(-1)
    20392020{
    20402021}
     
    20432024 
    20442025void G4UIQt::TabCloseCallback(int a){
    2045 #ifdef G4DEBUG_INTERFACES_BASIC
    2046   printf("G4UIQt::TabCloseCallback   %d ---------------------------------\n",a);
    2047 #endif
    20482026  QWidget* temp = fTabWidget->widget(a);
    20492027  fTabWidget->removeTab (a);
     
    20662044    // Rebuild the help tree
    20672045    FillHelpTree();
    2068 
    2069 #ifdef G4DEBUG_INTERFACES_BASIC
    2070     printf("G4UIQt::CurrentChangeCallback   %d ---------------------------------\n",a);
    2071 #endif
    20722046  }
    20732047}
     
    20882062      printf("G4QTabWidget::paintEvent OK\n");
    20892063#endif
     2064#if QT_VERSION < 0x040000
     2065      QString text = label (currentPageIndex());
     2066#else
    20902067      QString text = tabText (currentIndex());
    2091       QString paramSelect = QString("/vis/viewer/select ")+text;
    2092       G4UImanager* UI = G4UImanager::GetUIpointer();
    2093       if(UI!=NULL)  {
    2094         UI->ApplyCommand(paramSelect.toStdString().c_str());
     2068#endif
     2069
     2070      if (lastCreated == -1) {
     2071        QString paramSelect = QString("/vis/viewer/select ")+text;
     2072        G4UImanager* UI = G4UImanager::GetUIpointer();
     2073        if(UI != NULL)  {
     2074          UI->ApplyCommand(paramSelect.toStdString().c_str());
     2075        }
     2076      } else {
     2077        lastCreated = -1;
    20952078      }
    20962079      unselectTab();
Note: See TracChangeset for help on using the changeset viewer.