From a99892751b869186743fc4d2734db67e9dd70b41 Mon Sep 17 00:00:00 2001 From: Garux Date: Thu, 2 Feb 2023 19:39:39 +0600 Subject: [PATCH] entity, surface inspectors: clear focus widget while showing to keep global shortcuts working --- radiant/entityinspector.cpp | 7 +++++++ radiant/surfacedialog.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index d778e944..98bf07b2 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -1144,6 +1144,13 @@ protected: event->accept(); } } + // clear focus widget while showing to keep global shortcuts working + else if( event->type() == QEvent::Show ) { + QTimer::singleShot( 0, [obj](){ + if( static_cast( obj )->focusWidget() != nullptr ) + static_cast( obj )->focusWidget()->clearFocus(); + } ); + } return QObject::eventFilter( obj, event ); // standard event processing } } diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 3f8c2055..c3ff5ade 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -624,6 +624,13 @@ protected: return true; } } + // clear focus widget while showing to keep global shortcuts working + else if( event->type() == QEvent::Show ) { + QTimer::singleShot( 0, [obj](){ + if( static_cast( obj )->focusWidget() != nullptr ) + static_cast( obj )->focusWidget()->clearFocus(); + } ); + } return QObject::eventFilter( obj, event ); // standard event processing } }