Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Dec 28, 2024
1 parent 9851fff commit eafb7dc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ui/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2905,19 +2905,18 @@ void MainWindow::toggleMainWindow( bool ensureShow )
shown = true;
}
else if ( !isActiveWindow() ) {
show();
if ( cfg.preferences.raiseWindowOnSearch ) {
raise();
}
activateWindow();

// Rare cases, on Windows, the window can not be brought to the front.
auto flags = windowFlags();
setWindowFlags( flags | Qt::WindowStaysOnTopHint );
setWindowFlags( flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint );

QTimer::singleShot( 10, this, [ this ]() {
auto flags = windowFlags();
setWindowFlags( flags & ~Qt::WindowStaysOnTopHint );
setWindowFlags( flags ^ ( Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint ) );
} );

shown = true;
Expand Down

0 comments on commit eafb7dc

Please sign in to comment.