QApplication a(argc, argv); PlatformManager pmgr(NULL, Qt::Window); try { pmgr.show(); a.exec(); } catch(ml::Exception& e) { ml::qt::ErrorBoxDialog::show("Калибратор", e.title().c_str(), e.what().c_str(), &pmgr); return 0; }
if (ui.spinBox->value() < 20) // вот это ошибочная проверочка{emit error(); // или окно с ошибочкойreturn;}int x[20];x[ui.spinBox->value()] = 0;
emit error();return;
throw std::logic_error("Error");
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->loopLevel; d->threadData->eventLoops.push(this); // remove posted quit events when entering a new event loop QCoreApplication *app = QCoreApplication::instance(); if (app && app->thread() == thread()) QCoreApplication::removePostedEvents(app, QEvent::Quit);#if defined(QT_NO_EXCEPTIONS) while (!d->exit) processEvents(flags | WaitForMoreEvents | EventLoopExec);#else try { while (!d->exit) processEvents(flags | WaitForMoreEvents | EventLoopExec); } 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"); // copied from below QEventLoop *eventLoop = d->threadData->eventLoops.pop(); Q_ASSERT_X(eventLoop == this, "QEventLoop::exec()", "internal error"); Q_UNUSED(eventLoop); // --release warning d->inExec = false; --d->threadData->loopLevel; throw; }#endif // copied above QEventLoop *eventLoop = d->threadData->eventLoops.pop(); Q_ASSERT_X(eventLoop == this, "QEventLoop::exec()", "internal error"); Q_UNUSED(eventLoop); // --release warning d->inExec = false; --d->threadData->loopLevel; return d->returnCode;}