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

前端 未结 5 1695
南方客
南方客 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 05:09

    try this:

    viewer.setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
    viewer.raise();  // for MacOS
    viewer.activateWindow(); // for Windows
    

    it work in my project ( in my project viewer is QMainWindow): https://github.com/iptton/Rythem .

提交回复
热议问题