diff options
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index db6546028a..75597f8739 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -120,6 +120,7 @@ #ifdef Q_OS_WASM #include <emscripten.h> +#include <emscripten/val.h> #endif #ifdef QT_BOOTSTRAPPED @@ -700,7 +701,7 @@ void QCoreApplicationPrivate::initLocale() Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance. - If no instance has been allocated, \c null is returned. + If no instance has been allocated, \nullptr is returned. */ /*! @@ -801,6 +802,10 @@ void QCoreApplicationPrivate::init() Module.print(err); }); ); + +#if QT_CONFIG(thread) + QThreadPrivate::idealThreadCount = emscripten::val::global("navigator")["hardwareConcurrency"].as<int>(); +#endif #endif // Store app name/version (so they're still available after QCoreApplication is destroyed) @@ -1043,6 +1048,7 @@ void QCoreApplication::setQuitLockEnabled(bool enabled) quitLockRefEnabled = enabled; } +#if QT_DEPRECATED_SINCE(5, 6) /*! \internal \deprecated @@ -1054,6 +1060,7 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event) { return notifyInternal2(receiver, event); } +#endif /*! \internal @@ -1291,7 +1298,11 @@ bool QCoreApplication::closingDown() \l{QCoreApplication::sendPostedEvents()}{sendPostedEvents()} from within that local loop. - Calling this function processes events only for the calling thread. + Calling this function processes events only for the calling thread, + and returns after all available events have been processed. Available + events are events queued before the function call. This means that + events that are posted while the function runs will be queued until + a later round of event processing. \threadsafe @@ -1308,7 +1319,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags) /*! \overload processEvents() - Processes pending events for the calling thread for \a maxtime + Processes pending events for the calling thread for \a ms milliseconds or until there are no more events to process, whichever is shorter. @@ -1317,11 +1328,14 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags) Calling this function processes events only for the calling thread. + \note Unlike the \l{QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags)}{processEvents()} + overload, this function also processes events that are posted while the function runs. + \threadsafe \sa exec(), QTimer, QEventLoop::processEvents() */ -void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime) +void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int ms) { // ### Qt 6: consider splitting this method into a public and a private // one, so that a user-invoked processEvents can be detected @@ -1332,7 +1346,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int m QElapsedTimer start; start.start(); while (data->eventDispatcher.load()->processEvents(flags & ~QEventLoop::WaitForMoreEvents)) { - if (start.elapsed() > maxtime) + if (start.elapsed() > ms) break; } } @@ -1655,14 +1669,15 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven /*! Immediately dispatches all events which have been previously queued - with QCoreApplication::postEvent() and which are for the object \a receiver - and have the event type \a event_type. + with QCoreApplication::postEvent() and which are for the object \a + receiver and have the event type \a event_type. Events from the window system are \e not dispatched by this function, but by processEvents(). - If \a receiver is null, the events of \a event_type are sent for all - objects. If \a event_type is 0, all the events are sent for \a receiver. + If \a receiver is \nullptr, the events of \a event_type are sent for + all objects. If \a event_type is 0, all the events are sent for + \a receiver. \note This method must be called from the thread in which its QObject parameter, \a receiver, lives. @@ -1843,10 +1858,10 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type call it, be aware that killing events may cause \a receiver to break one or more invariants. - If \a receiver is null, the events of \a eventType are removed for - all objects. If \a eventType is 0, all the events are removed for - \a receiver. You should never call this function with \a eventType - of 0. + If \a receiver is \nullptr, the events of \a eventType are removed + for all objects. If \a eventType is 0, all the events are removed + for \a receiver. You should never call this function with \a + eventType of 0. \threadsafe */ @@ -2159,7 +2174,7 @@ static void replacePercentN(QString *result, int n) \a disambiguation is an identifying string, for when the same \a sourceText is used in different roles within the same context. By - default, it is null. + default, it is \nullptr. See the \l QTranslator and \l QObject::tr() documentation for more information about contexts, disambiguations and comments. |