Ignore:
Timestamp:
Nov 27, 2007, 6:04:59 PM (17 years ago)
Author:
garnier
Message:

modifs pour Qt3

File:
1 edited

Legend:

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

    r617 r619  
    171171  connect(fCommandHistoryArea, SIGNAL(itemSelectionChanged()), SLOT(CommandHistoryCallback()));
    172172#endif
     173  fCommandHistoryArea->addColumn("");
     174  fCommandHistoryArea->header()->hide();
     175
    173176  fCommandHistoryArea->installEventFilter(this);
    174177  fCommandLabel = new QLabel("",bottomWidget);
     
    566569    fHelpDialog = new QDialog(fMainWindow,0,FALSE,Qt::WStyle_Title | Qt::WStyle_SysMenu | Qt::WStyle_MinMax );
    567570    QVBoxLayout *vLayout = new QVBoxLayout(fHelpDialog);
    568     QWidget* global = new QWidget(fHelpDialog);
     571    QSplitter *splitter = new QSplitter(Qt::Horizontal,fHelpDialog);
    569572#else
    570573    QVBoxLayout *vLayout = new QVBoxLayout();
    571574    fHelpDialog = new QDialog(fMainWindow,Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
    572 #endif
    573     QSplitter *splitter = new QSplitter(Qt::Horizontal,fHelpDialog);
    574 
    575     QPushButton *exitButton = new QPushButton("Exit",fMainWindow);
     575    QSplitter *splitter = new QSplitter(Qt::Horizontal);
     576#endif
     577    QPushButton *exitButton = new QPushButton("Exit",fHelpDialog);
    576578    connect(exitButton, SIGNAL(clicked()), fHelpDialog,SLOT(close()));
    577579
     
    585587    fHelpTreeWidget = new QListView(splitter);
    586588    fHelpTreeWidget->setSelectionMode(QListView::Single);
     589    fHelpTreeWidget->setRootIsDecorated(true);
    587590    fHelpTreeWidget->addColumn("Command");
    588     fHelpTreeWidget->addColumn("Description");
    589     fHelpTreeWidget->setColumnWidth (1,0);
     591    fHelpTreeWidget->addColumn("Description",0);
     592    //    fHelpTreeWidget->setColumnWidth (1,0);
    590593    fHelpTreeWidget->header()->setResizeEnabled(FALSE,1);
    591594    //    QList<QListViewItem *> items;
     
    651654    }
    652655
     656#if QT_VERSION < 0x040000
     657    connect(fHelpTreeWidget, SIGNAL(selectionChanged ()),this, SLOT(HelpTreeClicCallback())); 
     658    connect(fHelpTreeWidget, SIGNAL(doubleClicked (QListViewItem*)),this, SLOT(HelpTreeDoubleClicCallback(QListViewItem*)));
     659#else
    653660    connect(fHelpTreeWidget, SIGNAL(itemSelectionChanged ()),this, SLOT(HelpTreeClicCallback())); 
    654     connect(fHelpTreeWidget, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,int)),this, SLOT(HelpTreeDoubleClicCallback(QTreeWidgetItem*,int))); 
     661    connect(fHelpTreeWidget, SIGNAL(itemDoubleClicked (QTreeWidgetItem*,int)),this, SLOT(HelpTreeDoubleClicCallback(QTreeWidgetItem*))); 
     662#endif
    655663
    656664    // Set layouts
     
    662670
    663671
    664 #if QT_VERSION < 0x040000
    665     vLayout->addWidget(global);
    666 #else
     672#if QT_VERSION >= 0x040000
    667673    vLayout->addWidget(splitter);
    668 #endif
    669674    vLayout->addWidget(exitButton);
     675#else
     676    vLayout->add(splitter);
     677    vLayout->addWidget(exitButton);
     678#endif
     679
     680    // set the splitter size
     681#if QT_VERSION >= 0x040000
     682    QList<int> list;
     683#else
     684    QValueList<int> list;
     685#endif
     686    list.append( 400 );
     687    list.append( 400 );
     688    splitter->setSizes(list);
     689
    670690#if QT_VERSION >= 0x040000
    671691    fHelpDialog->setLayout(vLayout);
     
    11421162)
    11431163{
     1164#ifdef GEANT4_QT_DEBUG
     1165  printf("G4UIQt::CommandEnteredCallback\n");
     1166#endif
    11441167#if QT_VERSION < 0x040000
    11451168  G4String command (fCommandArea->text().ascii());
     
    11481171    QListViewItem *newItem = new QListViewItem(fCommandHistoryArea);
    11491172    newItem->setText(0,fCommandArea->text());
     1173    fCommandHistoryArea->insertItem(newItem);
     1174#ifdef GEANT4_QT_DEBUG
     1175  printf("G4UIQt::CommandEnteredCallback 2\n");
     1176#endif
    11501177#else
    11511178  G4String command (fCommandArea->text().toStdString().c_str());
     
    11661193      TerminalHelp(command);
    11671194    }
    1168 #ifdef GEANT4_QT_DEBUG
    1169     printf("after \n");
    1170 #endif
    11711195    if(exitSession==true)
    11721196      SessionTerminate();
     
    12001224)
    12011225{
    1202   //  printf("G4UIQt::HelpTreeClicCallback");
     1226#ifdef GEANT4_QT_DEBUG
     1227  printf("G4UIQt::HelpTreeClicCallback");
     1228#endif
     1229
    12031230#if QT_VERSION < 0x040000
    12041231  QListViewItem* item =  NULL;
     
    12651292#else
    12661293QTreeWidgetItem* item
    1267 #endif
    1268  ,int
    1269 )
    1270 {
    1271 #ifdef GEANT4_QT_DEBUG
    1272   printf("G4UIQt::HelpTreeDoubleClicCallback");
    1273 #endif
     1294,int
     1295#endif
     1296)
     1297{
    12741298  HelpTreeClicCallback();
    12751299  fCommandArea->setText(item->text (1));
Note: See TracChangeset for help on using the changeset viewer.