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
4#include <QtGui/qtgui-config.h>
5#ifndef QT_NO_OPENGL
6# include <QtGui/private/qopenglcontext_p.h>
7#endif
8
9#include <QtGui/private/qguiapplication_p.h>
10#include <qpa/qplatformopenglcontext.h>
11#include <qpa/qplatformintegration.h>
12#include <qpa/qplatformwindow_p.h>
13#include <qpa/qplatformmenu_p.h>
14
15#include <AppKit/AppKit.h>
16
17QT_BEGIN_NAMESPACE
18
19using namespace QNativeInterface::Private;
20
21/*!
22 \class QNativeInterface::Private::QCocoaWindow
23 \since 6.0
24 \internal
25 \brief Native interface for QPlatformWindow on \macos.
26 \inmodule QtGui
27 \ingroup native-interfaces
28*/
29
31
32
33/*!
34 \class QNativeInterface::Private::QCocoaMenu
35 \since 6.0
36 \internal
37 \brief Native interface for QPlatformMenu on \macos.
38 \inmodule QtGui
39 \ingroup native-interfaces
40*/
41
44
45/*!
46 \class QNativeInterface::QCocoaScreen
47 \since 6.11
48 \brief Native interface to a screen on \macos.
49
50 Accessed through QScreen::nativeInterface().
51 \inmodule QtGui
52 \ingroup native-interfaces
53 \ingroup native-interfaces-qscreen
54*/
55/*!
56 \fn NSScreen *QNativeInterface::QCocoaScreen::nativeScreen() const
57 \return the underlying NSScreen of this QScreen.
58*/
60
61#ifndef QT_NO_OPENGL
62
63/*!
64 \class QNativeInterface::QCocoaGLContext
65 \since 6.0
66 \brief Native interface to an NSOpenGLContext on \macos.
67
68 Accessed through QOpenGLContext::nativeInterface().
69
70 \inmodule QtGui
71 \inheaderfile QOpenGLContext
72 \ingroup native-interfaces
73 \ingroup native-interfaces-qopenglcontext
74*/
75
76/*!
77 \fn QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *context, QOpenGLContext *shareContext = nullptr)
78
79 \brief Adopts an NSOpenGLContext.
80
81 The adopted NSOpenGLContext \a context is retained. Ownership of the
82 created QOpenGLContext \a shareContext is transferred to the caller.
83*/
84
85/*!
86 \fn NSOpenGLContext *QNativeInterface::QCocoaGLContext::nativeContext() const
87
88 \return the underlying NSOpenGLContext.
89*/
90
93
94QOpenGLContext *QNativeInterface::QCocoaGLContext::fromNative(NSOpenGLContext *nativeContext, QOpenGLContext *shareContext)
95{
96 return QGuiApplicationPrivate::platformIntegration()->call<
97 &QCocoaGLIntegration::createOpenGLContext>(nativeContext, shareContext);
98}
99
100#endif // QT_NO_OPENGL
101
102QT_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)