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)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Thu, 29 Feb 2024 11:42:56 +0000 (12:42 +0100)
src/GLViewer/GLViewer_Viewer.cxx

index ac137a2bec3b9c9658348d467f3d5cdfa9583959..c2c17d5d28e5c7880a45f563828c3c41eabb6ad0 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 );
 }