gpt4 book ai didi

c++ - 显示对话框时如何禁用 Qt 应用程序中的用户交互?

转载 作者:行者123 更新时间:2023-11-30 02:57:14 24 4
gpt4 key购买 nike

我有一个无模式的 QDialog 框,它在我的 Qt 应用程序中弹出错误/警告,我想强制用户只关注该对话框,而不是单击应用程序中的任何内容,直到他们在对话框上单击确定。

我需要对话框保持无模式。隐藏主窗口或将其覆盖等解决方案是 Not Acceptable 。

目前我正在使用 setModal(true); 来解决我的问题。但我认为此方法可能会阻止主应用程序执行。

最佳答案

来自documentation :

If you use show() and setModal(true) together to perform a long operation, you must call QApplication::processEvents() periodically during processing to enable the user to interact with the dialog.

关于c++ - 显示对话框时如何禁用 Qt 应用程序中的用户交互?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14818542/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com