- Timestamp:
- Jun 20, 2007, 12:24:52 PM (17 years ago)
- Location:
- trunk/geant4/interfaces/basic
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/interfaces/basic/include/G4UIQt.hh
r517 r518 110 110 G4bool GetHelpChoice(G4int&) ;// have to be implemeted because we heritate from G4VBasicShell 111 111 void ExitHelp();// have to be implemeted because we heritate from G4VBasicShell 112 bool eventFilter(QObject*,QEvent*); 112 113 113 114 private: -
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r517 r518 46 46 #include "G4UIcommandStatus.hh" 47 47 48 #include "G4UIQtLineEdit.hh"49 50 48 #include "G4Qt.hh" 51 49 … … 60 58 #include <QtGui/qscrollbar.h> 61 59 #include <QtGui/qdialog.h> 60 #include <QtGui/qevent.h> 62 61 63 62 #include <stdlib.h> … … 113 112 fCommandLabel = new QLabel(); 114 113 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); 116 117 fCommandArea->activateWindow(); 117 118 connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback())); … … 602 603 603 604 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 /***************************************************************************/ 614 bool 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 604 648 /***************************************************************************/ 605 649 //
Note: See TracChangeset
for help on using the changeset viewer.