Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcocoanativeinterface.mm
Go to the documentation of this file.
1// Copyright (C) 2020 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// Qt-Security score:significant reason:default
4
5#include <QtGui/qtgui-config.h>
6#ifndef QT_NO_OPENGL
7# include <QtGui/private/qopenglcontext_p.h>
8#endif
9
10#include <QtGui/private/qguiapplication_p.h>
11#include <qpa/qplatformopenglcontext.h>
12#include <qpa/qplatformintegration.h>
13#include <qpa/qplatformwindow_p.h>
14#include <qpa/qplatformmenu_p.h>
15
16#include <AppKit/AppKit.h>
17
18QT_BEGIN_NAMESPACE
19
20using namespace QNativeInterface::Private;
21
22/*!
23 \class QNativeInterface::Private::QCocoaWindow
24 \since 6.0
25 \internal
26 \brief Native interface for QPlatformWindow on \macos.
27 \inmodule QtGui
28 \ingroup native-interfaces
29*/
30
32
33
34/*!
35 \class QNativeInterface::Private::QCocoaMenu
36 \since 6.0
37 \internal
38 \brief Native interface for QPlatformMenu on \macos.
39 \inmodule QtGui
40 \ingroup native-interfaces
41*/
42
45
46/*!
47 \class QNativeInterface::QCocoaScreen
48 \since 6.11
49 \brief Native interface to a screen on \macos.
50
51 Accessed through QScreen::nativeInterface().
52 \inmodule QtGui
53 \inheaderfile QScreen
54 \ingroup native-interfaces
55 \ingroup native-interfaces-qscreen
56*/
57/*!
58 \fn NSScreen *QNativeInterface::QCocoaScreen::nativeScreen() const
59 \return the underlying NSScreen of this QScreen.
60*/
62
63#ifndef QT_NO_OPENGL
64
65/*!
66 \class QNativeInterface::QCocoaGLContext
67 \since 6.0
68 \brief Native interface to an NSOpenGLContext on \macos.
69
70 Accessed through QOpenGLContext::nativeInterface().
71
72 \inmodule QtGui
73 \inheaderfile QOpenGLContext
74 \ingroup native-interfaces
75 \ingroup native-interfaces-qopenglcontext
76*/
77
78/*!
79 \fn QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *context, QOpenGLContext *shareContext = nullptr)
80
81 \brief Adopts an NSOpenGLContext.
82
83 The adopted NSOpenGLContext \a context is retained. Ownership of the
84 created QOpenGLContext \a shareContext is transferred to the caller.
85*/
86
87/*!
88 \fn NSOpenGLContext *QNativeInterface::QCocoaGLContext::nativeContext() const
89
90 \return the underlying NSOpenGLContext.
91*/
92
95
96QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *nativeContext, QOpenGLContext *shareContext)
97{
98 return QGuiApplicationPrivate::platformIntegration()->call<
99 &QCocoaGLIntegration::createOpenGLContext>(nativeContext, shareContext);
100}
101
102#endif // QT_NO_OPENGL
103
104QT_END_NAMESPACE
QT_DEFINE_NATIVE_INTERFACE(QCocoaScreen)
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaWindow)
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaGLIntegration)
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaMenuBar)
QT_DEFINE_PRIVATE_NATIVE_INTERFACE(QCocoaMenu)
QT_DEFINE_NATIVE_INTERFACE(QCocoaGLContext)