我目前有一个表单 A 需要一些输入。但是,为了获得该输入,需要填写另一个表格 B。所以我想要的是当用户单击 formA 中的按钮然后显示 formB 时。现在,当单击表单 B 中的按钮时,结果将返回到表单 A。做这个的最好方式是什么。 ?目前我有一个只显示表单 B 的表单,然后我就卡住了。有什么建议吗?
最佳答案
你可能想继承formB
来自 QDialog
上课然后打电话exec()
而不是 show()
.
来自 docs :
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.
与此结合,您可能需要使用 QDialog::accept
, QDialog::reject
或 QDialog::setResult
在formB
为了将结果传递给 formA
.
关于c++ - 打开另一个表单,然后等待该表单返回响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18345528/