int QDialog::exec()
{
Q_D(QDialog);
if (d->eventLoop) {
qWarning("QDialog::exec: Recursive call detected");
return -1;
}
bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose);
setAttribute(Qt::WA_DeleteOnClose, false);
d->resetModalitySetByOpen();
bool wasShowModal = testAttribute(Qt::WA_ShowModal);
setAttribute(Qt::WA_ShowModal, true);
setResult(0);
show();
QPointer<QDialog> guard = this;
if (d->nativeDialogInUse) {
d->platformHelper()->exec();
} else {
QEventLoop eventLoop;
d->eventLoop = &eventLoop;
(void) eventLoop.exec(QEventLoop::DialogExec);
}
if (guard.isNull())
return QDialog::Rejected;
d->eventLoop = 0;
setAttribute(Qt::WA_ShowModal, wasShowModal);
int res = result();
if (d->nativeDialogInUse)
d->helperD
QDialog在hide()之后,就被销毁的原因
最新推荐文章于 2022-04-07 19:05:49 发布