[Digikam-devel] [Bug 116347] All the Image Plugins freeze the Image Editor and ShowFoto when validating a value in a spinbox with the key ENTER.

Gilles Caulier caulier.gilles at free.fr
Tue Nov 15 12:45:35 GMT 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=116347         




------- Additional Comments From caulier.gilles free fr  2005-11-15 13:45 -------
SVN commit 480381 by cgilles:

Prevent Enter keys events between dialog and spinBox
CCBUG : 116347

 M  +39 -1     ctrlpaneldialog.cpp  
 M  +1 -0      ctrlpaneldialog.h  
 M  +38 -0     imageguidedialog.cpp  
 M  +1 -0      imageguidedialog.h  


--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/ctrlpaneldialog.cpp #480380:480381
 @ -62,7 +62,7  @
                              i18n("&Abort"),
                              i18n("&Save As..."),
                              i18n("&Load...")),
-                     m_parent(parent), m_name(name), m_tryAction(tryAction)
+                 m_parent(parent), m_name(name), m_tryAction(tryAction)
 {
     m_currentRenderingMode = NoneRendering;
     m_timer                = 0L;
 @ -333,6 +333,44  @
     delete d;
 }
 
+// Backport KDialog::keyPressEvent() implementation from KDELibs to ignore Enter/Return Key events 
+// to prevent any conflicts between dialog keys events and SpinBox keys events.
+
+void CtrlPanelDialog::keyPressEvent(QKeyEvent *e)
+{
+    if ( e->state() == 0 )
+    {
+        switch ( e->key() )
+        {
+        case Key_Escape:
+            e->accept();
+            reject();
+        break;
+        case Key_Enter:            
+        case Key_Return:     
+            e->ignore();              
+        break;
+        default:
+            e->ignore();
+            return;
+        }
+    }
+    else
+    {
+        // accept the dialog when Ctrl-Return is pressed
+        if ( e->state() == ControlButton &&
+            (e->key() == Key_Return || e->key() == Key_Enter) )
+        {
+            e->accept();
+            accept();
+        }
+        else
+        {
+            e->ignore();
+        }
+    }
+}
+
 }  // NameSpace DigikamImagePlugins
 
 #include "ctrlpaneldialog.moc"
--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/ctrlpaneldialog.h #480380:480381
 @ -103,6 +103,7  @
     void closeEvent(QCloseEvent *e);
     void customEvent(QCustomEvent *event);
     void abortPreview(void);
+    void keyPressEvent(QKeyEvent *e);
 
     virtual void writeUserSettings(void){};            
     virtual void resetValues(void){};
--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imageguidedialog.cpp #480380:480381
 @ -401,6 +401,44  @
     delete d;
 }
 
+// Backport KDialog::keyPressEvent() implementation from KDELibs to ignore Enter/Return Key events 
+// to prevent any conflicts between dialog keys events and SpinBox keys events.
+
+void ImageGuideDialog::keyPressEvent(QKeyEvent *e)
+{
+    if ( e->state() == 0 )
+    {
+        switch ( e->key() )
+        {
+        case Key_Escape:
+            e->accept();
+            reject();
+        break;
+        case Key_Enter:            
+        case Key_Return:     
+            e->ignore();              
+        break;
+        default:
+            e->ignore();
+            return;
+        }
+    }
+    else
+    {
+        // accept the dialog when Ctrl-Return is pressed
+        if ( e->state() == ControlButton &&
+            (e->key() == Key_Return || e->key() == Key_Enter) )
+        {
+            e->accept();
+            accept();
+        }
+        else
+        {
+            e->ignore();
+        }
+    }
+}
+
 }  // NameSpace DigikamImagePlugins
 
 #include "imageguidedialog.moc"
--- trunk/extragear/graphics/digikamimageplugins/common/dialogs/imageguidedialog.h #480380:480381
 @ -117,6 +117,7  @
     void abortPreview(void);
     void readSettings(void);
     void writeSettings(void);
+    void keyPressEvent(QKeyEvent *e);
             
     virtual void writeUserSettings(void){};
     virtual void resetValues(void){};



More information about the Digikam-devel mailing list