Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qplatformintegration.h
Go to the documentation of this file.
1// Copyright (C) 2016 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#ifndef QPLATFORMINTEGRATION_H
5#define QPLATFORMINTEGRATION_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QPA API and is not meant to be used
12// in applications. Usage of this API may make your code
13// source and binary incompatible with future versions of Qt.
14//
15
16#include <QtGui/qtguiglobal.h>
17#include <QtGui/qwindowdefs.h>
18#include <qpa/qplatformscreen.h>
19#include <QtGui/qsurfaceformat.h>
20#include <QtGui/qopenglcontext.h>
21
23
24
25class QPlatformWindow;
26class QWindow;
31class QPlatformDrag;
33class QGuiGLFormat;
37class QPlatformAccessibility;
38class QPlatformTheme;
43class QKeyEvent;
47class QVulkanInstance;
48
50
51template <typename R, typename I, auto func, typename... Args>
53{
54 template <typename T>
55 static R apply(T *obj, Args... args)
56 {
57 if (auto *iface = dynamic_cast<I*>(obj))
58 return (iface->*func)(args...);
59 else
60 return R();
61 }
62};
63
64template <auto func>
66template <typename R, typename I, typename... Args, R(I::*func)(Args...)>
67struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {};
68template <typename R, typename I, typename... Args, R(I::*func)(Args...) const>
69struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {};
70
71} // QNativeInterface::Private
72
73class Q_GUI_EXPORT QPlatformIntegration
74{
75public:
76 Q_DISABLE_COPY_MOVE(QPlatformIntegration)
77
105
107
108 virtual bool hasCapability(Capability cap) const;
109
110 virtual QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
112 virtual QPlatformWindow *createForeignWindow(QWindow *, WId) const { return nullptr; }
114#ifndef QT_NO_OPENGL
115 virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
116#endif
117 virtual QPlatformSharedGraphicsCache *createPlatformSharedGraphicsCache(const char *cacheId) const;
118 virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
119
120// Event dispatcher:
122 virtual void initialize();
123 virtual void destroy();
124
125//Deeper window system integrations
126 virtual QPlatformFontDatabase *fontDatabase() const;
127#ifndef QT_NO_CLIPBOARD
128 virtual QPlatformClipboard *clipboard() const;
129#endif
130#if QT_CONFIG(draganddrop)
131 virtual QPlatformDrag *drag() const;
132#endif
133 virtual QPlatformInputContext *inputContext() const;
134#if QT_CONFIG(accessibility)
135 virtual QPlatformAccessibility *accessibility() const;
136#endif
137
138 // Access native handles. The window handle is already available from Wid;
139 virtual QPlatformNativeInterface *nativeInterface() const;
140
141 virtual QPlatformServices *services() const;
142
172
173 virtual QVariant styleHint(StyleHint hint) const;
174 virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const;
175
176protected:
177 virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
178 virtual QList<int> possibleKeys(const QKeyEvent *) const;
179 friend class QPlatformKeyMapper;
180public:
181 virtual QPlatformKeyMapper *keyMapper() const;
182
183 virtual QStringList themeNames() const;
184 virtual QPlatformTheme *createPlatformTheme(const QString &name) const;
185
186 virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
187
188#ifndef QT_NO_SESSIONMANAGER
189 virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const;
190#endif
191
192 virtual void sync();
193
194#ifndef QT_NO_OPENGL
195 virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
196#endif
197 virtual void setApplicationIcon(const QIcon &icon) const;
198 virtual void setApplicationBadge(qint64 number);
199
200 virtual void beep() const;
201 virtual void quit() const;
202
203#if QT_CONFIG(vulkan) || defined(Q_QDOC)
204 virtual QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const;
205#endif
206
207 template <auto func, typename... Args>
208 auto call(Args... args)
209 {
210 using namespace QNativeInterface::Private;
211 return QInterfaceProxy<func>::apply(this, args...);
212 }
213
214protected:
216};
217
219
220#endif // QPLATFORMINTEGRATION_H
std::vector< ObjCStrongReference< CBMutableService > > services
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtGui
\inmodule QtGui
OpenGLModuleType
This enum defines the type of the underlying OpenGL implementation.
\inmodule QtGui
The QPlatformBackingStore class provides the drawing area for top-level windows.
The QPlatformClipboard class provides an abstraction for the system clipboard.
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
The QPlatformDrag class provides an abstraction for drag.
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they ...
The QPlatformInputContext class abstracts the input method dependent data and composing state.
The QPlatformIntegration class is the entry for WindowSystem specific functionality.
virtual QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const =0
Factory function for QPlatformBackingStore.
virtual QAbstractEventDispatcher * createEventDispatcher() const =0
Factory function for the GUI event dispatcher.
virtual QPlatformWindow * createForeignWindow(QWindow *, WId) const
QPlatformIntegration()=default
virtual QPlatformWindow * createPlatformWindow(QWindow *window) const =0
Factory function for QPlatformWindow.
Capability
Capabilities are used to determine specific features of a platform integration.
The QPlatformNativeInterface class provides an abstraction for retrieving native resource handles.
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
The QPlatformPixmap class provides an abstraction for native pixmaps.
The QPlatformServices provides the backend for desktop-related functionality.
The QPlatformSharedGraphicsCache is an abstraction of a cross-process graphics cache.
The QPlatformTheme class allows customizing the UI based on themes.
The QPlatformVulkanInstance class provides an abstraction for Vulkan instances.
The QPlatformWindow class provides an abstraction for top-level windows.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
WindowState
Definition qnamespace.h:251
static void * context
static bool initialize()
Definition qctf.cpp:94
GLuint64 key
GLenum type
GLuint name
GLhandleARB obj
[2]
GLenum func
Definition qopenglext.h:663
GLenum cap
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
long long qint64
Definition qtypes.h:60
QT_BEGIN_NAMESPACE constexpr const wchar_t * themeNames[]
aWidget window() -> setWindowTitle("New Window Title")
[2]
QJSValueList args