在 Qt 中将小部件保持在顶部 [英] Keep widget on top in Qt

查看:60
本文介绍了在 Qt 中将小部件保持在顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序,它有一个可以在应用程序窗口内拖动的浮动"小部件.但它会启动,或者有时会落后于其他小部件.有什么方法可以确保我的应用程序中的小部件在可见时始终位于所有其他小部件之上?

I'm creating an application which has a "floating" widget which can be dragged around inside the application window. But it starts up, or tends to go behind other widgets sometimes. Is there any way to make sure that the widget in my application stays on top of all other widgets whenever it is made visible?

谢谢.

推荐答案

使用标志 Qt::WindowStaysOnTopHint 用于您的 QWidget.这将强制您的小部件位于所有其他窗口之上

Use the flag Qt::WindowStaysOnTopHint for your QWidget. This will force your widget to stay on top of all other windows

这篇关于在 Qt 中将小部件保持在顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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