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

r619@mac-90108: laurentgarnier | 2007-06-14 14:26:03 +0200
ne compile pas, mais on avance

File:
1 edited

Legend:

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

    r508 r509  
    493493
    494494  QSplitter *splitter = new QSplitter(Qt::Horizontal);
    495   QTextEdit *textArea = new QTextEdit();
     495  QTextEdit *fhelpArea = new QTextEdit();
    496496  QPushButton *exitButton = new QPushButton("Exit");
    497497  connect(exitButton, SIGNAL(clicked()), helpDialog,SLOT(close()));
    498   textArea->setReadOnly(true);
     498  fHelpArea->setReadOnly(true);
    499499
    500500  // the help tree
     
    535535
    536536  splitterLayout->addWidget(treeWidget);
    537   splitterLayout->addWidget(textArea);
     537  splitterLayout->addWidget(fHelpArea);
    538538  splitter->setLayout(splitterLayout);
    539539
     
    661661
    662662    //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     
    671668    a_parent->addChild(newItem);
    672669
     
    675672  printf ("G4UIQt::CreateChildTree  end of for loop\n");
    676673}
     674
     675/**
     676This callback is activated when user selected a item in the help tree
     677 */
     678/***************************************************************************/
     679void G4UIQt::helpTreeCallback (
     680  const QString & a_txt
     681)
     682/***************************************************************************/
     683/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
     684{
     685  fHelpArea->setText(a_txt);
     686}
     687
     688/**
     689 */
     690/***************************************************************************/
     691QString 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.