Changeset 1252
- Timestamp:
- May 19, 2010, 5:06:31 PM (14 years ago)
- Location:
- trunk/source/interfaces
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/interfaces/History
r1248 r1252 1 $Id: History,v 1.1 27 2010/04/26 15:46:00 lgarnier Exp $1 $Id: History,v 1.132 2010/05/19 07:18:50 lgarnier Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 18 18 ---------------------------------------------------------- 19 19 20 19 May, L. Garnier 21 - G4UIQt: Fix a warning in Cout during viewer creation 22 Fix a flush problem at viewer creation 23 24 18 May, L. Garnier 25 - G4UIQt: Fix an output warning 26 27 11 May, J.Allison (interfaces-V09-03-01) 28 - Tagged interfaces-V09-03-01. (Note: interfaces-V09-03-00 already 29 used on a patch branch.) 30 31 7 May, L. Garnier 32 - G4UIQt: Add new command in help tree will update immediatly the help tree 33 (removing a command not code yet) 34 20 35 26 April, L. Garnier 21 36 - G4UIQt: Improvments -
trunk/source/interfaces/basic/include/G4UIQt.hh
r1249 r1252 25 25 // 26 26 // 27 // $Id: G4UIQt.hh,v 1. 18 2010/04/26 15:46:00 lgarnier Exp $27 // $Id: G4UIQt.hh,v 1.20 2010/05/19 07:18:50 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 87 87 void paintEvent ( QPaintEvent * event ); 88 88 inline void setTabSelected() { tabSelected = true; }; 89 inline void setLastTabCreated(int a) { lastCreated = a; }; 89 90 inline void unselectTab() { tabSelected = false; }; 90 91 inline bool isTabSelected() { return tabSelected; }; 91 92 bool tabSelected; 93 int lastCreated; 92 94 }; 93 95 -
trunk/source/interfaces/basic/src/G4UIQt.cc
r1251 r1252 25 25 // 26 26 // 27 // $Id: G4UIQt.cc,v 1.3 3 2010/04/27 13:49:02lgarnier Exp $27 // $Id: G4UIQt.cc,v 1.36 2010/05/19 07:18:50 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 125 125 126 126 G4UImanager* UI = G4UImanager::GetUIpointer(); 127 128 // L.Garnier : This statement does not give the good pointer I think 127 129 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 128 139 129 140 // Check if already define in external app QMainWindow … … 157 168 158 169 #ifdef G4DEBUG_INTERFACES_BASIC 159 printf("G4UIQt::Initialise after main window creation +++++++++++ \n");170 printf("G4UIQt::Initialise after main window creation +++++++++++ \n"); 160 171 #endif 161 172 … … 310 321 if(UI!=NULL) UI->SetCoutDestination(this); // TO KEEP 311 322 312 interactorManager->SetG4UI(this);323 // interactorManager->SetG4UI(this); 313 324 314 325 #if QT_VERSION < 0x040000 … … 336 347 printf("G4UIQt::G4UIQt END\n"); 337 348 #endif 349 #ifdef G4DEBUG_INTERFACES_BASIC 350 printf("G4UIQt:: this : %d UImanager:%d\n",this,UI); 351 #endif 338 352 } 339 353 … … 349 363 if(UI!=NULL) { // TO KEEP 350 364 UI->SetSession(NULL); // TO KEEP 365 UI->SetG4UIWindow(NULL); // TO KEEP 351 366 UI->SetCoutDestination(NULL); // TO KEEP 352 367 } … … 520 535 { 521 536 #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); 523 538 #endif 524 539 if (!aWidget) { … … 568 583 // Set visible 569 584 #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()); 576 594 fMainWindow->show(); 577 595 #endif … … 605 623 // // 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()); 606 624 // // #endif 607 printf("G4UIQt::AddTabWidget END\n");608 625 // // #endif 609 626 … … 634 651 // This will send a paintEvent to OGL Viewers 635 652 fTabWidget->setTabSelected(); 653 654 QCoreApplication::sendPostedEvents () ; 636 655 637 656 #ifdef G4DEBUG_INTERFACES_BASIC … … 967 986 { 968 987 969 #ifdef G4DEBUG_INTERFACES_BASIC970 printf("G4UIQt::InitHelpTree\n");971 #endif972 973 988 if (! fHelpTreeWidget ) { 974 989 #if QT_VERSION < 0x040000 … … 978 993 #endif 979 994 } 995 980 996 981 997 // build widget … … 1010 1026 void G4UIQt::FillHelpTree() 1011 1027 { 1012 #ifdef G4DEBUG_INTERFACES_BASIC1013 printf("G4UIQt::FillHelpTree\n");1014 #endif1015 1016 1028 if (! fHelpTreeWidget ) { 1017 1029 InitHelpTree(); … … 1022 1034 G4UIcommandTree * treeTop = UI->GetTree(); 1023 1035 1024 1025 // Remove all previous children1026 // fHelpTreeWidget->clear();1027 1028 1036 G4int treeSize = treeTop->GetTreeEntry(); 1029 1037 #if QT_VERSION < 0x040000 … … 1034 1042 QString commandText = ""; 1035 1043 for (int a=0;a<treeSize;a++) { 1036 1037 1044 // Creating new item 1038 1045 newItem = NULL; … … 1044 1051 #endif 1045 1052 1046 #ifdef G4DEBUG_INTERFACES_BASIC1047 printf("G4UIQt::FillHelpTree for %s\n",commandText.toStdString().c_str());1048 #endif1049 1053 // if already exist, don't create it ! 1050 1054 #if QT_VERSION < 0x040000 1051 QListViewItem* tmp Item = fHelpTreeWidget->firstChild();1052 while (tmp Item != 0) {1055 QListViewItem* tmpAddItem = fHelpTreeWidget->firstChild(); 1056 while (tmpAddItem != 0) { 1053 1057 if (!newItem) { 1054 newItem = FindTreeItem(tmp Item,commandText);1058 newItem = FindTreeItem(tmpAddItem,commandText); 1055 1059 } 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 1062 1063 for (int b=0;b<fHelpTreeWidget->topLevelItemCount();b++) { 1063 1064 if (!newItem) … … 1067 1068 1068 1069 if (newItem == NULL) { 1069 #ifdef G4DEBUG_INTERFACES_BASIC1070 printf("G4UIQt::FillHelpTree NOT present\n");1071 #endif1072 1070 1073 1071 #if QT_VERSION < 0x040000 … … 1078 1076 newItem->setText(0,GetShortCommandPath(commandText)); 1079 1077 } 1080 #ifdef G4DEBUG_INTERFACES_BASIC1081 else {1082 printf("G4UIQt::FillHelpTree ALREADY present\n");1083 }1084 #endif1085 1078 1086 1079 // look for childs 1087 1080 CreateChildTree(newItem,treeTop->GetTree(a+1)); 1088 // items.append(newItem);1089 } 1081 } 1082 1090 1083 } 1091 1084 … … 1128 1121 #endif 1129 1122 1130 #ifdef G4DEBUG_INTERFACES_BASIC1131 printf("G4UIQt::CreateChildTree for %s \n",commandText.toStdString().c_str());1132 #endif1133 1123 // if already exist, don't create it ! 1134 1124 newItem = FindTreeItem(aParent,commandText); 1135 1125 if (newItem == NULL) { 1136 #ifdef G4DEBUG_INTERFACES_BASIC1137 printf("G4UIQt::CreateChildTree NOT present\n");1138 #endif1139 1126 #if QT_VERSION < 0x040000 1140 1127 newItem = new QListViewItem(aParent); … … 1144 1131 newItem->setText(0,GetShortCommandPath(commandText)); 1145 1132 } 1146 #ifdef G4DEBUG_INTERFACES_BASIC1147 else {1148 printf("G4UIQt::CreateChildTree ALREADY present\n");1149 }1150 #endif1151 1133 CreateChildTree(newItem,aCommandTree->GetTree(a+1)); 1152 1134 } … … 1210 1192 } 1211 1193 1212 #ifdef G4DEBUG_INTERFACES_BASIC1213 printf("G4UIQt::FindTreeItem check -%s=%s-\n",myCommand.toStdString().c_str(),GetLongCommandPath(aParent).toStdString().c_str());1214 #endif1215 1194 if (GetLongCommandPath(aParent) == myCommand) 1216 1195 return aParent; … … 1534 1513 SessionTerminate(); 1535 1514 } 1536 1537 1515 } 1538 1516 … … 1572 1550 QTreeWidgetItem* item = NULL; 1573 1551 #endif 1574 1575 1552 if (!fHelpTreeWidget) 1576 1553 return ; … … 2032 2009 QSplitter*& split 2033 2010 ):QTabWidget(split) 2011 ,tabSelected(false) 2012 ,lastCreated(-1) 2034 2013 { 2035 2014 } … … 2037 2016 G4QTabWidget::G4QTabWidget( 2038 2017 ):QTabWidget() 2018 ,tabSelected(false) 2019 ,lastCreated(-1) 2039 2020 { 2040 2021 } … … 2043 2024 2044 2025 void G4UIQt::TabCloseCallback(int a){ 2045 #ifdef G4DEBUG_INTERFACES_BASIC2046 printf("G4UIQt::TabCloseCallback %d ---------------------------------\n",a);2047 #endif2048 2026 QWidget* temp = fTabWidget->widget(a); 2049 2027 fTabWidget->removeTab (a); … … 2066 2044 // Rebuild the help tree 2067 2045 FillHelpTree(); 2068 2069 #ifdef G4DEBUG_INTERFACES_BASIC2070 printf("G4UIQt::CurrentChangeCallback %d ---------------------------------\n",a);2071 #endif2072 2046 } 2073 2047 } … … 2088 2062 printf("G4QTabWidget::paintEvent OK\n"); 2089 2063 #endif 2064 #if QT_VERSION < 0x040000 2065 QString text = label (currentPageIndex()); 2066 #else 2090 2067 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; 2095 2078 } 2096 2079 unselectTab(); -
trunk/source/interfaces/common/include/G4Qt.hh
r1228 r1252 39 39 #include "G4VInteractorManager.hh" 40 40 41 class G4UIQt;41 // class G4UIQt; 42 42 class QWidget; 43 43 class QString; … … 60 60 void FlushAndWaitExecution(); 61 61 virtual ~G4Qt(); 62 bool AddTabWidget(QWidget*,QString,int,int);63 void SetG4UI(G4UIQt*);62 // bool AddTabWidget(QWidget*,QString,int,int); 63 // void SetG4UI(G4UIQt*); 64 64 65 65 private: … … 68 68 int argn; 69 69 char** args; 70 G4UIQt* fG4UI;70 // G4UIQt* fG4UI; 71 71 }; 72 72 -
trunk/source/interfaces/common/src/G4Qt.cc
r1248 r1252 38 38 39 39 #include "G4Qt.hh" 40 #include "G4UIQt.hh"40 // #include "G4UIQt.hh" 41 41 #include <qwidget.h> 42 42 … … 76 76 ,char* /*a_class */ 77 77 ) 78 :fG4UI(NULL)78 // :fG4UI(NULL) 79 79 /***************************************************************************/ 80 80 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ … … 207 207 } 208 208 209 / ***************************************************************************/210 void G4Qt::SetG4UI (211 G4UIQt* ui212 )213 / ***************************************************************************/214 / *!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/215 {216 #ifdef G4DEBUG_INTERFACES_COMMON217 printf("G4Qt::SetG4UI \n");218 #endif219 fG4UI = ui;220 }221 222 / ***************************************************************************/223 bool G4Qt::AddTabWidget (224 QWidget * vis225 ,QString name226 ,int sizeX227 ,int sizeY228 )229 / ***************************************************************************/230 / *!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/231 {232 if (fG4UI != NULL) {233 return fG4UI->AddTabWidget(vis,name,sizeX,sizeY);234 }235 return false;236 }237 #endif 238 239 209 // /***************************************************************************/ 210 // void G4Qt::SetG4UI ( 211 // G4UIQt* ui 212 // ) 213 // /***************************************************************************/ 214 // /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 215 // { 216 // #ifdef G4DEBUG_INTERFACES_COMMON 217 // printf("G4Qt::SetG4UI \n"); 218 // #endif 219 // fG4UI = ui; 220 // } 221 222 // /***************************************************************************/ 223 // bool G4Qt::AddTabWidget ( 224 // QWidget * vis 225 // ,QString name 226 // ,int sizeX 227 // ,int sizeY 228 // ) 229 // /***************************************************************************/ 230 // /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 231 // { 232 // if (fG4UI != NULL) { 233 // // return fG4UI->AddTabWidget(vis,name,sizeX,sizeY); 234 // } 235 // return false; 236 // } 237 #endif 238 239
Note: See TracChangeset
for help on using the changeset viewer.