- Timestamp:
- Jun 14, 2007, 5:39:50 PM (17 years ago)
- Location:
- trunk/geant4/interfaces/basic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/interfaces/basic/include/G4UIQt.hh
r507 r509 101 101 void TerminalHelp(G4String); 102 102 void CreateChildTree(QTreeWidgetItem*,G4UIcommandTree*); 103 QString GetCommandList(G4UIcommand*); 103 104 104 105 void ExitHelp(); … … 115 116 QLineEdit * fCommandArea; 116 117 QTextEdit *fTextArea; 118 QTextEdit *fHelpArea; 117 119 QTextEdit *fCommandHistoryArea; 118 120 QSignalMapper *signalMapper ; … … 125 127 void commandEnteredCallback(); 126 128 void buttonCallback(const QString&); 129 void helpTreeCallback(const QString&); 127 130 }; 128 131 -
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r508 r509 493 493 494 494 QSplitter *splitter = new QSplitter(Qt::Horizontal); 495 QTextEdit * textArea = new QTextEdit();495 QTextEdit *fhelpArea = new QTextEdit(); 496 496 QPushButton *exitButton = new QPushButton("Exit"); 497 497 connect(exitButton, SIGNAL(clicked()), helpDialog,SLOT(close())); 498 textArea->setReadOnly(true);498 fHelpArea->setReadOnly(true); 499 499 500 500 // the help tree … … 535 535 536 536 splitterLayout->addWidget(treeWidget); 537 splitterLayout->addWidget( textArea);537 splitterLayout->addWidget(fHelpArea); 538 538 splitter->setLayout(splitterLayout); 539 539 … … 661 661 662 662 //connecting callback 663 // signalMapper = new QSignalMapper(this); 664 // QAction *action = parent->addAction(a_label, signalMapper, SLOT(map())); 665 666 // signalMapper->setMapping(action, QString(a_command)); 667 // connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(helpTreeCallback(const QString&))); 668 //QTreeWidget::itemActivated ( QTreeWidgetItem * item, int column ) [signal] 669 670 // CreateChildTree(newItem,a_commandTree->GetCommand(a+1)); 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&))); 667 671 668 a_parent->addChild(newItem); 672 669 … … 675 672 printf ("G4UIQt::CreateChildTree end of for loop\n"); 676 673 } 674 675 /** 676 This callback is activated when user selected a item in the help tree 677 */ 678 /***************************************************************************/ 679 void G4UIQt::helpTreeCallback ( 680 const QString & a_txt 681 ) 682 /***************************************************************************/ 683 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 684 { 685 fHelpArea->setText(a_txt); 686 } 687 688 /** 689 */ 690 /***************************************************************************/ 691 QString G4UIQt::GetCommandList ( 692 G4UIcommand *a_command 693 ) 694 /***************************************************************************/ 695 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 696 { 697 QString txt; 698 G4String commandPath = a_command->GetCommandPath(); 699 G4String rangeString = a_command->GetRange(); 700 701 if((commandPath.length()-1)!='/') 702 { 703 txt += "Command " + QString((char*)(commandPath).data()) + "\n"; 704 } 705 txt += "Guidance :\n"; 706 G4int n_guidanceEntry = a_command->GetGuidanceEntries(); 707 for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ ) 708 { txt += QString((char*)(a_command->GetGuidanceLine(i_thGuidance)).data()) + "\n"; } 709 if( ! rangeString.isNull() ) 710 { txt += " Range of parameters : " + QString((char*)(rangeString).data()) + "\n"; } 711 G4int n_parameterEntry = a_command->GetParameterEntries(); 712 if( n_parameterEntry > 0 ) 713 { 714 for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ ) 715 { a_command->GetParameter(i_thParameter)->List(); } 716 } 717 return txt; 718 }
Note: See TracChangeset
for help on using the changeset viewer.