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 \ingroup native-interfaces
54 \ingroup native-interfaces-qscreen
55*/
56/*!
57 \fn NSScreen *QNativeInterface::QCocoaScreen::nativeScreen() const
58 \return the underlying NSScreen of this QScreen.
59*/
61
62#ifndef QT_NO_OPENGL
63
64/*!
65 \class QNativeInterface::QCocoaGLContext
66 \since 6.0
67 \brief Native interface to an NSOpenGLContext on \macos.
68
69 Accessed through QOpenGLContext::nativeInterface().
70
71 \inmodule QtGui
72 \inheaderfile QOpenGLContext
73 \ingroup native-interfaces
74 \ingroup native-interfaces-qopenglcontext
75*/
76
77/*!
78 \fn QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *context, QOpenGLContext *shareContext = nullptr)
79
80 \brief Adopts an NSOpenGLContext.
81
82 The adopted NSOpenGLContext \a context is retained. Ownership of the
83 created QOpenGLContext \a shareContext is transferred to the caller.
84*/
85
86/*!
87 \fn NSOpenGLContext *QNativeInterface::QCocoaGLContext::nativeContext() const
88
89 \return the underlying NSOpenGLContext.
90*/
91
94
95QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *nativeContext, QOpenGLContext *shareContext)
96{
97 return QGuiApplicationPrivate::platformIntegration()->call<
98 &QCocoaGLIntegration::createOpenGLContext>(nativeContext, shareContext);
99}
100
101#endif // QT_NO_OPENGL
102
103QT_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)