gpt4 book ai didi

c++ - QDialog::exec() 阻塞应用程序

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:14:40 25 4
gpt4 key购买 nike

我目前有一个 formA,它使用从 QDialog 继承的另一个表单请求用户输入。使用 QDialog::exec 提示表单。现在的问题是,将有多个 formA 实例,因此每当任何一个 formA 打开另一个表单作为对话框时,整个应用程序都会阻塞。目前我有这样的东西

if(formUserInputRequired->exec()==1) //Block until the user selects from a form
{
}

有没有办法让 QDialog::exec 不阻塞整个应用程序我只想让它只阻塞调用它的表单的实例或类似的东西但绝对不是整个应用程序?

更新:我不需要阻挡窗口。但是我想要一种方法来知道用户何时完成另一种形式的输入,以便原始形式可以处理该数据

最佳答案

Qt::WindowModal 作为参数调用对话框中的 setWindowModality 方法。

Qt::NonModal          0  The window is not modal and does not block input to other windows.
Qt::WindowModal 1 The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows.
Qt::ApplicationModal 2 The window is modal to the application and blocks input to all windows.

Source

关于c++ - QDialog::exec() 阻塞应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18768133/

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