]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix GLView zoom buttons with qt5
authorCHEMIN Sebastien <sc236498@is245491.intra.cea.fr>
Mon, 8 Jan 2024 09:42:49 +0000 (10:42 +0100)
committerCHEMIN Sebastien <sc236498@is245491.intra.cea.fr>
Mon, 8 Jan 2024 09:42:49 +0000 (10:42 +0100)
src/GLViewer/GLViewer_Viewer.cxx

index 556d862752d663f29dc91414de5e38c9b88aea24..5c6498c075c5c298d731e8919e0e7b66b8e0be14 100644 (file)
@@ -315,18 +315,16 @@ bool GLViewer_Viewer::eventFilter( QObject* o, QEvent* e )
     if( !getActiveView() )
         return false;
 
-    if( getActiveView()->getViewPort() == o->parent() )
-      o = o->parent();
-
-    bool mouseClickedOutside = ( e->type() == QEvent::MouseButtonPress &&
-                                 o != getActiveView()->getViewPort() );
-    bool anyKeyPressed = ( e->type() == QEvent::KeyPress );
-    if ( mouseClickedOutside || anyKeyPressed )
-    {   /* terminate all */
-        activateTransform( NoTransform );
-        activateSketching( NoSketching );
-        //cout << "mouseClickedOutside || anyKeyPressed" << endl;
-    }
+    if (e->type() == QEvent::KeyPress)
+      {    
+        QKeyEvent* keyEvent = static_cast<QKeyEvent*>(e);
+        if (keyEvent->key() == Qt::Key_Escape)
+          {
+            activateTransform( NoTransform );
+            activateSketching( NoSketching );
+          }
+      }
+
     return QObject::eventFilter( o, e );
 }