PyQt4 : How can i toggle the “Stay On Top” behavior?

后端 未结 4 1555
遥遥无期
遥遥无期 2021-02-10 07:29

I want to create an app, where the user will decide it the main window will stay always on top of the other apps.

In PyQt4 it is easy to create a window that will stay a

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-10 08:09

    This should disable it:

    window.setWindowFlags(window.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
    

    This should enable it:

    window.setWindowFlags(window.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
    

提交回复
热议问题