C++ (Qt)QFileDialog::QFileDialog(QWidget *parent, const QString &caption, const QString &directory, const QString &filter) : QDialog(*new QFileDialogPrivate, parent, 0){ Q_D(QFileDialog); d->init(directory, filter, caption);}
C++ (Qt)int QDialog::exec(){// ... (void) eventLoop.exec(); /// ............}
C++ (Qt)while (!d->exit) processEvents(flags | WaitForMoreEvents | ProcessEventsFlag(QEventLoop::DeferredDeletion));
C++ (Qt)int QEventLoop::exec(ProcessEventsFlags flags){Q_D(QEventLoop); if (d->threadData->quitNow) return -1; if (d->inExec) { qWarning("QEventLoop::exec: instance %p has already called exec()", this); return -1; } d->inExec = true; d->exit = false; d->threadData->eventLoops.push(this); #if defined(QT_NO_EXCEPTIONS) while (!d->exit) processEvents(flags | WaitForMoreEvents | ProcessEventsFlag(QEventLoop::DeferredDeletion));#else try { while (!d->exit) processEvents(flags | WaitForMoreEvents | ProcessEventsFlag(QEventLoop::DeferredDeletion)); } catch (...) { qWarning("Qt has caught an exception thrown from an event handler. Throwing\n" "exceptions from an event handler is not supported in Qt. You must\n" "reimplement QApplication::notify() and catch all exceptions there.\n"); throw; }#endif QEventLoop *eventLoop = d->threadData->eventLoops.pop(); Q_ASSERT_X(eventLoop == this, "QEventLoop::exec()", "internal error"); Q_UNUSED(eventLoop); // --release warning d->inExec = false; return d->returnCode;}