From 862c89ec63834857ed4178ee82e30f6aba15300f Mon Sep 17 00:00:00 2001 From: CHEMIN Sebastien Date: Mon, 8 Jan 2024 10:42:49 +0100 Subject: [PATCH] Fix GLView zoom buttons with qt5 --- src/GLViewer/GLViewer_Viewer.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) 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 ); } -- 2.39.2