QT 关闭窗口后方允许程序继续执行

利用 exec() 函数,exec()函数解释如下:

[virtual slot] int QDialog::exec()
Shows the dialog as a modal dialog, blocking until the user closes it. The function returns a DialogCode result.
If the dialog is application modal, users cannot interact with any other window in the same application until they close the dialog. If the dialog is window modal, only interaction with the parent window is blocked while the dialog is open. By default, the dialog is application modal.
Note: Avoid using this function; instead, use open(). Unlike exec(), open() is asynchronous, and does not spin an additional event loop. This prevents a series of dangerous bugs from happening (e.g. deleting the dialog’s parent while the dialog is open via exec()). When using open() you can connect to the finished() signal of QDialog to be notified when the dialog is closed.
See also open(), show(), result(), and setWindowModality().

大致意思:将 窗口 以模态显示,阻塞程序直到窗口关闭。若窗口为 application 模式(无父窗口),则在关闭该窗口之前,不能操作其他任何窗口;若窗口为 window 模式(有父窗口),则在关闭该窗口之前,不能操作其父窗口。

返回值:
QDialog::Accepted 1
QDialog::Rejected 0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值