我有一个无模式的 QDialog 框,它在我的 Qt 应用程序中弹出错误/警告,我想强制用户只关注该对话框,而不是单击应用程序中的任何内容,直到他们在对话框上单击确定。
我需要对话框保持无模式。隐藏主窗口或将其覆盖等解决方案是 Not Acceptable 。
目前我正在使用 setModal(true);
来解决我的问题。但我认为此方法可能会阻止主应用程序执行。
最佳答案
来自documentation :
If you use
show()
andsetModal(true)
together to perform a long operation, you must callQApplication::processEvents()
periodically during processing to enable the user to interact with the dialog.
关于c++ - 显示对话框时如何禁用 Qt 应用程序中的用户交互?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14818542/