Changeset 510 for trunk/geant4/interfaces
- Timestamp:
- Jun 14, 2007, 5:39:52 PM (17 years ago)
- Location:
- trunk/geant4/interfaces/basic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/interfaces/basic/include/G4UIQt.hh
r509 r510 127 127 void commandEnteredCallback(); 128 128 void buttonCallback(const QString&); 129 void helpTreeCallback( const QString&);129 void helpTreeCallback( QTreeWidgetItem*, int); 130 130 }; 131 131 -
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r509 r510 493 493 494 494 QSplitter *splitter = new QSplitter(Qt::Horizontal); 495 QTextEdit *fhelpArea = new QTextEdit();495 fHelpArea = new QTextEdit(); 496 496 QPushButton *exitButton = new QPushButton("Exit"); 497 497 connect(exitButton, SIGNAL(clicked()), helpDialog,SLOT(close())); … … 512 512 G4int treeSize = treeTop->GetTreeEntry(); 513 513 QTreeWidgetItem * newItem; 514 for ( unsignedint a=0;a<treeSize;a++) {514 for (int a=0;a<treeSize;a++) { 515 515 // Creating new item 516 516 QStringList stringList; … … 527 527 treeWidget->insertTopLevelItems(0, items); 528 528 529 //connecting callback 530 signalMapper = new QSignalMapper(this); 531 connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)),this, SLOT(helpTreeCallback(QTreeWidgetItem*, int))); 529 532 530 533 // Set layouts 531 534 QHBoxLayout *splitterLayout = new QHBoxLayout; 532 535 533 QWidget* topWidget = new QWidget();534 536 QVBoxLayout *vLayout = new QVBoxLayout; 535 537 … … 627 629 QTreeWidgetItem * newItem; 628 630 629 // QSignalMapper *signalMapper = new QSignalMapper(this);630 631 631 632 // Get the Sub directories 632 for ( unsignedint a=0;a<a_commandTree->GetTreeEntry();a++) {633 for (int a=0;a<a_commandTree->GetTreeEntry();a++) { 633 634 634 635 QStringList stringList; … … 653 654 // Get the Commands 654 655 655 for ( unsignedint a=0;a<a_commandTree->GetCommandEntry();a++) {656 for (int a=0;a<a_commandTree->GetCommandEntry();a++) { 656 657 657 658 QStringList stringList; 658 stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetCommand Name()).data()).trimmed() ;659 stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed() ; 659 660 stringList << QString((char*)(a_commandTree->GetCommand(a+1)->GetTitle()).data()).trimmed() ; 660 661 newItem = new QTreeWidgetItem(stringList); 661 662 //connecting callback663 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&)));667 662 668 663 a_parent->addChild(newItem); … … 678 673 /***************************************************************************/ 679 674 void 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 } 686 693 } 687 694 … … 695 702 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 696 703 { 704 printf ("G4UIQt::CreateChildTree %s --\n",(char*)(a_command->GetCommandName()).data()) ; 705 697 706 QString txt; 698 707 G4String commandPath = a_command->GetCommandPath();
Note: See TracChangeset
for help on using the changeset viewer.