Ignore:
Timestamp:
Nov 28, 2007, 11:28:38 AM (17 years ago)
Author:
garnier
Message:

correction du ticket #92

File:
1 edited

Legend:

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

    r619 r620  
    164164#if QT_VERSION < 0x040000
    165165  fCommandHistoryArea = new QListView(bottomWidget);
     166
     167  fCommandHistoryArea->setSorting (-1, FALSE);
    166168  fCommandHistoryArea->setSelectionMode(QListView::Single);
     169  fCommandHistoryArea->addColumn("");
     170  fCommandHistoryArea->header()->hide();
    167171  connect(fCommandHistoryArea, SIGNAL(selectionChanged()), SLOT(CommandHistoryCallback()));
    168172#else
     
    171175  connect(fCommandHistoryArea, SIGNAL(itemSelectionChanged()), SLOT(CommandHistoryCallback()));
    172176#endif
    173   fCommandHistoryArea->addColumn("");
    174   fCommandHistoryArea->header()->hide();
    175177
    176178  fCommandHistoryArea->installEventFilter(this);
     
    188190#endif
    189191  connect(fCommandArea, SIGNAL(returnPressed()), SLOT(CommandEnteredCallback()));
     192#ifdef GEANT4_QT_DEBUG
     193  printf("G4UIQt::   1 connect returnPressed\n");
     194#endif
    190195#if QT_VERSION < 0x040000
    191196  fCommandArea->setFocusPolicy ( QWidget::StrongFocus );
     
    490495)
    491496{
    492 #ifdef GEANT4_QT_DEBUG
    493   printf("G4UIQt::AddMenu 1\n");
    494 #endif
    495497  if (aName == NULL) return;
    496498  if (aLabel == NULL) return;
    497499
    498 #ifdef GEANT4_QT_DEBUG
    499   printf("G4UIQt::AddMenu 2 %s %s\n",aName,aLabel);
    500 #endif
    501500#if QT_VERSION < 0x040000
    502501  QPopupMenu *fileMenu = new QPopupMenu( fMainWindow);
     
    536535 
    537536  QSignalMapper *signalMapper = new QSignalMapper(this);
    538 #if QT_VERSION < 0x040000
    539537#if QT_VERSION < 0x030200
    540538  QAction *action = new QAction(QString(aLabel),QString(aLabel),QKeySequence::QKeySequence (),signalMapper, SLOT(map()));
    541 #else
     539  action->addTo(parent);
     540 connect(action,SIGNAL(activated()),signalMapper,SLOT(map()));
     541
     542#elif QT_VERSION < 0x040000
    542543  QAction *action = new QAction(QString(aLabel),QKeySequence::QKeySequence (),signalMapper, SLOT(map()));
    543 #endif
    544544  action->addTo(parent);
     545 connect(action,SIGNAL(clicked()),signalMapper,SLOT(map()));
     546
    545547#else
    546548  QAction *action = parent->addAction(aLabel, signalMapper, SLOT(map()));
    547 #endif
     549
     550#endif
     551  connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ButtonCallback(const QString&)));
    548552  signalMapper->setMapping(action, QString(aCommand));
    549   connect(signalMapper, SIGNAL(mapped(const QString &)),this, SLOT(ButtonCallback(const QString&)));
    550553}
    551554
     
    11621165)
    11631166{
    1164 #ifdef GEANT4_QT_DEBUG
    1165   printf("G4UIQt::CommandEnteredCallback\n");
    1166 #endif
    11671167#if QT_VERSION < 0x040000
    11681168  G4String command (fCommandArea->text().ascii());
     
    11721172    newItem->setText(0,fCommandArea->text());
    11731173    fCommandHistoryArea->insertItem(newItem);
    1174 #ifdef GEANT4_QT_DEBUG
    1175   printf("G4UIQt::CommandEnteredCallback 2\n");
    1176 #endif
     1174    // now we have to arrange
     1175    QListViewItem *temp= fCommandHistoryArea->lastItem();
     1176    for (int i=0; i<fCommandHistoryArea->childCount()-1;i++) {
     1177      fCommandHistoryArea->takeItem(temp);
     1178      fCommandHistoryArea->insertItem(temp);
     1179      temp= fCommandHistoryArea->lastItem();
     1180    }
    11771181#else
    11781182  G4String command (fCommandArea->text().toStdString().c_str());
     
    12071211)
    12081212{
     1213
    12091214#if QT_VERSION < 0x040000
    12101215  G4String ss = G4String(aCommand.ascii());
     
    12241229)
    12251230{
    1226 #ifdef GEANT4_QT_DEBUG
    1227   printf("G4UIQt::HelpTreeClicCallback");
    1228 #endif
    1229 
    12301231#if QT_VERSION < 0x040000
    12311232  QListViewItem* item =  NULL;
     
    13141315  if (!fCommandHistoryArea)
    13151316    return ;
    1316 
    13171317 
    13181318#if QT_VERSION < 0x040000
    1319   item =fHelpTreeWidget->selectedItem();
     1319  item =fCommandHistoryArea->selectedItem();
    13201320#else
    13211321  QList<QListWidgetItem *> list =fCommandHistoryArea->selectedItems();
Note: See TracChangeset for help on using the changeset viewer.