Changeset 510 for trunk/geant4


Ignore:
Timestamp:
Jun 14, 2007, 5:39:52 PM (17 years ago)
Author:
garnier
Message:

r620@mac-90108: laurentgarnier | 2007-06-14 15:18:02 +0200
une version qui marche

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

Legend:

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

    r509 r510  
    127127  void commandEnteredCallback();
    128128  void buttonCallback(const QString&);
    129   void helpTreeCallback(const QString&);
     129  void helpTreeCallback( QTreeWidgetItem*, int);
    130130};
    131131
  • trunk/geant4/interfaces/basic/src/G4UIQt.cc

    r509 r510  
    493493
    494494  QSplitter *splitter = new QSplitter(Qt::Horizontal);
    495   QTextEdit *fhelpArea = new QTextEdit();
     495  fHelpArea = new QTextEdit();
    496496  QPushButton *exitButton = new QPushButton("Exit");
    497497  connect(exitButton, SIGNAL(clicked()), helpDialog,SLOT(close()));
     
    512512  G4int treeSize = treeTop->GetTreeEntry();
    513513  QTreeWidgetItem * newItem;
    514   for (unsigned int a=0;a<treeSize;a++) {
     514  for (int a=0;a<treeSize;a++) {
    515515    // Creating new item
    516516    QStringList stringList;
     
    527527  treeWidget->insertTopLevelItems(0, items);
    528528
     529  //connecting callback
     530  signalMapper = new QSignalMapper(this);
     531  connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)),this, SLOT(helpTreeCallback(QTreeWidgetItem*, int))); 
    529532
    530533  // Set layouts
    531534  QHBoxLayout *splitterLayout = new QHBoxLayout;
    532535
    533   QWidget* topWidget = new QWidget();
    534536  QVBoxLayout *vLayout = new QVBoxLayout;
    535537
     
    627629  QTreeWidgetItem * newItem;
    628630
    629   //  QSignalMapper *signalMapper = new QSignalMapper(this);
    630631
    631632  // Get the Sub directories
    632   for (unsigned int a=0;a<a_commandTree->GetTreeEntry();a++) {
     633  for (int a=0;a<a_commandTree->GetTreeEntry();a++) {
    633634   
    634635    QStringList stringList;
     
    653654  // Get the Commands
    654655
    655   for (unsigned int a=0;a<a_commandTree->GetCommandEntry();a++) {
     656  for (int a=0;a<a_commandTree->GetCommandEntry();a++) {
    656657   
    657658    QStringList stringList;
    658     stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetCommandName()).data()).trimmed()  ;
     659    stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed()  ;
    659660    stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetTitle()).data()).trimmed()  ;
    660661    newItem = new QTreeWidgetItem(stringList);
    661 
    662     //connecting callback
    663     signalMapper = new QSignalMapper(this);
    664     connect(newItem, SIGNAL(itemActivated(QTreeWidgetItem*, int)), signalMapper, SLOT(map()));
    665     signalMapper->setMapping(newItem, GetCommandList(a_commandTree->GetCommand(a+1)));
    666     connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(helpTreeCallback(const QString&)));
    667662     
    668663    a_parent->addChild(newItem);
     
    678673/***************************************************************************/
    679674void G4UIQt::helpTreeCallback (
    680   const QString & a_txt
    681 )
    682 /***************************************************************************/
    683 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    684 {
    685   fHelpArea->setText(a_txt);
     675 QTreeWidgetItem* a_treeItem
     676,int a_index
     677)
     678/***************************************************************************/
     679/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
     680{
     681  if (fHelpArea) {
     682    G4UImanager* UI = G4UImanager::GetUIpointer();
     683    if(UI==NULL) return;
     684    G4UIcommandTree * treeTop = UI->GetTree();
     685    G4UIcommand* command = treeTop->FindPath(a_treeItem->text (0).toStdString().c_str());
     686    if (command) {
     687      printf ("G4UIQt::CreateChildTree  end of for loop ========\n");
     688      fHelpArea->setText(GetCommandList(treeTop->FindPath(a_treeItem->text (0).toStdString().c_str())));
     689    } else {
     690      printf ("G4UIQt::CreateChildTree  end of for loop ********\n");
     691    }
     692  }
    686693}
    687694
     
    695702/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    696703{
     704  printf ("G4UIQt::CreateChildTree  %s --\n",(char*)(a_command->GetCommandName()).data())  ;
     705
    697706  QString txt;
    698707  G4String commandPath = a_command->GetCommandPath();
Note: See TracChangeset for help on using the changeset viewer.