make a99892751b work in Linux

#184
This commit is contained in:
Garux 2024-03-31 11:33:58 +05:00
parent f3ffdf9f28
commit b0a065afd6

View File

@ -617,7 +617,12 @@ protected:
} }
} }
// clear focus widget while showing to keep global shortcuts working // clear focus widget while showing to keep global shortcuts working
#ifdef WIN32
else if( event->type() == QEvent::Show ) { else if( event->type() == QEvent::Show ) {
#else
else if( event->type() == QEvent::WindowActivate ) { // fixme hack hack: events order varies in OSes, QEvent::Show doesn't work in Linux
// QEvent::WindowActivate seems preferable for usability, but allows QLineEdit content selection w/o focusing it in WIN32
#endif
QTimer::singleShot( 0, [obj](){ QTimer::singleShot( 0, [obj](){
if( static_cast<QWidget*>( obj )->focusWidget() != nullptr ) if( static_cast<QWidget*>( obj )->focusWidget() != nullptr )
static_cast<QWidget*>( obj )->focusWidget()->clearFocus(); static_cast<QWidget*>( obj )->focusWidget()->clearFocus();