50 #include <private/qproperty_p.h>
58 #include <private/qloggingregistry_p.h>
65 #include <QtCore/qpromise.h>
67 #include <private/qthread_p.h>
75 #include <private/qfactoryloader_p.h>
76 #include <private/qfunctions_p.h>
77 #include <private/qlocale_p.h>
78 #include <private/qlocking_p.h>
79 #include <private/qhooks_p.h>
82 #if defined(Q_OS_UNIX)
83 # if defined(Q_OS_DARWIN)
86 # if !defined(QT_NO_GLIB)
87 # include "qeventdispatcher_glib_p.h"
97 #if defined(Q_OS_ANDROID)
98 #include <QtCore/qjniobject.h>
109 # ifndef Q_OS_INTEGRITY
110 # include <langinfo.h>
113 # include <sys/types.h>
118 #if __has_include(<sys/auxv.h>)
119 # include <sys/auxv.h>
123 # include <taskLib.h>
127 #include <emscripten/val.h>
130 #ifdef QT_BOOTSTRAPPED
131 #include <private/qtrace_p.h>
133 #include <qtcore_tracepoints_p.h>
141 #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
145 #if QT_VERSION >= QT_VERSION_CHECK(7, 0, 0)
146 # error "Bump QCoreApplicatoinPrivate::app_compile_version to QT_VERSION_CHECK(7, 0, 0)"
153 #if !defined(Q_OS_WIN)
155 QString QCoreApplicationPrivate::infoDictionaryStringProperty(
const QString &propertyName)
158 QCFString cfPropertyName = propertyName.toCFString();
159 CFTypeRef
string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
162 bundleName = QString::fromCFString(
static_cast<CFStringRef
>(
string));
170 applicationName = infoDictionaryStringProperty(
QStringLiteral(
"CFBundleName"));
173 char *
p = strrchr(
argv[0],
'/');
177 return applicationName;
182 #ifdef QT_BOOTSTRAPPED
183 #elif defined(Q_OS_DARWIN)
184 applicationVersion = infoDictionaryStringProperty(
QStringLiteral(
"CFBundleVersion"));
185 #elif defined(Q_OS_ANDROID)
189 "getPackageManager",
"()Landroid/content/pm/PackageManager;");
191 if (pm.isValid() && pn.isValid()) {
193 "getPackageInfo",
"(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;",
195 if (packageInfo.isValid()) {
196 QJniObject versionName = packageInfo.getObjectField(
197 "versionName",
"Ljava/lang/String;");
198 if (versionName.isValid())
199 return versionName.toString();
204 return applicationVersion;
212 bool b = (QCoreApplication::self !=
nullptr);
214 qWarning(
"QApplication::%s: Please instantiate the QApplication object first",
function);
218 #if QT_CONFIG(commandlineparser)
222 QStringLiteral(
"Activates the QML/JS debugger with a specified port. The value must be of format port:1234[,block]. \"block\" makes the application wait for a connection."),
229 int j =
argc ? 1 : 0;
230 for (
int i = 1;
i <
argc; ++
i) {
233 if (*
argv[
i] !=
'-') {
240 if (
strncmp(
arg,
"-qmljsdebugger=", 15) == 0) {
267 static
bool preRoutinesCalled =
false;
281 if (preRoutinesCalled) {
310 static void qt_call_pre_routines()
313 preRoutinesCalled =
true;
315 if (!preRList.exists())
332 if (!postRList.exists())
351 #ifndef QT_NO_QOBJECT
379 #ifndef QT_NO_QOBJECT
394 #if QT_CONFIG(library)
395 std::unique_ptr<QStringList> app_libpaths;
396 std::unique_ptr<QStringList> manual_libpaths;
403 #ifndef QT_NO_QOBJECT
404 static bool quitLockEnabled =
true;
407 #if defined(Q_OS_WIN)
413 static inline bool isArgvModified(
int argc,
char **argv)
415 if (__argc != argc || !__argv )
419 for (
int a = 0;
a < argc; ++
a) {
420 if (argv[
a] != __argv[
a] &&
strcmp(argv[
a], __argv[
a]))
426 static inline bool contains(
int argc,
char **argv,
const char *needle)
428 for (
int a = 0;
a < argc; ++
a) {
438 #ifndef QT_NO_QOBJECT
443 #
if defined(Q_OS_WIN)
448 #ifndef QT_NO_QOBJECT
450 , aboutToQuitEmitted(
false)
451 , threadData_clean(
false)
457 static const char *
const empty =
"";
460 argv =
const_cast<char **
>(&empty);
462 #if defined(Q_OS_WIN)
465 origArgv =
new char *[
argc];
470 #ifndef QT_NO_QOBJECT
473 # if defined(Q_OS_UNIX)
475 qFatal(
"FATAL: The application binary appears to be running setuid, this is a security hole.");
480 qWarning(
"WARNING: QApplication was not created in the main() thread.");
486 #ifndef QT_NO_QOBJECT
489 #if defined(Q_OS_WIN)
495 #ifndef QT_NO_QOBJECT
502 #if QT_CONFIG(thread)
503 void *
data = &thisThreadData->tls;
504 QThreadStorageData::finish((
void **)
data);
508 const auto locker =
qt_scoped_lock(thisThreadData->postEventList.mutex);
509 for (
const QPostEvent &pe : std::as_const(thisThreadData->postEventList)) {
511 --pe.receiver->d_func()->postedEvents;
512 pe.event->m_posted =
false;
516 thisThreadData->postEventList.clear();
517 thisThreadData->postEventList.recursion = 0;
518 thisThreadData->quitNow =
false;
548 return data->requiresCoreApplication;
556 "QCoreApplication::sendEvent",
558 "Current thread 0x%p. Receiver '%ls' (of type '%s') was created in thread 0x%p",
559 currentThread, qUtf16Printable(receiver->
objectName()),
560 receiver->metaObject()->className(), thr)
570 #if QT_CONFIG(library)
571 QStringList *app_libpaths = coreappdata()->app_libpaths.get();
573 coreappdata()->app_libpaths.reset(app_libpaths =
new QStringList);
577 if (
QFile::exists(app_location) && !app_libpaths->contains(app_location))
578 app_libpaths->append(app_location);
591 #if defined(Q_OS_UNIX) && !defined(QT_BOOTSTRAPPED)
592 static bool qt_locale_initialized =
false;
593 if (qt_locale_initialized)
595 qt_locale_initialized =
true;
597 #ifdef Q_OS_INTEGRITY
598 setlocale(LC_CTYPE,
"UTF-8");
602 auto nl_langinfo = [](int) {
return "UTF-8"; };
604 const char *locale = setlocale(LC_ALL,
"");
605 const char *codec = nl_langinfo(CODESET);
608 QByteArray newLocale = setlocale(LC_CTYPE,
nullptr);
613 newLocale +=
".UTF-8";
614 newLocale = setlocale(LC_CTYPE, newLocale);
619 newLocale = setlocale(LC_CTYPE,
"UTF-8");
622 newLocale = setlocale(LC_CTYPE,
"C.UTF-8");
624 newLocale = setlocale(LC_CTYPE,
"C.utf8");
626 qWarning(
"Detected system locale encoding (%s, locale \"%s\") is not UTF-8.\n"
627 "Qt shall use a UTF-8 locale (\"%s\") instead. If this causes problems,\n"
628 "reconfigure your locale. See the locale(1) manual for more information.",
730 d_func()->q_ptr =
this;
760 d_func()->q_ptr =
this;
762 #ifndef QT_NO_QOBJECT
778 #if defined(Q_OS_MACOS)
779 QMacAutoReleasePool
pool;
786 Q_ASSERT_X(!QCoreApplication::self,
"QCoreApplication",
"there should be only one application object");
787 QCoreApplication::self =
q;
789 #if QT_CONFIG(thread)
792 if (hardwareConcurrency.isUndefined())
793 QThreadPrivate::idealThreadCount = 2;
795 QThreadPrivate::idealThreadCount = hardwareConcurrency.as<
int>();
800 if (!coreappdata()->applicationNameSet)
801 coreappdata()->application =
appName();
803 if (!coreappdata()->applicationVersionSet)
804 coreappdata()->applicationVersion =
appVersion();
806 #if defined(Q_OS_ANDROID)
814 #if QT_CONFIG(library)
818 QStringList *appPaths = coreappdata()->app_libpaths.release();
819 QStringList *manualPaths = coreappdata()->manual_libpaths.release();
827 for (
qsizetype i = manualPaths->length(),
j = appPaths->length();
i > 0 ||
j > 0; qt_noop()) {
829 newPaths.prepend((*manualPaths)[--
i]);
830 }
else if (--
i < 0) {
831 newPaths.removeAll((*appPaths)[
j]);
832 }
else if ((*manualPaths)[
i] != (*appPaths)[
j]) {
833 newPaths.removeAll((*appPaths)[
j]);
838 coreappdata()->manual_libpaths.reset(
new QStringList(newPaths));
844 #ifndef QT_NO_QOBJECT
866 qt_call_pre_routines();
868 #ifndef QT_BOOTSTRAPPED
874 #ifndef QT_NO_QOBJECT
884 preRoutinesCalled =
false;
889 #ifndef QT_NO_QOBJECT
894 #if QT_CONFIG(thread)
902 if (globalThreadPool) {
904 delete globalThreadPool;
908 #ifndef QT_NO_QOBJECT
909 d_func()->threadData.loadRelaxed()->eventDispatcher =
nullptr;
915 #if QT_CONFIG(library)
916 coreappdata()->app_libpaths.reset();
917 coreappdata()->manual_libpaths.reset();
976 #if defined(QT_NO_QOBJECT)
987 #ifdef QT_BOOTSTRAPPED
988 qWarning(
"Attribute %d must be set before QCoreApplication is created.",
991 qWarning(
"Attribute Qt::%s must be set before QCoreApplication is created.",
992 QMetaEnum::fromType<Qt::ApplicationAttribute>().valueToKey(
attribute));
1012 #ifndef QT_NO_QOBJECT
1047 if (!
self && selfRequired)
1066 return doNotify(receiver,
event);
1067 return self->notify(receiver,
event);
1079 if (
event && originatingEvent)
1080 event->m_spont = originatingEvent->m_spont;
1082 return notifyInternal2(receiver,
event);
1146 return doNotify(receiver,
event);
1154 if (receiver ==
nullptr) {
1155 qWarning(
"QCoreApplication::notify: Unexpected null receiver");
1169 Q_ASSERT(receiver->d_func()->threadData.loadRelaxed()->
thread.loadAcquire() == mainThread());
1173 for (
qsizetype i = 0;
i < extraData->eventFilters.size(); ++
i) {
1177 if (
obj->d_func()->threadData.loadRelaxed() != threadData.loadRelaxed()) {
1178 qWarning(
"QCoreApplication: Application event filter cannot be in a different thread.");
1181 if (
obj->eventFilter(receiver,
event))
1191 for (
qsizetype i = 0;
i < receiver->d_func()->extraData->eventFilters.size(); ++
i) {
1192 QObject *
obj = receiver->d_func()->extraData->eventFilters.at(
i);
1195 if (
obj->d_func()->threadData.loadRelaxed() != receiver->d_func()->threadData.loadRelaxed()) {
1196 qWarning(
"QCoreApplication: Object event filter cannot be in a different thread.");
1199 if (
obj->eventFilter(receiver,
event))
1216 bool consumed =
false;
1221 if (QCoreApplication::self
1222 && receiver->d_func()->threadData.loadRelaxed()->
thread.loadAcquire() == mainThread()
1223 && QCoreApplication::self->d_func()->sendThroughApplicationEventFilters(receiver,
event)) {
1228 if (sendThroughObjectEventFilters(receiver,
event)) {
1294 if (!
data->hasEventDispatcher())
1296 data->eventDispatcher.loadRelaxed()->processEvents(
flags);
1329 if (!
data->hasEventDispatcher())
1374 QThreadData *threadData =
self->d_func()->threadData;
1376 qWarning(
"%s::exec: Must be called from the main thread", self->metaObject()->className());
1380 qWarning(
"QCoreApplication::exec: The event loop is already running");
1386 self->d_func()->in_exec =
true;
1387 self->d_func()->aboutToQuitEmitted =
false;
1392 self->d_func()->execCleanup();
1405 threadData.loadRelaxed()->
quitNow =
false;
1407 if (!aboutToQuitEmitted)
1408 emit q_func()->aboutToQuit(QCoreApplication::QPrivateSignal());
1409 aboutToQuitEmitted =
true;
1452 eventLoop->
exit(returnCode);
1460 #ifndef QT_NO_QOBJECT
1477 Q_ASSERT_X(receiver,
"QCoreApplication::sendEvent",
"Unexpected null receiver");
1478 Q_ASSERT_X(
event,
"QCoreApplication::sendEvent",
"Unexpected null event");
1482 event->m_spont =
false;
1483 return notifyInternal2(receiver,
event);
1491 Q_ASSERT_X(receiver,
"QCoreApplication::sendSpontaneousEvent",
"Unexpected null receiver");
1492 Q_ASSERT_X(
event,
"QCoreApplication::sendSpontaneousEvent",
"Unexpected null event");
1496 event->m_spont =
true;
1497 return notifyInternal2(receiver,
event);
1517 locker.
threadData = threadData.loadAcquire();
1524 if (locker.
threadData == threadData.loadAcquire()) {
1525 locker.
locker = std::move(temporaryLocker);
1561 Q_ASSERT_X(
event,
"QCoreApplication::postEvent",
"Unexpected null event");
1566 if (receiver ==
nullptr) {
1567 qWarning(
"QCoreApplication::postEvent: Unexpected null receiver");
1573 if (!locker.threadData) {
1582 if (receiver->d_func()->postedEvents
1584 Q_TRACE(QCoreApplication_postEvent_event_compressed, receiver,
event);
1606 int loopLevel =
data->loopLevel;
1607 int scopeLevel =
data->scopeLevel;
1608 if (scopeLevel == 0 && loopLevel != 0)
1615 std::unique_ptr<QEvent> eventDeleter(
event);
1616 Q_TRACE(QCoreApplication_postEvent_event_posted, receiver,
event,
event->type());
1619 event->m_posted =
true;
1620 ++receiver->d_func()->postedEvents;
1621 data->canWait =
false;
1643 for (
const QPostEvent &
e : std::as_const(*postedEvents)) {
1666 for (
const QPostEvent &cur : std::as_const(*postedEvents)) {
1667 if (cur.receiver != receiver
1668 || cur.
event ==
nullptr
1669 || cur.event->type() !=
event->type())
1710 if (event_type == -1) {
1715 if (receiver && receiver->d_func()->threadData.loadRelaxed() !=
data) {
1716 qWarning(
"QCoreApplication::sendPostedEvents: Cannot send "
1717 "posted events for objects in another thread");
1721 ++
data->postEventList.recursion;
1728 data->canWait = (
data->postEventList.size() == 0);
1730 if (
data->postEventList.size() == 0 || (receiver && !receiver->d_func()->postedEvents)) {
1731 --
data->postEventList.recursion;
1735 data->canWait =
true;
1740 qsizetype &
i = (!event_type && !receiver) ?
data->postEventList.startOffset : startOffset;
1741 data->postEventList.insertionOffset =
data->postEventList.size();
1748 bool exceptionCaught;
1751 receiver(receiver), event_type(event_type),
data(
data), exceptionCaught(
true)
1755 if (exceptionCaught) {
1757 data->canWait =
false;
1760 --
data->postEventList.recursion;
1761 if (!
data->postEventList.recursion && !
data->canWait &&
data->hasEventDispatcher())
1762 data->eventDispatcher.loadRelaxed()->wakeUp();
1766 if (!event_type && !receiver &&
data->postEventList.startOffset >= 0) {
1768 data->postEventList.erase(
it,
it +
data->postEventList.startOffset);
1769 data->postEventList.insertionOffset -=
data->postEventList.startOffset;
1771 data->postEventList.startOffset = 0;
1777 while (i < data->postEventList.size()) {
1779 if (
i >=
data->postEventList.insertionOffset)
1787 if ((receiver && receiver != pe.
receiver) || (event_type && event_type != pe.
event->
type())) {
1788 data->canWait =
false;
1801 const bool allowDeferredDelete =
1802 (eventLevel > loopLevel
1803 || (!eventLevel && loopLevel > 0)
1805 && eventLevel == loopLevel));
1806 if (!allowDeferredDelete) {
1808 if (!event_type && !receiver) {
1820 data->postEventList.addEvent(pe_copy);
1828 pe.
event->m_posted =
false;
1832 --
r->d_func()->postedEvents;
1833 Q_ASSERT(
r->d_func()->postedEvents >= 0);
1840 const auto relocker =
qScopeGuard([&locker] { locker.lock(); });
1852 cleanup.exceptionCaught =
false;
1883 if (receiver && !receiver->d_func()->postedEvents)
1895 if ((!receiver || pe.
receiver == receiver)
1896 && (pe.
event && (eventType == 0 || pe.
event->
type() == eventType))) {
1897 --pe.
receiver->d_func()->postedEvents;
1898 pe.
event->m_posted =
false;
1901 }
else if (!
data->postEventList.recursion) {
1909 if (receiver && eventType == 0) {
1910 Q_ASSERT(!receiver->d_func()->postedEvents);
1914 if (!
data->postEventList.recursion) {
1916 data->postEventList.erase(
data->postEventList.begin() +
j,
data->postEventList.end());
1942 if (
data->postEventList.size() == 0) {
1943 #if defined(QT_DEBUG)
1944 qDebug(
"QCoreApplication::removePostedEvent: Internal error: %p %d is posted",
1950 for (
const QPostEvent &pe : std::as_const(
data->postEventList)) {
1951 if (pe.event ==
event) {
1953 qWarning(
"QCoreApplication::removePostedEvent: Event of type %d deleted while posted to %s %s",
1955 pe.receiver->metaObject()->className(),
1956 pe.receiver->objectName().toLocal8Bit().data());
1958 --pe.receiver->d_func()->postedEvents;
1959 pe.event->m_posted =
false;
1986 quitLockRef.deref();
1989 quitAutomatically();
2055 if (!self->d_func()->in_exec)
2058 self->d_func()->quit();
2090 #ifndef QT_NO_TRANSLATION
2120 if (!translationFile)
2128 d->translators.prepend(translationFile);
2131 #ifndef QT_NO_TRANSLATION_BUILDER
2132 if (translationFile->
isEmpty())
2136 #ifndef QT_NO_QOBJECT
2156 if (!translationFile)
2162 if (
d->translators.removeAll(translationFile)) {
2163 #ifndef QT_NO_QOBJECT
2182 if (percentPos +
len ==
result->length())
2187 if (percentPos +
len ==
result->length())
2236 const char *disambiguation,
int n)
2246 if (!
d->translators.isEmpty()) {
2249 for (
it =
d->translators.constBegin();
it !=
d->translators.constEnd(); ++
it) {
2250 translationFile = *
it;
2273 if (!QCoreApplication::self)
2277 return d->translators.contains(translator);
2283 const char *disambiguation,
int n)
2331 qWarning(
"QCoreApplication::applicationDirPath: Please instantiate the QApplication object first");
2336 if (
d->cachedApplicationDirPath.isNull())
2338 return d->cachedApplicationDirPath;
2341 #if !defined(Q_OS_WIN) && !defined(Q_OS_DARWIN)
2344 # if defined(Q_OS_ANDROID)
2347 # elif defined(Q_OS_LINUX)
2350 # elif defined(AT_EXECPATH)
2353 if (elf_aux_info(AT_EXECPATH, execfn,
sizeof(execfn)) != 0)
2383 qWarning(
"QCoreApplication::applicationFilePath: Please instantiate the QApplication object first");
2391 if (procName !=
d->argv[0]) {
2441 #if defined(Q_OS_WIN)
2442 return GetCurrentProcessId();
2443 #elif defined(Q_OS_VXWORKS)
2444 return (pid_t) taskIdCurrent;
2486 qWarning(
"QCoreApplication::arguments: Please instantiate the QApplication object first");
2492 const int argc =
d->argc;
2493 char **
const argv =
d->argv;
2496 #if defined(Q_OS_WIN)
2497 const bool argsModifiedByUser =
d->origArgv ==
nullptr;
2498 if (!argsModifiedByUser) {
2505 QStringList commandLineArguments = qWinCmdArgs(cmdline);
2510 if (argc !=
d->origArgc) {
2517 for (
int i = 0;
i <
d->origArgc; ++
i) {
2523 return commandLineArguments;
2527 for (
int a = 0;
a < argc; ++
a)
2559 if (coreappdata()->orgName == orgName)
2561 coreappdata()->orgName = orgName;
2562 #ifndef QT_NO_QOBJECT
2563 if (QCoreApplication::self)
2570 return coreappdata()->orgName;
2596 if (coreappdata()->orgDomain == orgDomain)
2598 coreappdata()->orgDomain = orgDomain;
2599 #ifndef QT_NO_QOBJECT
2600 if (QCoreApplication::self)
2607 return coreappdata()->orgDomain;
2630 coreappdata()->applicationNameSet = !application.
isEmpty();
2631 QString newAppName = application;
2632 if (newAppName.
isEmpty() && QCoreApplication::self)
2633 newAppName = QCoreApplication::self->d_func()->appName();
2634 if (coreappdata()->application == newAppName)
2636 coreappdata()->application = newAppName;
2637 #ifndef QT_NO_QOBJECT
2638 if (QCoreApplication::self)
2645 return coreappdata() ? coreappdata()->application :
QString();
2683 coreappdata()->applicationVersionSet = !
version.isEmpty();
2685 if (newVersion.
isEmpty() && QCoreApplication::self)
2686 newVersion = QCoreApplication::self->d_func()->appVersion();
2690 #ifndef QT_NO_QOBJECT
2691 if (QCoreApplication::self)
2698 return coreappdata() ? coreappdata()->applicationVersion :
QString();
2701 #if QT_CONFIG(library)
2742 return libraryPathsLocked();
2748 QStringList QCoreApplication::libraryPathsLocked()
2750 if (coreappdata()->manual_libpaths)
2751 return *(coreappdata()->manual_libpaths);
2753 if (!coreappdata()->app_libpaths) {
2755 coreappdata()->app_libpaths.reset(app_libpaths);
2757 auto setPathsFromEnv = [&](
QString libPathEnv) {
2758 if (!libPathEnv.isEmpty()) {
2763 && !app_libpaths->contains(canonicalPath)) {
2764 app_libpaths->append(canonicalPath);
2778 if (CFBundleRef bundleRef = CFBundleGetMainBundle()) {
2781 if (
QCFString path = CFURLCopyFileSystemPath(absoluteUrlRef, kCFURLPOSIXPathStyle)) {
2784 if (!app_libpaths->contains(
path))
2785 app_libpaths->append(
path);
2797 if (!app_libpaths->contains(installPathPlugins))
2798 app_libpaths->append(installPathPlugins);
2803 if (
self)
self->d_func()->appendApplicationPathToLibraryPaths();
2805 return *(coreappdata()->app_libpaths);
2829 if (!coreappdata()->app_libpaths)
2830 libraryPathsLocked();
2832 if (coreappdata()->manual_libpaths)
2833 *(coreappdata()->manual_libpaths) =
paths;
2838 QFactoryLoader::refreshAll();
2857 void QCoreApplication::addLibraryPath(
const QString &
path)
2868 QStringList *libpaths = coreappdata()->manual_libpaths.get();
2870 if (libpaths->contains(canonicalPath))
2874 libraryPathsLocked();
2875 QStringList *app_libpaths = coreappdata()->app_libpaths.get();
2876 if (app_libpaths->contains(canonicalPath))
2879 coreappdata()->manual_libpaths.reset(libpaths =
new QStringList(*app_libpaths));
2882 libpaths->prepend(canonicalPath);
2884 QFactoryLoader::refreshAll();
2896 void QCoreApplication::removeLibraryPath(
const QString &
path)
2907 QStringList *libpaths = coreappdata()->manual_libpaths.get();
2909 if (libpaths->removeAll(canonicalPath) == 0)
2913 libraryPathsLocked();
2914 QStringList *app_libpaths = coreappdata()->app_libpaths.get();
2915 if (!app_libpaths->contains(canonicalPath))
2918 coreappdata()->manual_libpaths.reset(libpaths =
new QStringList(*app_libpaths));
2919 libpaths->removeAll(canonicalPath);
2923 QFactoryLoader::refreshAll();
2928 #ifndef QT_NO_QOBJECT
2962 qWarning(
"Native event filters are not applied when the Qt::AA_PluginApplication attribute is set");
3137 #ifndef QT_NO_QOBJECT
3138 #include "moc_qcoreapplication.cpp"
small capitals from c petite p scientific i
[1]
The QAbstractEventDispatcher class provides an interface to manage Qt's event queue.
static QAbstractEventDispatcher * instance(QThread *thread=nullptr)
virtual void startingUp()
void installNativeEventFilter(QAbstractNativeEventFilter *filterObj)
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj)
virtual void closingDown()
The QAbstractNativeEventFilter class provides an interface for receiving native events,...
Type loadAcquire() const noexcept
Type loadRelaxed() const noexcept
The QByteArray class provides an array of bytes.
const char * constData() const noexcept
qsizetype indexOf(char c, qsizetype from=0) const
void truncate(qsizetype pos)
bool isEmpty() const noexcept
static QByteArray fromRawData(const char *data, qsizetype size)
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
The QCoreApplication class provides an event loop for Qt applications without UI.
void * resolveInterface(const char *name, int revision) const
static QAbstractEventDispatcher * eventDispatcher()
static QString applicationFilePath()
static QCoreApplication * instance()
void organizationDomainChanged()
static bool sendEvent(QObject *receiver, QEvent *event)
static bool isSetuidAllowed()
bool event(QEvent *) override
static void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *)
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj)
virtual bool notify(QObject *, QEvent *)
static void removePostedEvents(QObject *receiver, int eventType=0)
void qRemovePostRoutine(QtCleanUpFunction ptr)
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
static void setOrganizationDomain(const QString &orgDomain)
void applicationNameChanged()
static bool isQuitLockEnabled()
void organizationNameChanged()
static void setAttribute(Qt::ApplicationAttribute attribute, bool on=true)
[95]
QString applicationVersion
the version of this application
static bool closingDown()
void qAddPostRoutine(QtCleanUpFunction ptr)
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
void installNativeEventFilter(QAbstractNativeEventFilter *filterObj)
static bool testAttribute(Qt::ApplicationAttribute attribute)
QString organizationName
the name of the organization that wrote this application
static void setOrganizationName(const QString &orgName)
[11]
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
static QString applicationDirPath()
static void setApplicationName(const QString &application)
static bool installTranslator(QTranslator *messageFile)
static qint64 applicationPid() Q_DECL_CONST_FUNCTION
static void setApplicationVersion(const QString &version)
static bool removeTranslator(QTranslator *messageFile)
static QStringList arguments()
static void setQuitLockEnabled(bool enabled)
QString applicationName
the name of this application
void applicationVersionChanged()
static void setSetuidAllowed(bool allow)
static void sendPostedEvents(QObject *receiver=nullptr, int event_type=0)
static void exit(int retcode=0)
bool quitLockEnabled
Whether the use of the QEventLoopLocker feature can cause the application to quit.
QString organizationDomain
the Internet domain of the organization that wrote this application
static bool checkInstance(const char *method)
static bool isTranslatorInstalled(QTranslator *translator)
static bool is_app_closing
QString appVersion() const
void appendApplicationPathToLibraryPaths(void)
static bool setuidAllowed
static QPostEventListLocker lockThreadPostEventList(QObject *object)
static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data)
~QCoreApplicationPrivate()
static int app_compile_version
bool sendThroughApplicationEventFilters(QObject *, QEvent *)
static QAbstractEventDispatcher * eventDispatcher
void processCommandLineArguments()
static QString * cachedApplicationFilePath
virtual void eventDispatcherReady()
static bool sendThroughObjectEventFilters(QObject *, QEvent *)
static QBasicAtomicPointer< QThread > theMainThread
static bool is_app_running
static void checkReceiverThread(QObject *receiver)
static bool testAttribute(uint flag)
virtual void createEventDispatcher()
static void clearApplicationFilePath()
static QThread * mainThread()
static void removePostedEvent(QEvent *)
QCoreApplicationPrivate(int &aargc, char **aargv, uint flags)
virtual bool canQuitAutomatically()
static void setApplicationFilePath(const QString &path)
static bool threadRequiresCoreApplication()
static bool notify_helper(QObject *, QEvent *)
QString qmljs_debug_arguments
The QDir class provides access to directory structures and their contents.
QString canonicalPath() const
QString absoluteFilePath(const QString &fileName) const
constexpr static QChar listSeparator() noexcept
The QElapsedTimer class provides a fast way to calculate elapsed times.
The QEvent class is the base class of all event classes. Event objects contain event parameters.
The QEventLoop class provides a means of entering and leaving an event loop.
int exec(ProcessEventsFlags flags=AllEvents)
void exit(int returnCode=0)
static QString decodeName(const QByteArray &localFileName)
The QFileInfo class provides system-independent file information.
QString canonicalFilePath() const
static bool activateCallbacks(Callback, void **)
A convenience wrapper around the Java Native Interface (JNI).
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
static QString path(LibraryPath p)
qsizetype size() const noexcept
bool isEmpty() const noexcept
void append(parameter_type t)
static QLoggingRegistry * instance()
The QMutex class provides access serialization between threads.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes.
The QObject class is the base class of all Qt objects.
void moveToThread(QThread *thread)
QString objectName
the name of this object
virtual bool event(QEvent *event)
void setParent(QObject *parent)
friend class QCoreApplication
QScopedPointer< QObjectData > d_ptr
bool isWidgetType() const
static QObjectPrivate * get(QObject *o)
QAtomicPointer< QThreadData > threadData
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
The QRecursiveMutex class provides access serialization between threads.
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
static QString findExecutable(const QString &executableName, const QStringList &paths=QStringList())
The QString class provides a Unicode character string.
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
void truncate(qsizetype pos)
static QString fromLocal8Bit(QByteArrayView ba)
static QString fromUtf8(QByteArrayView utf8)
const QChar at(qsizetype i) const
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=QLatin1Char(' ')) const
QByteArray toLocal8Bit() const &
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
The QStringList class provides a list of strings.
static Q_AUTOTEST_EXPORT QThreadData * current(bool createIfNecessary=true)
QStack< QEventLoop * > eventLoops
static QThreadData * get2(QThread *thread)
QPostEventList postEventList
QAbstractEventDispatcher * eventDispatcher() const
static QThread * currentThread()
void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
The QThreadPool class manages a collection of QThreads.
static QThreadPool * globalInstance()
bool waitForDone(int msecs=-1)
The QTimerEvent class contains parameters that describe a timer event.
The QTranslator class provides internationalization support for text output.
virtual bool isEmpty() const
virtual QString translate(const char *context, const char *sourceText, const char *disambiguation=nullptr, int n=-1) const
constexpr size_type size() const noexcept
The QWriteLocker class is a convenience class that simplifies locking and unlocking read-write locks ...
qDeleteAll(list.begin(), list.end())
typename C::const_iterator const_iterator
typename C::iterator iterator
void(* StartupCallback)()
std::chrono::milliseconds ms
Lock qt_scoped_lock(Mutex &mutex)
Lock qt_unique_lock(Mutex &mutex)
QFuture< typename std::decay_t< Sequence >::value_type > filtered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&keep)
@ AA_SynthesizeMouseForUnhandledTabletEvents
@ AA_SynthesizeMouseForUnhandledTouchEvents
void initBindingStatusThreadId()
int PRIV() strcmp(PCRE2_SPTR str1, PCRE2_SPTR str2)
int PRIV() strncmp(PCRE2_SPTR str1, PCRE2_SPTR str2, size_t len)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
[3]
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld cleanup[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
#define Q_BASIC_ATOMIC_INITIALIZER(a)
size_t qstrlen(const char *str)
#define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N)
QList< QString > QStringList
QT_BEGIN_NAMESPACE QByteArray qt_readlink(const char *path)
void qAddPreRoutine(QtStartUpFunction p)
QString qtTrId(const char *id, int n)
Q_CORE_EXPORT uint qGlobalPostedEventsCount()
QList< QtStartUpFunction > QStartUpFuncList
void Q_CORE_EXPORT qt_startup_hook()
void Q_CORE_EXPORT qt_call_post_routines()
void(* QtCleanUpFunction)()
void(* QtStartUpFunction)()
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint attribute
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
#define QT_VERSION_CHECK(major, minor, patch)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
QT_BEGIN_NAMESPACE quintptr Q_CORE_EXPORT qtHookData[]
GLboolean GLboolean GLboolean b
GLenum GLuint GLint level
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei const GLuint * paths
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
#define Q_ASSERT_X(cond, x, msg)
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
#define QStringLiteral(str)
#define Q_TRACE_SCOPE(x,...)
#define Q_TRACE_EXIT(x,...)
QString applicationVersion
QCoreApplicationData() noexcept
bool applicationVersionSet
std::unique_lock< QMutex > locker
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.