explicit Braveheart() { qAddPreRoutine([]() { if (qApp->thread() != QThread::currentThread()) { QTimer::singleShot(0, qApp, sonOfScotland); } else { sonOfScotland(); } }); }
QT_BEGIN_NAMESPACE static void initialize() { //On window/ANGLE, calling QtWebEngine::initialize from DllMain will result in a crash. //To ensure it doesn't, we check that when loading the library //QCoreApplication is not yet instantiated, ensuring the call will be deferred #if defined(Q_OS_WIN) if (QCoreApplication::instance() && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) { return; } #endif qAddPreRoutine(QtWebEngineCore::initialize); }
int main(int argc, char *argv[]) { try{ MetaServerApplication app(argc, argv); qAddPreRoutine(metaserver::global_initializer); qAddPostRoutine(metaserver::global_cleanup); app.ensureImportantDir(); app.watchUnixSignal(SIGINT, true); app.watchUnixSignal(SIGTERM, true); app.watchUnixSignal(SIGABRT, true); CommandRunner cmdrunner(app); QTimer::singleShot(0, Qt::PreciseTimer, [&cmdrunner]{ cmdrunner.run(); }); return app.exec(); }catch(const ErrorInfo& errorInfo){ QString str(errorInfo.toString()); if(str.size() > 0){ str += '\n'; Terminal::writeText(str.toLocal8Bit(), TerminalColor::Red); } return EXIT_FAILURE; } }
void QNetworkConfigurationManagerPrivate::addPreAndPostRoutine() { qAddPreRoutine(connManager_prepare); qAddPostRoutine(connManager_cleanup); }