Qt 6.x
The Qt SDK
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 "private/qobject_p.h"
29#include "private/qlocking_p.h"
30#endif
31
32#ifdef Q_OS_MACOS
33#include "private/qcore_mac_p.h"
34#endif
35
37
39
41
42#ifndef QT_NO_QOBJECT
43class QEvent;
44#endif
45
46class Q_CORE_EXPORT QCoreApplicationPrivate
47#ifndef QT_NO_QOBJECT
48 : public QObjectPrivate
49#endif
50{
51 Q_DECLARE_PUBLIC(QCoreApplication)
52
53public:
54 enum Type {
56 Gui
57 };
58
59 QCoreApplicationPrivate(int &aargc, char **aargv);
60
61 // If not inheriting from QObjectPrivate: force this class to be polymorphic
62#ifdef QT_NO_QOBJECT
63 virtual
64#endif
66
67 void init();
68
69 QString appName() const;
70 QString appVersion() const;
71
72#ifdef Q_OS_DARWIN
73 static QString infoDictionaryStringProperty(const QString &propertyName);
74#endif
75
76 void initConsole();
77 static void initLocale();
78
79 static bool checkInstance(const char *method);
80
81#if QT_CONFIG(commandlineparser)
82 virtual void addQtOptions(QList<QCommandLineOption> *options);
83#endif
84
85#ifndef QT_NO_QOBJECT
86 bool sendThroughApplicationEventFilters(QObject *, QEvent *);
87 static bool sendThroughObjectEventFilters(QObject *, QEvent *);
88 static bool notify_helper(QObject *, QEvent *);
89 static inline void setEventSpontaneous(QEvent *e, bool spontaneous) { e->m_spont = spontaneous; }
90
91 virtual void createEventDispatcher();
92 virtual void eventDispatcherReady();
93 static void removePostedEvent(QEvent *);
94#ifdef Q_OS_WIN
95 static void removePostedTimerEvent(QObject *object, int timerId);
96#endif
97
99 void ref();
100 void deref();
101 virtual bool canQuitAutomatically();
102 void quitAutomatically();
103 virtual void quit();
104
106 static QThread *mainThread();
107 static bool threadRequiresCoreApplication();
108
109 static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data);
110
111 static void checkReceiverThread(QObject *receiver);
112 void cleanupThreadData();
113
115 {
117 std::unique_lock<QMutex> locker;
118
119 void unlock() { locker.unlock(); }
120 };
121 static QPostEventListLocker lockThreadPostEventList(QObject *object);
122#endif // QT_NO_QOBJECT
123
124 int &argc;
125 char **argv;
126#if defined(Q_OS_WIN)
127 int origArgc;
128 char **origArgv; // store unmodified arguments for QCoreApplication::arguments()
129 bool consoleAllocated = false;
130#endif
131 void appendApplicationPathToLibraryPaths(void);
132
133#ifndef QT_NO_TRANSLATION
136 static bool isTranslatorInstalled(QTranslator *translator);
137#endif
138
140
143 static void setApplicationFilePath(const QString &path);
144 static inline void clearApplicationFilePath() { delete cachedApplicationFilePath; cachedApplicationFilePath = nullptr; }
145
146#ifndef QT_NO_QOBJECT
147 void execCleanup();
148
152
154 static bool is_app_running;
155 static bool is_app_closing;
156#endif
157
158 static bool setuidAllowed;
159 static uint attribs;
160 static inline bool testAttribute(uint flag) { return attribs & (1 << flag); }
161
162 void processCommandLineArguments();
163 QString qmljs_debug_arguments; // a string containing arguments for js/qml debugging.
164 inline QString qmljsDebugArgumentsString() const { return qmljs_debug_arguments; }
165
166#ifdef QT_NO_QOBJECT
168#endif
169};
170
172
173#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< QThread > theMainThread
\inmodule QtCore
\inmodule QtCore
Definition qcoreevent.h:45
Definition qlist.h:74
QObject * q_ptr
Definition qobject.h:60
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qtranslator.h:19
double e
Combined button and popup list for selecting options.
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
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint ref
GLsizei const GLchar *const * path
const GLint * attribs
unsigned int uint
Definition qtypes.h:29
Definition moc.h:24