You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Avoid native window recreation when toggling stay-on-top #254
We have observed native window recreation on both Windows and macOS when toggling this flag. The hide/show and recreation cause visible flicker and require native window state to be rebound. On Windows, recreation can also cause frame position drift. Linux has not been verified.
#241 explored changing the Win32 topmost state directly in the example. The merged #243 fixes frame drift after an HWND recreation. An in-place stay-on-top operation would avoid recreation when only the stacking level needs to change.
Proposal
Could QWindowKit provide an explicit stay-on-top operation for managed windows, either as a window-agent method or a documented window attribute?
Windows: update the existing HWND using SetWindowPos() with HWND_TOPMOST / HWND_NOTOPMOST.
macOS: update the existing NSWindow level.
Linux: investigate backend behavior before defining support or fallback semantics.
The requested state should be restored if the native window is recreated for another reason. The API should document that a native stacking change may not update Qt's windowFlags().
Expected behavior
On supported backends, repeatedly toggling stay-on-top should preserve window visibility, frame geometry, and native window identity without flicker.
Activity
hesphoros commentedon Oct 17, 2026
@wangwenx190
wangwenx190 commentedon Oct 19, 2026
我也不知道为什么Qt这边改window flag总要重新创建窗口,而且还总会把窗口隐藏,还要手动再显示出来。但就像你说的,如果我们手动改window style,绕过qt,那么window flags就会和qt那边不同步,不知道会不会引入什么隐患。这个接口倒是可以加的,代码也很简单。我和另一个维护者再商量下看看
wangwenx190 commentedon Oct 19, 2026
我们商量了一下,感觉与qt失去同步这个风险有点高,而且qt窗口在修改window flag时会闪一下是qt多少年以来就存在的问题,我们决定还是暂时不引入这种改动。如果你真的非常在意这个问题的话,可以自己维护一个fork,使用你自己修改的版本