我有多个 QDialog
窗口。所有窗口都是用 exampleWindow->exec()
创建的。这导致当时只有一个窗口打开。
我必须将这些窗口转换为非模态对话窗口
这里是我项目的示例代码示例。当 exec() 使用时,系统进入循环并等待用户在窗口上做一些事情。
int result = exampleWindow->exec();
if ( exampleWindow== QDialogButtonBox::Ok )
{
exampleWindow->UpdateCalibrationData(&data);
exampleWindow->UpdateFilterData(&filterData);
SetCalibrationStatusToSuccess();
}
但我想把这个转换成那样:
exampleWindow->show();
// and I need to some loop here for the wait answer of dialog
最佳答案
你可以创建一个非模态对话框
exampleWindow->show();
用户关闭对话框后,可以得到对话框发出的信号:
QObject::connect(&exampleWindow, SIGNAL(accepted()), this, SLOT(doSomething());
并在该插槽函数中接收对话数据。
关于c++ - 在 Qt 中如何将模态对话框窗口转换为非模态对话框窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31407895/