Changeset 1226


Ignore:
Timestamp:
Dec 18, 2009, 3:17:28 PM (14 years ago)
Author:
garnier
Message:

supp d'une fonction en doublon

Location:
trunk/source/interfaces/basic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/interfaces/basic/include/G4UIQt.hh

    r1224 r1226  
    142142  void CreateCoutTBWidget();
    143143  void CreateHistoryTBWidget();
     144  void OpenHelpTreeOnCommand(const QString &);
    144145
    145146private:
     
    186187  void ShowHelpCallback();
    187188  void CommandHistoryCallback();
    188   void lookForHelpStringCallback();
     189  void LookForHelpStringCallback();
    189190  void UpdateTabWidget(int);
    190191  void ResizeTabWidget( QResizeEvent* );
  • trunk/source/interfaces/basic/src/G4UIQt.cc

    r1224 r1226  
    159159#endif
    160160
    161 #ifdef G4DEBUG_INTERFACES_BASIC
    162   printf("G4UIQt::G4UIQt :: 1\n");
    163 #endif
    164161  QWidget *mainWidget = new QWidget(fMainWindow);
    165162#if QT_VERSION < 0x040000
     
    171168#endif
    172169
    173 #ifdef G4DEBUG_INTERFACES_BASIC
    174   printf("G4UIQt::G4UIQt :: 2\n");
    175 #endif
    176170  // Set layouts
    177171
     
    186180#endif
    187181
    188 #ifdef G4DEBUG_INTERFACES_BASIC
    189   printf("G4UIQt::G4UIQt :: 2b\n");
    190 #endif
    191182  // fill them
    192183
    193184  fCommandLabel = new QLabel("",commandLineWidget);
    194185
    195 #ifdef G4DEBUG_INTERFACES_BASIC
    196   printf("G4UIQt::G4UIQt :: 3\n");
    197 #endif
    198186  fCommandArea = new QLineEdit(commandLineWidget);
    199187  fCommandArea->installEventFilter(this);
     
    212200#endif
    213201
    214 #ifdef G4DEBUG_INTERFACES_BASIC
    215   printf("G4UIQt::G4UIQt :: 4a\n");
    216 #endif
    217202
    218203
     
    230215  fVisParametersTBWidget = new QWidget(fToolBox);
    231216  fViewComponentsTBWidget = new QWidget(fToolBox);
    232 
    233 #ifdef G4DEBUG_INTERFACES_BASIC
    234   printf("G4UIQt::G4UIQt :: 4b\n");
    235 #endif
     217 
    236218  CreateVisParametersTBWidget();
    237 #ifdef G4DEBUG_INTERFACES_BASIC
    238   printf("G4UIQt::G4UIQt :: 4c\n");
    239 #endif
    240   //  CreateViewComponentsTBWidget();
    241 #ifdef G4DEBUG_INTERFACES_BASIC
    242   printf("G4UIQt::G4UIQt :: 4d\n");
    243 #endif
    244   //  CreateHelpTBWidget();
    245 #ifdef G4DEBUG_INTERFACES_BASIC
    246   printf("G4UIQt::G4UIQt :: 4e\n");
    247 #endif
     219  CreateViewComponentsTBWidget();
     220  CreateHelpTBWidget();
    248221  CreateCoutTBWidget();
    249 #ifdef G4DEBUG_INTERFACES_BASIC
    250   printf("G4UIQt::G4UIQt :: 4f\n");
    251 #endif
    252222  CreateHistoryTBWidget();
    253 #ifdef G4DEBUG_INTERFACES_BASIC
    254   printf("G4UIQt::G4UIQt :: 4g\n");
    255 #endif
    256223
    257224  // the splitter
    258225  fToolBox->addItem(fVisParametersTBWidget,"Vis parameters");
    259 #ifdef G4DEBUG_INTERFACES_BASIC
    260   printf("G4UIQt::G4UIQt :: 4h\n");
    261 #endif
    262226  fToolBox->addItem(fViewComponentsTBWidget,"Viewer components");
    263 #ifdef G4DEBUG_INTERFACES_BASIC
    264   printf("G4UIQt::G4UIQt :: 4i\n");
    265 #endif
    266227  fToolBox->addItem(fHelpTBWidget,"Help");
    267 #ifdef G4DEBUG_INTERFACES_BASIC
    268   printf("G4UIQt::G4UIQt :: 4j\n");
    269 #endif
    270228  fToolBox->addItem(fCoutTBWidget,"Cout");
    271 #ifdef G4DEBUG_INTERFACES_BASIC
    272   printf("G4UIQt::G4UIQt :: 4k\n");
    273 #endif
    274229  fToolBox->addItem(fHistoryTBWidget,"History");
    275 #ifdef G4DEBUG_INTERFACES_BASIC
    276   printf("G4UIQt::G4UIQt :: 4l\n");
    277 #endif
    278230
    279231
     
    421373#if QT_VERSION < 0x040000
    422374  helpLayout->add(helpLine);
    423   connect( helpLine, SIGNAL( returnPressed () ), this, SLOT( lookForHelpStringCallback() ) );
     375  connect( helpLine, SIGNAL( returnPressed () ), this, SLOT( LookForHelpStringCallback() ) );
    424376#else
    425377  helpLayout->addWidget(helpLine);
    426   connect( helpLine, SIGNAL( editingFinished () ), this, SLOT( lookForHelpStringCallback() ) );
     378  connect( helpLine, SIGNAL( editingFinished () ), this, SLOT( LookForHelpStringCallback() ) );
    427379#endif
    428380 
     
    874826  // Look for the choosen command "newCommand"
    875827  size_t i = newCommand.index(" ");
    876   G4String targetCom="";
     828  G4String targetCom ="";
    877829  if( i != std::string::npos )
    878830    {
     
    881833      targetCom = ModifyToFullPathCommand( newValue );
    882834    }
     835#ifdef G4DEBUG_INTERFACES_BASIC
     836  printf("G4UIQt::ActivateCommand found : %d \n",targetCom.data());
     837#endif
    883838  if (targetCom != "") {
    884 #if QT_VERSION < 0x040000
    885     QListViewItem* findItem = NULL;
    886     QListViewItem* tmpItem = fHelpTreeWidget->firstChild();
    887     while (tmpItem != 0) {
    888       if (!findItem) {
    889         findItem = FindTreeItem(tmpItem,QString((char*)targetCom.data()));
    890       }
    891       tmpItem = tmpItem->nextSibling();
    892     }
    893 #else
    894     QTreeWidgetItem* findItem = NULL;
    895     for (int a=0;a<fHelpTreeWidget->topLevelItemCount();a++) {
    896       if (!findItem) {
    897         findItem = FindTreeItem(fHelpTreeWidget->topLevelItem(a),QString((char*)targetCom.data()));
    898       }
    899     }
    900 #endif
    901    
    902     if (findItem) {     
    903      
    904       //collapsed open item
    905 #if QT_VERSION < 0x040000
    906 
    907       // FIXME : Has to be checked
    908       QListViewItem* tmpItem = fHelpTreeWidget->firstChild();
    909       QList<QListViewItem> openItems;
    910       while ((tmpItem != 0) || (!openItems.isEmpty())) {
    911         if (tmpItem->isOpen() ) {
    912           tmpItem->setOpen(false);
    913           openItems.append(tmpItem);
    914           tmpItem = tmpItem->firstChild();
    915         } else {
    916           tmpItem = tmpItem->nextSibling();
    917         }
    918         if (tmpItem == 0) {
    919           tmpItem = openItems.take(openItems.count()-1);
    920         }
    921       }
    922 #else
    923       QList<QTreeWidgetItem *> selected;
    924 
    925       selected = fHelpTreeWidget->selectedItems();
    926       if ( selected.count() != 0 ) {
    927         QTreeWidgetItem * tmp =selected.at( 0 );
    928         while ( tmp) {
    929 #if QT_VERSION < 0x040202
    930               fHelpTreeWidget->setItemExpanded(tmp,false);
    931 #else
    932           tmp->setExpanded(false);
    933 #endif
    934           tmp = tmp->parent();
    935         }
    936       }
    937 #endif
    938      
    939       // clear old selection
    940       fHelpTreeWidget->clearSelection();
    941 
    942       // set new selection
    943 #if QT_VERSION >= 0x040000
    944 #if QT_VERSION < 0x040202
    945       fHelpTreeWidget->setItemSelected(findItem,true);
    946 #else
    947       findItem->setSelected(true);
    948 #endif     
    949 #else
    950       findItem->setSelected(true);
    951 #endif
    952      
    953       // expand parent item
    954       while ( findItem) {
    955 #if QT_VERSION < 0x040000
    956         findItem->setOpen(true);
    957 #else
    958 #if QT_VERSION < 0x040202
    959             fHelpTreeWidget->setItemExpanded(findItem,true);
    960 #else
    961         findItem->setExpanded(true);
    962 #endif
    963 #endif
    964         findItem = findItem->parent();
    965       }
    966 
    967       // Call the update of the right textArea
    968       HelpTreeClicCallback();
    969     }
    970   }
     839    OpenHelpTreeOnCommand(targetCom.data());
     840  }
     841
    971842  fToolBox->setCurrentWidget(fHelpTBWidget);
    972843}
     
    16341505   will display the complete help tree
    16351506*/
    1636 void G4UIQt::lookForHelpStringCallback(
    1637 )
    1638 {
     1507void G4UIQt::LookForHelpStringCallback(
     1508)
     1509{
     1510  QString searchText = helpLine->text();
     1511
    16391512#if QT_VERSION < 0x040200
    16401513  fHelpArea->clear();
     
    16421515  fHelpArea->setText("");
    16431516#endif
    1644   if (helpLine->text() =="") {
     1517  if (searchText =="") {
    16451518    // clear old help tree
    16461519    fHelpTreeWidget->clear();
     
    16511524    CreateHelpTree();
    16521525    return;
    1653   }
     1526  } else {
     1527    OpenHelpTreeOnCommand(searchText);
     1528  }
     1529}
     1530
     1531
     1532void G4UIQt::OpenHelpTreeOnCommand(
     1533 const QString & searchText
     1534)
     1535{
    16541536
    16551537  // the help tree
     
    16811563    G4UIcommand* command = treeTop->FindPath(treeTop->GetTree(a+1)->GetPathName().data());
    16821564#if QT_VERSION > 0x040000
    1683     tmp = GetCommandList (command).count(helpLine->text(),Qt::CaseInsensitive);
    1684 #else
    1685     tmp = GetCommandList (command).contains(helpLine->text(),false);
     1565    tmp = GetCommandList (command).count(searchText,Qt::CaseInsensitive);
     1566#else
     1567    tmp = GetCommandList (command).contains(searchText,false);
    16861568#endif
    16871569    if (tmp >0) {
     
    16971579    }
    16981580    // look for childs
    1699     commandChildResultMap = LookForHelpStringInChildTree(treeTop->GetTree(a+1),helpLine->text());
     1581    commandChildResultMap = LookForHelpStringInChildTree(treeTop->GetTree(a+1),searchText);
    17001582    // insert new childs
    17011583    if (!commandChildResultMap.empty()) {
Note: See TracChangeset for help on using the changeset viewer.