setWindowFlags(Qt::WindowStaysOnTopHint) hides Qt Window(setWindowFlags(Qt::WindowStaysOnTopHint) 隐藏 Qt 窗口)
问题描述
我想让我的 Qt 窗口保持在顶部.执行 setWindowFlags(Qt::WindowStaysOnTopHint)
时,窗口变为隐藏状态(在 Windows 7 上).
I want to make my Qt Window stay on top. When setWindowFlags(Qt::WindowStaysOnTopHint)
is executed, the window becomes hidden (on Windows 7).
我也试过了:
Qt::WindowFlags flags = windowFlags();
setWindowFlags(flags | Qt::WindowStaysOnTopHint);
而且,它仍然是一样的.我在这里做错了什么?
And, it still does the same. What did I do wrong here?
推荐答案
设置标志后调用 show():
Call show() after you set the flag:
Qt::WindowFlags flags = windowFlags();
setWindowFlags(flags | Qt::WindowStaysOnTopHint);
show();
查看 http://doc.qt.io/qt-5/qwidget.html#windowFlags-prop
这篇关于setWindowFlags(Qt::WindowStaysOnTopHint) 隐藏 Qt 窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!