Changeset 1250 for trunk


Ignore:
Timestamp:
May 6, 2010, 5:49:48 PM (14 years ago)
Author:
garnier
Message:

HelpTree compil mais ne marche pas

File:
1 edited

Legend:

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

    r1249 r1250  
    10141014#endif
    10151015
    1016   QString defaultSelection = "";
    1017 
    10181016  if (! fHelpTreeWidget ) {
    10191017    InitHelpTree();
    1020   } else {
    1021     // Memorise previous selection
    1022     if (fHelpTreeWidget->currentItem() != NULL) {
    1023       defaultSelection = fHelpTreeWidget->currentItem()->text(0);
    1024     }
    1025   }
     1018  }
     1019
    10261020  G4UImanager* UI = G4UImanager::GetUIpointer();
    10271021  if(UI==NULL) return;
     
    10301024
    10311025  // Remove all previous children
    1032   fHelpTreeWidget->clear();
     1026  //  fHelpTreeWidget->clear();
    10331027
    10341028  G4int treeSize = treeTop->GetTreeEntry();
    10351029#if QT_VERSION < 0x040000
    1036   QListViewItem * newItem;
    1037   QListViewItem * defaultItem;
    1038 #else
    1039   QTreeWidgetItem * newItem;
    1040   QTreeWidgetItem * defaultItem;
    1041 #endif
     1030  QListViewItem * newItem = NULL;
     1031#else
     1032  QTreeWidgetItem * newItem = NULL;
     1033#endif
     1034  QString commandText = "";
    10421035  for (int a=0;a<treeSize;a++) {
     1036#ifdef G4DEBUG_INTERFACES_BASIC
     1037  printf("G4UIQt::FillHelpTree for\n");
     1038#endif
    10431039    // Creating new item
    10441040
    10451041#if QT_VERSION < 0x040000
    1046     newItem = new QListViewItem(fHelpTreeWidget);
    1047     newItem->setText(0,GetShortCommandPath(QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace()));
    1048 #else
    1049     newItem = new QTreeWidgetItem(fHelpTreeWidget);
    1050     newItem->setText(0,GetShortCommandPath(QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).trimmed()));
    1051 #endif
    1052 
     1042    commandText = QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace();
     1043#else
     1044    commandText = QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()).trimmed();
     1045#endif
     1046
     1047    // if already exist, don't create it !
     1048#if QT_VERSION < 0x040000
     1049    QListViewItem* tmpItem = fHelpTreeWidget->firstChild();
     1050    while (tmpItem != 0) {
     1051      if (!newItem) {
     1052        newItem = FindTreeItem(tmpItem,commandText);
     1053      }
     1054      tmpItem = tmpItem->nextSibling();
     1055    }
     1056#else
     1057    for (int b=0;a<fHelpTreeWidget->topLevelItemCount();b++) {
     1058      if (!newItem)
     1059        newItem = FindTreeItem(fHelpTreeWidget->topLevelItem(b),commandText);
     1060    }
     1061#endif
     1062
     1063    if (newItem == NULL) {
     1064#ifdef G4DEBUG_INTERFACES_BASIC
     1065  printf("G4UIQt::FillHelpTree check already present\n");
     1066#endif
     1067     
     1068#if QT_VERSION < 0x040000
     1069      newItem = new QListViewItem(fHelpTreeWidget);
     1070#else
     1071      newItem = new QTreeWidgetItem(fHelpTreeWidget);
     1072#endif
     1073      newItem->setText(0,GetShortCommandPath(commandText));
     1074    }
    10531075
    10541076    // look for childs
    10551077    CreateChildTree(newItem,treeTop->GetTree(a+1));
    10561078    //      items.append(newItem);
    1057     if (defaultSelection != "") {
    1058       defaultItem = FindTreeItem(newItem,defaultSelection);
    1059       if (defaultItem != NULL ) {
    1060         defaultItem->setSelected(true);
    1061         while (defaultItem->parent() != NULL) {
    1062           defaultItem = defaultItem->parent();
    1063           defaultItem->setExpanded(true);
    1064         }
    1065       }
    1066     }
    10671079  }
    10681080}
     
    10961108#endif
    10971109
     1110  QString commandText = "";
    10981111  // Get the Sub directories
    10991112  for (int a=0;a<aCommandTree->GetTreeEntry();a++) {
    1100 
     1113#ifdef G4DEBUG_INTERFACES_BASIC
     1114  printf("G4UIQt::CreateChildTree for\n");
     1115#endif
     1116
     1117#if QT_VERSION < 0x040000
     1118    commandText = QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace();
     1119#else
     1120    commandText = QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).trimmed();
     1121#endif
     1122   
     1123    // if already exist, don't create it !
     1124    newItem = FindTreeItem(aParent,commandText);
     1125    if (newItem == NULL) {
     1126#ifdef G4DEBUG_INTERFACES_BASIC
     1127  printf("G4UIQt::CreateChildTree check already present\n");
     1128#endif
    11011129#if QT_VERSION < 0x040000
    11021130      newItem = new QListViewItem(aParent);
    1103       newItem->setText(0,GetShortCommandPath(QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).simplifyWhiteSpace()));
    1104 
    1105 #else
    1106     newItem = new QTreeWidgetItem(aParent);
    1107     newItem->setText(0,GetShortCommandPath(QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data()).trimmed()));
    1108 #endif
    1109 
     1131#else
     1132      newItem = new QTreeWidgetItem(aParent);
     1133#endif
     1134      newItem->setText(0,GetShortCommandPath(commandText));
     1135    }
    11101136    CreateChildTree(newItem,aCommandTree->GetTree(a+1));
    11111137  }
     
    11531179  if (aParent == NULL) return NULL;
    11541180
    1155   if (aParent->text(0) == aCommand)
     1181  if (GetLongCommandPath(aParent) == aCommand)
    11561182    return aParent;
    11571183 
     
    11641190      tmpItem = tmpItem->nextSibling();
    11651191    }
    1166 
    11671192#else
    11681193  QTreeWidgetItem * tmp = NULL;
     
    19611986  itemText = item->text(0);
    19621987
    1963 #ifdef G4DEBUG_INTERFACES_BASIC
    1964   printf("G4UIQt::HelpTreeClicCallback text:%s\n",item->text(0).toStdString().c_str());
    1965 #endif
    19661988  while (item->parent() != NULL) {
    19671989    itemText = item->parent()->text(0)+"/"+itemText;
Note: See TracChangeset for help on using the changeset viewer.