setWindowFlags(Qt :: WindowStaysOnTopHint)隐藏Qt窗口 [英] setWindowFlags(Qt::WindowStaysOnTopHint) hides Qt Window

查看:5480
本文介绍了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).

've also tried:

I've also tried:

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窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆