简体   繁体   English

如何使 qt 中的 window 成为主要焦点

[英]How to make a window in qt be the main focus

So basically i have a class that inherits from QMainWindow and there's a toolbar action in my mainwindow that calls another small window where the user puts in some info, i want the mainwindow inaccessible ie you shouldn't be able to click on it or interact with it unless you finish what you're doing on that small window or you close the small window.所以基本上我有一个从QMainWindow继承的 class 并且我的主窗口中有一个工具栏操作调用另一个小的 window 用户输入一些信息,我希望主窗口无法访问,即你不应该能够点击它或与之交互除非你完成你在那个小 window 上所做的事情,或者你关闭小 window。 setWindowFlags(Qt::WindowStaysOnTopHint); only makes the small window be on top, but i can still access the MainWindow.仅使小型 window 位于顶部,但我仍然可以访问主窗口。

Looks like all i needed was the setWindowModality(Qt::ApplicationModal);看起来我只需要setWindowModality(Qt::ApplicationModal); method方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM