Bring window to front -> raise(),show(),activateWindow() don’t work

前端 未结 5 1724
南方客
南方客 2020-12-06 04:43

In my Qt-application I open a URL in the default-browser. Afterwards I want to bring the main-window of my application to the front again.

I tried all approaches I c

5条回答
  •  余生分开走
    2020-12-06 04:52

    for ( QWindow* appWindow : qApplication.allWindows() )
    {
      appWindow->show(); //bring window to top on OSX
      appWindow->raise(); //bring window from minimized state on OSX
    
      appWindow->requestActivate(); //bring window to front/unminimize on windows
    }
    

    Note that this also brings up the window from other virtual desktops on both OSX and Windows. I did not test this on linux, it may work though.

提交回复
热议问题