Changeset 518


Ignore:
Timestamp:
Jun 20, 2007, 12:24:52 PM (17 years ago)
Author:
garnier
Message:

r637@mac-90108: laurentgarnier | 2007-06-20 12:28:10 +0200
deplacement et suppression de la classe G4UIQtLineEdit et mise en place de son equivalent dans la classe G4UIQt

Location:
trunk/geant4/interfaces/basic
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/interfaces/basic/include/G4UIQt.hh

    r517 r518  
    110110  G4bool GetHelpChoice(G4int&) ;// have to be implemeted because we heritate from G4VBasicShell
    111111  void ExitHelp();// have to be implemeted because we heritate from G4VBasicShell
     112  bool eventFilter(QObject*,QEvent*);
    112113
    113114private:
  • trunk/geant4/interfaces/basic/src/G4UIQt.cc

    r517 r518  
    4646#include "G4UIcommandStatus.hh"
    4747
    48 #include "G4UIQtLineEdit.hh"
    49 
    5048#include "G4Qt.hh"
    5149
     
    6058#include <QtGui/qscrollbar.h>
    6159#include <QtGui/qdialog.h>
     60#include <QtGui/qevent.h>
    6261
    6362#include <stdlib.h>
     
    113112  fCommandLabel = new QLabel();
    114113
    115   fCommandArea = new G4UIQtLineEdit(this); // must surcharge the keyPressEvent function
     114  //  fCommandArea = new G4UIQtLineEdit(this); // must surcharge the keyPressEvent function
     115  fCommandArea = new QLineEdit();
     116  fCommandArea->installEventFilter(this);
    116117  fCommandArea->activateWindow();
    117118  connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback()));
     
    602603
    603604
     605/**
     606 Event filter method. Every event from QtApplication goes here.
     607 We apply a filter only for the Up and Down Arrow press when the QLineEdit
     608 is active. If this filter match, Up arrow we give the previous command
     609 and Down arrow will give the next if exist.
     610 @param obj Emitter of the event
     611 @param event Kind of event
     612*/
     613/***************************************************************************/
     614bool G4UIQt::eventFilter(
     615 QObject *obj
     616,QEvent *event
     617)
     618/***************************************************************************/
     619/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
     620{
     621  if (obj == fCommandArea) {
     622    if (event->type() == QEvent::KeyPress) {
     623      QKeyEvent *e = static_cast<QKeyEvent*>(event);
     624      if (e->key() == (Qt::Key_Down)) {
     625        printf("****************KEY PRESSED DOWN*****\n");
     626      } else if (e->key() == (Qt::Key_PageDown)) {
     627        printf("****************KEY PRESSED PAGE DOWN*****\n");
     628      } else if (e->key() == (Qt::Key_Up)) {
     629        printf("****************KEY PRESSED UP*****\n");
     630      } else if (e->key() == (Qt::Key_PageUp)) {
     631        printf("****************KEY PRESSED PAGE UP*****\n");
     632        //      } else {
     633        //        return QObject::eventFilter(obj, event);
     634      }
     635      //    } else {
     636      //      return QObject::eventFilter(obj, event);
     637    }
     638    //  } else {
     639  }
     640  // pass the event on to the parent class
     641  return QObject::eventFilter(obj, event);
     642  //  return true;
     643}
     644
     645
     646
     647
    604648/***************************************************************************/
    605649//
Note: See TracChangeset for help on using the changeset viewer.