Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcoreapplication_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCOREAPPLICATION_P_H
5#define QCOREAPPLICATION_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "QtCore/qcoreapplication.h"
19#if QT_CONFIG(commandlineparser)
20#include "QtCore/qcommandlineoption.h"
21#endif
22#include "QtCore/qreadwritelock.h"
23#include "QtCore/qtranslator.h"
24#if QT_CONFIG(settings)
25#include "QtCore/qsettings.h"
26#endif
27#ifndef QT_NO_QOBJECT
28#include <qloggingcategory.h>
29#include "private/qobject_p.h"
30#include "private/qlocking_p.h"
31#endif
32
33#ifdef Q_OS_MACOS
34#include "private/qcore_mac_p.h"
35#endif
36
38
39#ifndef QT_NO_QOBJECT
40Q_DECLARE_LOGGING_CATEGORY(lcDeleteLater)
41#endif
42
43typedef QList<QTranslator*> QTranslatorList;
44
46
47#ifndef QT_NO_QOBJECT
48class QEvent;
49#endif
50
51class Q_CORE_EXPORT QCoreApplicationPrivate
52#ifndef QT_NO_QOBJECT
53 : public QObjectPrivate
54#endif
55{
56 Q_DECLARE_PUBLIC(QCoreApplication)
57
58public:
59 enum Type {
61 Gui
62 };
63
64 QCoreApplicationPrivate(int &aargc, char **aargv);
65
66 // If not inheriting from QObjectPrivate: force this class to be polymorphic
67#ifdef QT_NO_QOBJECT
68 virtual
69#endif
71
72 void init();
73
74 QString appName() const;
75 QString appVersion() const;
76
77#ifdef Q_OS_DARWIN
78 static QString infoDictionaryStringProperty(const QString &propertyName);
79#endif
80
81 void initConsole();
82 static void initLocale();
83
84 static bool checkInstance(const char *method);
85
86#if QT_CONFIG(commandlineparser)
87 virtual void addQtOptions(QList<QCommandLineOption> *options);
88#endif
89
90#ifndef QT_NO_QOBJECT
91 bool sendThroughApplicationEventFilters(QObject *, QEvent *);
92 static bool sendThroughObjectEventFilters(QObject *, QEvent *);
93 static bool notify_helper(QObject *, QEvent *);
94 static inline void setEventSpontaneous(QEvent *e, bool spontaneous) { e->m_spont = spontaneous; }
95
96 virtual void createEventDispatcher();
97 virtual void eventDispatcherReady();
98 static void removePostedEvent(QEvent *);
99#ifdef Q_OS_WIN
100 static void removePostedTimerEvent(QObject *object, int timerId);
101#endif
102
104 void ref();
105 void deref();
106 virtual bool canQuitAutomatically();
107 void quitAutomatically();
108 virtual void quit();
109
110 static QBasicAtomicPointer<QThread> theMainThread;
111 static QBasicAtomicPointer<void> theMainThreadId;
112 static QThread *mainThread();
113 static bool threadRequiresCoreApplication();
114
115 static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data);
116
117 static void checkReceiverThread(QObject *receiver);
118 void cleanupThreadData();
119
121 {
123 std::unique_lock<QMutex> locker;
124
125 void unlock() { locker.unlock(); }
126 };
127 static QPostEventListLocker lockThreadPostEventList(QObject *object);
128#endif // QT_NO_QOBJECT
129
130 int &argc;
131 char **argv;
132#if defined(Q_OS_WIN)
133 int origArgc;
134 char **origArgv; // store unmodified arguments for QCoreApplication::arguments()
135 bool consoleAllocated = false;
136#endif
137 void appendApplicationPathToLibraryPaths(void);
138
139#ifndef QT_NO_TRANSLATION
142 static bool isTranslatorInstalled(QTranslator *translator);
143#endif
144
146
149 static void setApplicationFilePath(const QString &path);
150 static inline void clearApplicationFilePath() { delete cachedApplicationFilePath; cachedApplicationFilePath = nullptr; }
151
152#ifndef QT_NO_QOBJECT
153 void execCleanup();
154
158
160 static bool is_app_running;
161 static bool is_app_closing;
162#endif
163
164 static bool setuidAllowed;
165 static uint attribs;
166 static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
167
168 void processCommandLineArguments();
169 QString qmljs_debug_arguments; // a string containing arguments for js/qml debugging.
170 inline QString qmljsDebugArgumentsString() const { return qmljs_debug_arguments; }
171
172#ifdef QT_NO_QOBJECT
173 QCoreApplication *q_ptr;
174#endif
175};
176
178
179#endif // QCOREAPPLICATION_P_H
\inmodule QtCore
Definition qatomic.h:112
static void setEventSpontaneous(QEvent *e, bool spontaneous)
QCoreApplicationPrivate::Type application_type
QString qmljsDebugArgumentsString() const
static QString * cachedApplicationFilePath
static QAbstractEventDispatcher * eventDispatcher
static bool testAttribute(uint flag)
static void clearApplicationFilePath()
static QBasicAtomicPointer< void > theMainThreadId
static QBasicAtomicPointer< QThread > theMainThread
\inmodule QtCore
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qtranslator.h:19
Combined button and popup list for selecting options.
static QThread * mainThread
QT_BEGIN_NAMESPACE typedef QList< QTranslator * > QTranslatorList
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint ref
GLsizei const GLchar *const * path
const GLint * attribs
unsigned int uint
Definition qtypes.h:34
Definition moc.h:23