diff --git a/src/gui/.prev_CMakeLists.txt b/src/gui/.prev_CMakeLists.txt index ba71e2d6f2..0b61f85399 100644 --- a/src/gui/.prev_CMakeLists.txt +++ b/src/gui/.prev_CMakeLists.txt @@ -62,7 +62,7 @@ qt_add_module(Gui kernel/qplatformintegration.cpp kernel/qplatformintegration.h kernel/qplatformintegrationfactory.cpp kernel/qplatformintegrationfactory_p.h kernel/qplatformintegrationplugin.cpp kernel/qplatformintegrationplugin.h - kernel/qplatformmenu.cpp kernel/qplatformmenu.h + kernel/qplatformmenu.cpp kernel/qplatformmenu.h kernel/qplatformmenu_p.h kernel/qplatformnativeinterface.cpp kernel/qplatformnativeinterface.h kernel/qplatformoffscreensurface.cpp kernel/qplatformoffscreensurface.h kernel/qplatformscreen.cpp kernel/qplatformscreen.h kernel/qplatformscreen_p.h diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 62cc030ea2..228d44a6c1 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -113,7 +113,7 @@ qt_add_module(Gui kernel/qplatformintegration.cpp kernel/qplatformintegration.h kernel/qplatformintegrationfactory.cpp kernel/qplatformintegrationfactory_p.h kernel/qplatformintegrationplugin.cpp kernel/qplatformintegrationplugin.h - kernel/qplatformmenu.cpp kernel/qplatformmenu.h + kernel/qplatformmenu.cpp kernel/qplatformmenu.h kernel/qplatformmenu_p.h kernel/qplatformnativeinterface.cpp kernel/qplatformnativeinterface.h kernel/qplatformoffscreensurface.cpp kernel/qplatformoffscreensurface.h kernel/qplatformscreen.cpp kernel/qplatformscreen.h kernel/qplatformscreen_p.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index e653adab9c..c86489e9fa 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -32,6 +32,7 @@ HEADERS += \ kernel/qplatformclipboard.h \ kernel/qplatformnativeinterface.h \ kernel/qplatformmenu.h \ + kernel/qplatformmenu_p.h \ kernel/qsurfaceformat.h \ kernel/qguiapplication.h \ kernel/qguiapplication_p.h \ diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index 6c2abfde5f..8e470aefd3 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -166,31 +166,6 @@ public: virtual QPlatformMenu *createMenu() const; }; -// ----------------- QPlatformInterface ----------------- - -QT_END_NAMESPACE -Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu); -QT_BEGIN_NAMESPACE - -namespace QPlatformInterface::Private { - -#if defined(Q_OS_MACOS) -struct Q_GUI_EXPORT QCocoaMenu -{ - QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenu) - virtual NSMenu *nsMenu() const = 0; - virtual void setAsDockMenu() const = 0; -}; - -struct Q_GUI_EXPORT QCocoaMenuBar -{ - QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenuBar) - virtual NSMenu *nsMenu() const = 0; -}; -#endif - -} // QPlatformInterface::Private - QT_END_NAMESPACE #endif diff --git a/src/gui/kernel/qplatformmenu_p.h b/src/gui/kernel/qplatformmenu_p.h new file mode 100644 index 0000000000..05e17051ba --- /dev/null +++ b/src/gui/kernel/qplatformmenu_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui 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$ +** +****************************************************************************/ + +#ifndef QPLATFORMMENU_P_H +#define QPLATFORMMENU_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_NAMESPACE + +// ----------------- QPlatformInterface ----------------- + +QT_END_NAMESPACE +Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu); +QT_BEGIN_NAMESPACE + +namespace QPlatformInterface::Private { + +#if defined(Q_OS_MACOS) +struct Q_GUI_EXPORT QCocoaMenu +{ + QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenu) + virtual NSMenu *nsMenu() const = 0; + virtual void setAsDockMenu() const = 0; +}; + +struct Q_GUI_EXPORT QCocoaMenuBar +{ + QT_DECLARE_PLATFORM_INTERFACE(QCocoaMenuBar) + virtual NSMenu *nsMenu() const = 0; +}; +#endif + +} // QPlatformInterface::Private + +QT_END_NAMESPACE + +#endif // QPLATFORMMENU_P_H diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 8d2f4b3fbd..cd621b7636 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -172,21 +172,6 @@ protected: QScopedPointer d_ptr; }; -// ----------------- QPlatformInterface ----------------- - -namespace QPlatformInterface::Private { - -#if defined(Q_OS_MACOS) -struct Q_GUI_EXPORT QCocoaWindow -{ - QT_DECLARE_PLATFORM_INTERFACE(QCocoaWindow) - virtual void setContentBorderEnabled(bool enable) = 0; - virtual QPoint bottomLeftClippedByNSWindowOffset() const = 0; -}; -#endif - -} // QPlatformInterface::Private - QT_END_NAMESPACE #endif //QPLATFORMWINDOW_H diff --git a/src/gui/kernel/qplatformwindow_p.h b/src/gui/kernel/qplatformwindow_p.h index 00dae9334c..03ef210f81 100644 --- a/src/gui/kernel/qplatformwindow_p.h +++ b/src/gui/kernel/qplatformwindow_p.h @@ -64,6 +64,21 @@ public: QBasicTimer updateTimer; }; +// ----------------- QPlatformInterface ----------------- + +namespace QPlatformInterface::Private { + +#if defined(Q_OS_MACOS) +struct Q_GUI_EXPORT QCocoaWindow +{ + QT_DECLARE_PLATFORM_INTERFACE(QCocoaWindow) + virtual void setContentBorderEnabled(bool enable) = 0; + virtual QPoint bottomLeftClippedByNSWindowOffset() const = 0; +}; +#endif + +} // QPlatformInterface::Private + QT_END_NAMESPACE #endif // QPLATFORMWINDOW_P_H diff --git a/src/gui/platform/macos/qcocoaplatforminterface.mm b/src/gui/platform/macos/qcocoaplatforminterface.mm index daa821a794..be9e8d18bf 100644 --- a/src/gui/platform/macos/qcocoaplatforminterface.mm +++ b/src/gui/platform/macos/qcocoaplatforminterface.mm @@ -41,8 +41,8 @@ #include #include #include -#include -#include +#include +#include #include diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h index bacc1f75cd..6bd033bfeb 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -43,6 +43,7 @@ #include #include +#include #include "qcocoamenuitem.h" #include "qcocoansmenu.h" diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index a46f8913f9..927c3bd751 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -41,6 +41,7 @@ #define QCOCOAWINDOW_H #include +#include #include #include diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 9ba7260072..aa6706f0bb 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -68,6 +68,7 @@ #endif #include "qwidgetanimator_p.h" #include +#include QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index 67919de9ae..1be74bf27c 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -55,6 +55,7 @@ QT_USE_NAMESPACE #include #include #include +#include using namespace QPlatformInterface::Private;