2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2021-02-10 18:06:09 +00:00
|
|
|
** Copyright (C) 2021 The Qt Company Ltd.
|
2016-01-15 07:08:27 +00:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the QtCore module of the Qt Toolkit.
|
|
|
|
**
|
2016-01-15 07:08:27 +00:00
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
2012-09-19 12:28:29 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 07:08:27 +00:00
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2016-01-15 07:08:27 +00:00
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 3 requirements
|
|
|
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
2016-01-15 07:08:27 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 2.0 or (at your option) the GNU General
|
|
|
|
** Public license version 3 or any later version approved by the KDE Free
|
|
|
|
** Qt Foundation. The licenses are as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef QCOREAPPLICATION_H
|
|
|
|
#define QCOREAPPLICATION_H
|
|
|
|
|
2012-12-06 19:02:08 +00:00
|
|
|
#include <QtCore/qglobal.h>
|
|
|
|
#include <QtCore/qstring.h>
|
|
|
|
#ifndef QT_NO_QOBJECT
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <QtCore/qcoreevent.h>
|
|
|
|
#include <QtCore/qeventloop.h>
|
2021-05-08 03:50:49 +00:00
|
|
|
#if QT_CONFIG(future)
|
2021-03-02 22:59:29 +00:00
|
|
|
#include <QtCore/qfuture.h>
|
|
|
|
#include <QtCore/qpermission.h>
|
2021-05-08 03:50:49 +00:00
|
|
|
#endif
|
|
|
|
#include <QtCore/qobject.h>
|
2012-12-06 19:02:08 +00:00
|
|
|
#else
|
|
|
|
#include <QtCore/qscopedpointer.h>
|
|
|
|
#endif
|
Rejig native interface plumbing
The initial approach for providing public access to native
interfaces via T::nativeInteface<I>() was based on the template
not being defined, and then having explicit instantiations of
the supported types in a source file, so that the accessors
were exported and available to the user.
This worked fine for "simple" types such as QOpenGLContext
and QOffscreenSurface, but presented a problem in the context
of classes with subclasses, such as Q{Core,Gui}Application.
To ensure that a native interface for QCoreApplication was
accessible both from QCoreApplication and its subclasses,
while at the same time preventing a native interface for
QGuiApplication to be accessible for QCoreApplication, the
nativeInterface() template function had to be declared in
each subclass. Which in turn meant specializing each native
interface once for each subclass it was available in.
This quickly became tedious to manage, and the requirements
for exposing a new native interface wasn't very clear with
all these template specializations and explicit instantiations
spread around.
To improve on this situation, while also squashing a few
other birds at the same time, we change the approach to
use type erasure. The definition of T::nativeInteface<I>()
is now inline, passing on the requested interface to a per
type (T, not I) helper function, with the interface type
flattened to a std::type_info.
The type_info requested by the user is then compared to the
available types in a single per-type (T) "switch statement",
which is a lot easier to follow for someone trying to trace
the logic of how a native interface is resolved.
We can safely rely on type_info being stable between the user
application and the Qt library as a result of exporting the
type info for each native interface, by explicitly ensuring
they have a key function. This is the same mechanism that
ensures we can safely dynamic_cast these interfaces, even
across library boundaries.
The use of a free standing templated helper function instead
of a member function in the type T, is to avoid shadowing issues,
and to not pollute the class namespace of T with the helper
function.
Since we are already changing the plumbing for how a user
resolves a native interface for a type T, we take the opportunity
to add a few extra safeguards to the machinery.
First, we add a static assert in the T::nativeInteface<I>()
definition, that ensures that only compatible interfaces,
as declared by the interface themselves, are allowed.
This ensures a compile time error when an incompatible
interface is requested, which improves on the link time
errors we had prior to this patch, and also offsets the
one downside of type erasure, namely that errors are only
caught at runtime.
Secondly, each interface meant for public consumption through
T::nativeInteface<I>() is declared with a revision, which
is checked when requesting the interface. This allows us
to bump the revision when we make breaking changes to the
interface that would have otherwise been binary incompatible.
Since the user will never see this interface due to the
revision check, they will not end up calling methods that
have been removed or renamed.
One advantage of moving to a type-erased approach for the
plumbing is that we're not longer exposing the native
interface types as part of the T::nativeInteface symbols.
This means that if we ever want to rename a native interface,
the only exported symbol that the user code relies on is
the type info. Renaming is then possible by just exporting
the type info for the old interface, but leaving it empty.
Since no class in Qt implements the old native interface,
the user will just get a nullptr back, similarly to bumping
the revision of an interface.
Change-Id: Ie50d8fb536aafe2836370caacb22afbcfaf1712a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-05-07 11:16:36 +00:00
|
|
|
#include <QtCore/qnativeinterface.h>
|
2020-10-09 13:33:05 +00:00
|
|
|
#ifndef QT_NO_DEBUGSTREAM
|
|
|
|
#include <QtCore/qdebug.h>
|
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifndef QT_NO_QOBJECT
|
2011-05-24 07:14:43 +00:00
|
|
|
#if defined(Q_OS_WIN) && !defined(tagMSG)
|
2011-04-27 10:05:43 +00:00
|
|
|
typedef struct tagMSG MSG;
|
|
|
|
#endif
|
2012-12-06 19:02:08 +00:00
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
|
|
|
|
class QCoreApplicationPrivate;
|
|
|
|
class QTranslator;
|
|
|
|
class QPostEventList;
|
2011-09-08 15:40:55 +00:00
|
|
|
class QAbstractEventDispatcher;
|
2012-06-23 19:48:53 +00:00
|
|
|
class QAbstractNativeEventFilter;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#define qApp QCoreApplication::instance()
|
|
|
|
|
2012-12-06 19:02:08 +00:00
|
|
|
class Q_CORE_EXPORT QCoreApplication
|
|
|
|
#ifndef QT_NO_QOBJECT
|
|
|
|
: public QObject
|
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifndef QT_NO_QOBJECT
|
2011-04-27 10:05:43 +00:00
|
|
|
Q_OBJECT
|
2013-02-25 21:37:37 +00:00
|
|
|
Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)
|
|
|
|
Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion NOTIFY applicationVersionChanged)
|
|
|
|
Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName NOTIFY organizationNameChanged)
|
|
|
|
Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain NOTIFY organizationDomainChanged)
|
2011-10-26 11:29:51 +00:00
|
|
|
Q_PROPERTY(bool quitLockEnabled READ isQuitLockEnabled WRITE setQuitLockEnabled)
|
2012-12-06 19:02:08 +00:00
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
Q_DECLARE_PRIVATE(QCoreApplication)
|
|
|
|
public:
|
|
|
|
enum { ApplicationFlags = QT_VERSION
|
|
|
|
};
|
|
|
|
|
2012-10-16 10:55:49 +00:00
|
|
|
QCoreApplication(int &argc, char **argv
|
|
|
|
#ifndef Q_QDOC
|
|
|
|
, int = ApplicationFlags
|
|
|
|
#endif
|
|
|
|
);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
~QCoreApplication();
|
|
|
|
|
|
|
|
static QStringList arguments();
|
|
|
|
|
|
|
|
static void setAttribute(Qt::ApplicationAttribute attribute, bool on = true);
|
|
|
|
static bool testAttribute(Qt::ApplicationAttribute attribute);
|
|
|
|
|
|
|
|
static void setOrganizationDomain(const QString &orgDomain);
|
|
|
|
static QString organizationDomain();
|
|
|
|
static void setOrganizationName(const QString &orgName);
|
|
|
|
static QString organizationName();
|
|
|
|
static void setApplicationName(const QString &application);
|
|
|
|
static QString applicationName();
|
|
|
|
static void setApplicationVersion(const QString &version);
|
|
|
|
static QString applicationVersion();
|
|
|
|
|
2014-01-01 16:58:19 +00:00
|
|
|
static void setSetuidAllowed(bool allow);
|
|
|
|
static bool isSetuidAllowed();
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
static QCoreApplication *instance() { return self; }
|
|
|
|
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifndef QT_NO_QOBJECT
|
2011-04-27 10:05:43 +00:00
|
|
|
static int exec();
|
|
|
|
static void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents);
|
|
|
|
static void processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime);
|
|
|
|
|
|
|
|
static bool sendEvent(QObject *receiver, QEvent *event);
|
2012-02-19 09:15:18 +00:00
|
|
|
static void postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority);
|
2017-09-18 09:49:52 +00:00
|
|
|
static void sendPostedEvents(QObject *receiver = nullptr, int event_type = 0);
|
2012-02-19 09:15:18 +00:00
|
|
|
static void removePostedEvents(QObject *receiver, int eventType = 0);
|
2011-09-08 15:40:55 +00:00
|
|
|
static QAbstractEventDispatcher *eventDispatcher();
|
|
|
|
static void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
virtual bool notify(QObject *, QEvent *);
|
|
|
|
|
|
|
|
static bool startingUp();
|
|
|
|
static bool closingDown();
|
2012-12-06 19:02:08 +00:00
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
static QString applicationDirPath();
|
|
|
|
static QString applicationFilePath();
|
2017-09-30 17:00:32 +00:00
|
|
|
static qint64 applicationPid() Q_DECL_CONST_FUNCTION;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-12-19 09:34:32 +00:00
|
|
|
#if QT_CONFIG(library)
|
2011-04-27 10:05:43 +00:00
|
|
|
static void setLibraryPaths(const QStringList &);
|
|
|
|
static QStringList libraryPaths();
|
|
|
|
static void addLibraryPath(const QString &);
|
|
|
|
static void removeLibraryPath(const QString &);
|
2016-12-19 09:34:32 +00:00
|
|
|
#endif // QT_CONFIG(library)
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef QT_NO_TRANSLATION
|
2012-03-20 07:47:57 +00:00
|
|
|
static bool installTranslator(QTranslator * messageFile);
|
|
|
|
static bool removeTranslator(QTranslator * messageFile);
|
2011-04-27 10:05:43 +00:00
|
|
|
#endif
|
2012-05-16 21:09:56 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
static QString translate(const char * context,
|
|
|
|
const char * key,
|
2017-09-18 09:49:52 +00:00
|
|
|
const char * disambiguation = nullptr,
|
2011-11-28 14:24:25 +00:00
|
|
|
int n = -1);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
Rejig native interface plumbing
The initial approach for providing public access to native
interfaces via T::nativeInteface<I>() was based on the template
not being defined, and then having explicit instantiations of
the supported types in a source file, so that the accessors
were exported and available to the user.
This worked fine for "simple" types such as QOpenGLContext
and QOffscreenSurface, but presented a problem in the context
of classes with subclasses, such as Q{Core,Gui}Application.
To ensure that a native interface for QCoreApplication was
accessible both from QCoreApplication and its subclasses,
while at the same time preventing a native interface for
QGuiApplication to be accessible for QCoreApplication, the
nativeInterface() template function had to be declared in
each subclass. Which in turn meant specializing each native
interface once for each subclass it was available in.
This quickly became tedious to manage, and the requirements
for exposing a new native interface wasn't very clear with
all these template specializations and explicit instantiations
spread around.
To improve on this situation, while also squashing a few
other birds at the same time, we change the approach to
use type erasure. The definition of T::nativeInteface<I>()
is now inline, passing on the requested interface to a per
type (T, not I) helper function, with the interface type
flattened to a std::type_info.
The type_info requested by the user is then compared to the
available types in a single per-type (T) "switch statement",
which is a lot easier to follow for someone trying to trace
the logic of how a native interface is resolved.
We can safely rely on type_info being stable between the user
application and the Qt library as a result of exporting the
type info for each native interface, by explicitly ensuring
they have a key function. This is the same mechanism that
ensures we can safely dynamic_cast these interfaces, even
across library boundaries.
The use of a free standing templated helper function instead
of a member function in the type T, is to avoid shadowing issues,
and to not pollute the class namespace of T with the helper
function.
Since we are already changing the plumbing for how a user
resolves a native interface for a type T, we take the opportunity
to add a few extra safeguards to the machinery.
First, we add a static assert in the T::nativeInteface<I>()
definition, that ensures that only compatible interfaces,
as declared by the interface themselves, are allowed.
This ensures a compile time error when an incompatible
interface is requested, which improves on the link time
errors we had prior to this patch, and also offsets the
one downside of type erasure, namely that errors are only
caught at runtime.
Secondly, each interface meant for public consumption through
T::nativeInteface<I>() is declared with a revision, which
is checked when requesting the interface. This allows us
to bump the revision when we make breaking changes to the
interface that would have otherwise been binary incompatible.
Since the user will never see this interface due to the
revision check, they will not end up calling methods that
have been removed or renamed.
One advantage of moving to a type-erased approach for the
plumbing is that we're not longer exposing the native
interface types as part of the T::nativeInteface symbols.
This means that if we ever want to rename a native interface,
the only exported symbol that the user code relies on is
the type info. Renaming is then possible by just exporting
the type info for the old interface, but leaving it empty.
Since no class in Qt implements the old native interface,
the user will just get a nullptr back, similarly to bumping
the revision of an interface.
Change-Id: Ie50d8fb536aafe2836370caacb22afbcfaf1712a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2021-05-07 11:16:36 +00:00
|
|
|
QT_DECLARE_NATIVE_INTERFACE_ACCESSOR
|
|
|
|
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifndef QT_NO_QOBJECT
|
2021-05-08 03:50:49 +00:00
|
|
|
#if QT_CONFIG(future)
|
2021-03-02 22:59:29 +00:00
|
|
|
static QFuture<QPermission::PermissionResult> requestPermission(
|
|
|
|
QPermission::PermisionType permission);
|
|
|
|
static QFuture<QPermission::PermissionResult> requestPermission(const QString &permission);
|
|
|
|
|
|
|
|
static QFuture<QPermission::PermissionResult> checkPermission(
|
|
|
|
QPermission::PermisionType permission);
|
|
|
|
static QFuture<QPermission::PermissionResult> checkPermission(const QString &permission);
|
2021-05-08 03:50:49 +00:00
|
|
|
#endif
|
2012-06-23 19:48:53 +00:00
|
|
|
void installNativeEventFilter(QAbstractNativeEventFilter *filterObj);
|
|
|
|
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2011-10-26 11:29:51 +00:00
|
|
|
static bool isQuitLockEnabled();
|
|
|
|
static void setQuitLockEnabled(bool enabled);
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
static void quit();
|
2021-03-14 16:53:08 +00:00
|
|
|
static void exit(int retcode = 0);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
2015-04-17 08:29:04 +00:00
|
|
|
void aboutToQuit(QPrivateSignal);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-02-25 21:37:37 +00:00
|
|
|
void organizationNameChanged();
|
|
|
|
void organizationDomainChanged();
|
|
|
|
void applicationNameChanged();
|
|
|
|
void applicationVersionChanged();
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
protected:
|
2017-09-18 08:36:49 +00:00
|
|
|
bool event(QEvent *) override;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
|
2012-12-06 19:02:08 +00:00
|
|
|
#endif // QT_NO_QOBJECT
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
QCoreApplication(QCoreApplicationPrivate &p);
|
|
|
|
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifdef QT_NO_QOBJECT
|
|
|
|
QScopedPointer<QCoreApplicationPrivate> d_ptr;
|
|
|
|
#endif
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
private:
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifndef QT_NO_QOBJECT
|
2011-04-27 10:05:43 +00:00
|
|
|
static bool sendSpontaneousEvent(QObject *receiver, QEvent *event);
|
2015-04-16 22:44:16 +00:00
|
|
|
static bool notifyInternal2(QObject *receiver, QEvent *);
|
2017-05-16 16:46:50 +00:00
|
|
|
static bool forwardEvent(QObject *receiver, QEvent *event, QEvent *originatingEvent = nullptr);
|
2012-12-06 19:02:08 +00:00
|
|
|
#endif
|
QCoreApplication: work towards replacing a QRecursiveMutex with a QMutex
At first glance, libraryPathMutex is only recursive because
setLibraryPaths(), addLibraryPath() and removeLibraryPath(), all of
which lock libraryPathMutex, may call libraryPaths(), which does, too.
This is easily fixed by splitting libraryPaths() into public
libraryPaths() and private libraryPathsLocked(), the latter expecting
to be called with the libraryPathMutex already held. And this is what
this patch does.
However, on second glance, the building of the initial app_libpaths
calls a monstrous amount of code, incl. QLibraryInfo, and some of
that code probably re-enters one of the library-path functions.
So while this patch is a step towards making libraryPathMutex
non-recursive, it's probably not the end.
Change-Id: I3ed83272ace6966980cf8e1db877f24c89789da3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-08-21 20:14:16 +00:00
|
|
|
#if QT_CONFIG(library)
|
|
|
|
static QStringList libraryPathsLocked();
|
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
static QCoreApplication *self;
|
2011-10-26 11:29:51 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
Q_DISABLE_COPY(QCoreApplication)
|
|
|
|
|
|
|
|
friend class QApplication;
|
|
|
|
friend class QApplicationPrivate;
|
2011-04-27 12:56:55 +00:00
|
|
|
friend class QGuiApplication;
|
|
|
|
friend class QGuiApplicationPrivate;
|
2011-04-27 10:05:43 +00:00
|
|
|
friend class QWidget;
|
2011-05-02 07:25:17 +00:00
|
|
|
friend class QWidgetWindow;
|
2011-04-27 10:05:43 +00:00
|
|
|
friend class QWidgetPrivate;
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifndef QT_NO_QOBJECT
|
|
|
|
friend class QEventDispatcherUNIXPrivate;
|
2011-06-21 11:40:57 +00:00
|
|
|
friend class QCocoaEventDispatcherPrivate;
|
2020-10-20 08:13:49 +00:00
|
|
|
friend bool qt_sendSpontaneousEvent(QObject *, QEvent *);
|
2012-12-06 19:02:08 +00:00
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
friend Q_CORE_EXPORT QString qAppName();
|
2019-05-15 13:28:18 +00:00
|
|
|
friend class QCommandLineParserPrivate;
|
2011-04-27 10:05:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define Q_DECLARE_TR_FUNCTIONS(context) \
|
|
|
|
public: \
|
2017-09-18 09:49:52 +00:00
|
|
|
static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) \
|
2012-05-16 21:09:56 +00:00
|
|
|
{ return QCoreApplication::translate(#context, sourceText, disambiguation, n); } \
|
2011-04-27 10:05:43 +00:00
|
|
|
private:
|
|
|
|
|
2013-01-14 11:58:31 +00:00
|
|
|
typedef void (*QtStartUpFunction)();
|
2011-04-27 10:05:43 +00:00
|
|
|
typedef void (*QtCleanUpFunction)();
|
|
|
|
|
2013-01-14 11:58:31 +00:00
|
|
|
Q_CORE_EXPORT void qAddPreRoutine(QtStartUpFunction);
|
2011-04-27 10:05:43 +00:00
|
|
|
Q_CORE_EXPORT void qAddPostRoutine(QtCleanUpFunction);
|
|
|
|
Q_CORE_EXPORT void qRemovePostRoutine(QtCleanUpFunction);
|
|
|
|
Q_CORE_EXPORT QString qAppName(); // get application name
|
|
|
|
|
2013-01-14 11:58:31 +00:00
|
|
|
#define Q_COREAPP_STARTUP_FUNCTION(AFUNC) \
|
|
|
|
static void AFUNC ## _ctor_function() { \
|
|
|
|
qAddPreRoutine(AFUNC); \
|
|
|
|
} \
|
|
|
|
Q_CONSTRUCTOR_FUNCTION(AFUNC ## _ctor_function)
|
|
|
|
|
2012-12-06 19:02:08 +00:00
|
|
|
#ifndef QT_NO_QOBJECT
|
2011-05-24 07:14:43 +00:00
|
|
|
#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM)
|
2011-04-27 10:05:43 +00:00
|
|
|
Q_CORE_EXPORT QString decodeMSG(const MSG &);
|
|
|
|
Q_CORE_EXPORT QDebug operator<<(QDebug, const MSG &);
|
|
|
|
#endif
|
2012-12-06 19:02:08 +00:00
|
|
|
#endif
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2021-02-10 18:06:09 +00:00
|
|
|
#include <QtCore/qcoreapplication_platform.h>
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
#endif // QCOREAPPLICATION_H
|