summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/CMakeLists.txt1
-rw-r--r--src/corelib/global/qglobal.h24
-rw-r--r--src/corelib/global/qnativeinterface.h73
-rw-r--r--src/corelib/kernel/qcoreapplication_platform.h1
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qkeymapper_p.h1
-rw-r--r--src/gui/kernel/qoffscreensurface.h1
-rw-r--r--src/gui/kernel/qoffscreensurface_platform.h1
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qopenglcontext_platform.h2
-rw-r--r--src/gui/kernel/qplatformmenu_p.h2
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h2
-rw-r--r--src/gui/kernel/qplatformopenglcontext.h2
-rw-r--r--src/gui/kernel/qplatformscreen_p.h1
-rw-r--r--src/gui/kernel/qplatformwindow_p.h1
15 files changed, 91 insertions, 24 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 242b12b305..d193ec1b79 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -49,6 +49,7 @@ qt_internal_add_module(Core
global/qlogging.cpp global/qlogging.h
global/qmalloc.cpp
global/qnamespace.h # this header is specified on purpose so AUTOMOC processes it
+ global/qnativeinterface.h
global/qnumeric.cpp global/qnumeric.h global/qnumeric_p.h
global/qoperatingsystemversion.cpp global/qoperatingsystemversion.h global/qoperatingsystemversion_p.h
global/qprocessordetection.h
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 966fa5d87c..b04a74e16e 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1395,30 +1395,6 @@ inline int qIntCast(float f) { return int(f); }
#define QT_OVERLOADED_MACRO_IMP(MACRO, ARGC) QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC)
#define QT_OVERLOADED_MACRO(MACRO, ...) QT_VA_ARGS_EXPAND(QT_OVERLOADED_MACRO_IMP(MACRO, QT_VA_ARGS_COUNT(__VA_ARGS__))(__VA_ARGS__))
-// Ensures that the interface's typeinfo is exported so that
-// dynamic casts work reliably, and protects the destructor
-// so that pointers to the interface can't be deleted.
-#define QT_DECLARE_NATIVE_INTERFACE(InterfaceClass) \
- protected: virtual ~InterfaceClass(); public:
-
-// Declares an accessor for the native interface
-#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR \
- template <typename QNativeInterface> \
- QNativeInterface *nativeInterface() const;
-
-// Provides a definition for the interface destructor
-#define QT_DEFINE_NATIVE_INTERFACE_2(Namespace, InterfaceClass) \
- QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass::~InterfaceClass() = default
-
-// Provides a definition for the destructor, and an explicit
-// template instantiation of the native interface accessor.
-#define QT_DEFINE_NATIVE_INTERFACE_3(Namespace, InterfaceClass, PublicClass) \
- QT_DEFINE_NATIVE_INTERFACE_2(Namespace, InterfaceClass); \
- template Q_DECL_EXPORT QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass *PublicClass::nativeInterface() const
-
-#define QT_DEFINE_NATIVE_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface, __VA_ARGS__)
-#define QT_DEFINE_PRIVATE_NATIVE_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface::Private, __VA_ARGS__)
-
// This macro can be used to calculate member offsets for types with a non standard layout.
// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional
// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof()
diff --git a/src/corelib/global/qnativeinterface.h b/src/corelib/global/qnativeinterface.h
new file mode 100644
index 0000000000..9e26a9ee73
--- /dev/null
+++ b/src/corelib/global/qnativeinterface.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** 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.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qglobal.h>
+
+#ifndef QNATIVEINTERFACE_H
+#define QNATIVEINTERFACE_H
+
+QT_BEGIN_NAMESPACE
+
+// Ensures that the interface's typeinfo is exported so that
+// dynamic casts work reliably, and protects the destructor
+// so that pointers to the interface can't be deleted.
+#define QT_DECLARE_NATIVE_INTERFACE(InterfaceClass) \
+ protected: virtual ~InterfaceClass(); public:
+
+// Declares an accessor for the native interface
+#define QT_DECLARE_NATIVE_INTERFACE_ACCESSOR \
+ template <typename QNativeInterface> \
+ QNativeInterface *nativeInterface() const;
+
+// Provides a definition for the interface destructor
+#define QT_DEFINE_NATIVE_INTERFACE_2(Namespace, InterfaceClass) \
+ QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass::~InterfaceClass() = default
+
+// Provides a definition for the destructor, and an explicit
+// template instantiation of the native interface accessor.
+#define QT_DEFINE_NATIVE_INTERFACE_3(Namespace, InterfaceClass, PublicClass) \
+ QT_DEFINE_NATIVE_INTERFACE_2(Namespace, InterfaceClass); \
+ template Q_DECL_EXPORT QT_PREPEND_NAMESPACE(Namespace)::InterfaceClass *PublicClass::nativeInterface() const
+
+#define QT_DEFINE_NATIVE_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface, __VA_ARGS__)
+#define QT_DEFINE_PRIVATE_NATIVE_INTERFACE(...) QT_OVERLOADED_MACRO(QT_DEFINE_NATIVE_INTERFACE, QNativeInterface::Private, __VA_ARGS__)
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEINTERFACE_H
diff --git a/src/corelib/kernel/qcoreapplication_platform.h b/src/corelib/kernel/qcoreapplication_platform.h
index 0615cddf8f..605bfbc6a3 100644
--- a/src/corelib/kernel/qcoreapplication_platform.h
+++ b/src/corelib/kernel/qcoreapplication_platform.h
@@ -41,6 +41,7 @@
#define QCOREAPPLICATION_PLATFORM_H
#include <QtCore/qglobal.h>
+#include <QtCore/qnativeinterface.h>
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
class _jobject;
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 7cbfb76bee..f225bf0010 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -58,6 +58,7 @@
#include <QtCore/QSharedPointer>
#include <QtCore/private/qcoreapplication_p.h>
+#include <QtCore/qnativeinterface.h>
#include <QtCore/private/qthread_p.h>
#include <qpa/qwindowsysteminterface.h>
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 65d1c229ca..e0614a79a1 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -57,6 +57,7 @@
#include <qlocale.h>
#include <qevent.h>
+#include <QtCore/qnativeinterface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h
index 3fc850a79d..e63c85cb72 100644
--- a/src/gui/kernel/qoffscreensurface.h
+++ b/src/gui/kernel/qoffscreensurface.h
@@ -42,6 +42,7 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/QObject>
+#include <QtCore/qnativeinterface.h>
#include <QtGui/qsurface.h>
Q_MOC_INCLUDE(<QScreen>)
diff --git a/src/gui/kernel/qoffscreensurface_platform.h b/src/gui/kernel/qoffscreensurface_platform.h
index addba347b9..3eb250ea5e 100644
--- a/src/gui/kernel/qoffscreensurface_platform.h
+++ b/src/gui/kernel/qoffscreensurface_platform.h
@@ -42,6 +42,7 @@
#include <QtGui/qtguiglobal.h>
#include <QtGui/qoffscreensurface.h>
+#include <QtCore/qnativeinterface.h>
#if defined(Q_OS_ANDROID)
struct ANativeWindow;
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 60f3e3d03a..4d8c568ed5 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -47,6 +47,7 @@
#include <QtCore/qnamespace.h>
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
+#include <QtCore/qnativeinterface.h>
#include <QtGui/QSurfaceFormat>
@@ -60,6 +61,7 @@
#include <QtGui/qopengl.h>
#include <QtCore/qvariant.h>
+#include <QtCore/qnativeinterface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qopenglcontext_platform.h b/src/gui/kernel/qopenglcontext_platform.h
index 8275416f42..2e475c7fe9 100644
--- a/src/gui/kernel/qopenglcontext_platform.h
+++ b/src/gui/kernel/qopenglcontext_platform.h
@@ -46,6 +46,8 @@
#include <QtGui/qopenglcontext.h>
#include <QtGui/qwindowdefs.h>
+#include <QtCore/qnativeinterface.h>
+
#if defined(Q_OS_MACOS)
Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLContext);
#endif
diff --git a/src/gui/kernel/qplatformmenu_p.h b/src/gui/kernel/qplatformmenu_p.h
index feba5aa9ff..38f49ef983 100644
--- a/src/gui/kernel/qplatformmenu_p.h
+++ b/src/gui/kernel/qplatformmenu_p.h
@@ -53,6 +53,8 @@
#include <QtGui/private/qtguiglobal_p.h>
+#include <QtCore/qnativeinterface.h>
+
QT_BEGIN_NAMESPACE
// ----------------- QNativeInterface -----------------
diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h
index 06fa80b994..46bc65d467 100644
--- a/src/gui/kernel/qplatformoffscreensurface.h
+++ b/src/gui/kernel/qplatformoffscreensurface.h
@@ -54,6 +54,8 @@
#include <QtGui/qoffscreensurface.h>
#include <QtCore/qscopedpointer.h>
+#include <QtCore/qnativeinterface.h>
+
QT_BEGIN_NAMESPACE
class QOffscreenSurface;
diff --git a/src/gui/kernel/qplatformopenglcontext.h b/src/gui/kernel/qplatformopenglcontext.h
index eefe93111d..d747b3b7d4 100644
--- a/src/gui/kernel/qplatformopenglcontext.h
+++ b/src/gui/kernel/qplatformopenglcontext.h
@@ -59,6 +59,8 @@
#include <QtGui/qopengl.h>
#include <QtGui/qopenglcontext.h>
+#include <QtCore/qnativeinterface.h>
+
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen_p.h b/src/gui/kernel/qplatformscreen_p.h
index 53ce9e251f..bd149ccbac 100644
--- a/src/gui/kernel/qplatformscreen_p.h
+++ b/src/gui/kernel/qplatformscreen_p.h
@@ -54,6 +54,7 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qpointer.h>
+#include <QtCore/qnativeinterface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h
index ffc3879bf1..22431e8d79 100644
--- a/src/gui/kernel/qplatformwindow_p.h
+++ b/src/gui/kernel/qplatformwindow_p.h
@@ -54,6 +54,7 @@
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qbasictimer.h>
#include <QtCore/qrect.h>
+#include <QtCore/qnativeinterface.h>
QT_BEGIN_NAMESPACE