From: CHEMIN Sebastien Date: Mon, 8 Jan 2024 09:42:49 +0000 (+0100) Subject: Fix GLView zoom buttons with qt5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=862c89ec63834857ed4178ee82e30f6aba15300f;p=modules%2Fgui.git Fix GLView zoom buttons with qt5 --- diff --git a/src/GLViewer/GLViewer_Viewer.cxx b/src/GLViewer/GLViewer_Viewer.cxx index 556d86275..5c6498c07 100644 --- a/src/GLViewer/GLViewer_Viewer.cxx +++ b/src/GLViewer/GLViewer_Viewer.cxx @@ -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(e); + if (keyEvent->key() == Qt::Key_Escape) + { + activateTransform( NoTransform ); + activateSketching( NoSketching ); + } + } + return QObject::eventFilter( o, e ); }