[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Thu Oct 16 17:29:20 CEST 2003


CVS commit by harris: 

Pressing Escape will now close the "Set Time" window.  The trick was to 
use keyReleaseEvent(), because the KDatePicker object consumes 
keyPressEvents.  Got the tip by looking at the kicker clock applet code.

CCMAIL: kstars-devel at kde.org


  M +3 -1      timedialog.cpp   1.13
  M +2 -2      timedialog.h   1.9


--- kdeedu/kstars/kstars/timedialog.cpp  #1.12:1.13
@@ -100,5 +100,7 @@ TimeDialog::TimeDialog( QDateTime now, Q
 
 //Add handler for Escape key to close window
-void TimeDialog::keyPressEvent( QKeyEvent *kev ) {
+//Use keyReleaseEvent because keyPressEvents are already consumed
+//by the KDatePicker.
+void TimeDialog::keyReleaseEvent( QKeyEvent *kev ) {
         switch( kev->key() ) {
                 case Key_Escape:

--- kdeedu/kstars/kstars/timedialog.h  #1.8:1.9
@@ -101,5 +101,5 @@ public slots:
 protected:
    bool event( QEvent* );
-        void keyPressEvent( QKeyEvent* );
+        void keyReleaseEvent( QKeyEvent* );
 
 private:




More information about the Kstars-devel mailing list