Qt 6.x
The Qt SDK
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;
36class QPlatformAccessibility;
37class QPlatformTheme;
42class QKeyEvent;
46class QVulkanInstance;
47
49
50template <typename R, typename I, auto func, typename... Args>
52{
53 template <typename T>
54 static R apply(T *obj, Args... args)
55 {
56 if (auto *iface = dynamic_cast<I*>(obj))
57 return (iface->*func)(args...);
58 else
59 return R();
60 }
61};
62
63template <auto func>
65template <typename R, typename I, typename... Args, R(I::*func)(Args...)>
66struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {};
67template <typename R, typename I, typename... Args, R(I::*func)(Args...) const>
68struct QInterfaceProxy<func> : public QInterfaceProxyImp<R, I, func, Args...> {};
69
70} // QNativeInterface::Private
71
72class Q_GUI_EXPORT QPlatformIntegration
73{
74public:
75 Q_DISABLE_COPY_MOVE(QPlatformIntegration)
76
78 ThreadedPixmaps = 1,
90 WindowActivation, // whether requestActivate is supported
101 ScreenWindowGrabbing // whether QScreen::grabWindow() is supported
102 };
103
105
106 virtual bool hasCapability(Capability cap) const;
107
108 virtual QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
110 virtual QPlatformWindow *createForeignWindow(QWindow *, WId) const { return nullptr; }
112#ifndef QT_NO_OPENGL
113 virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
114#endif
115 virtual QPlatformSharedGraphicsCache *createPlatformSharedGraphicsCache(const char *cacheId) const;
116 virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
117
118// Event dispatcher:
120 virtual void initialize();
121 virtual void destroy();
122
123//Deeper window system integrations
124 virtual QPlatformFontDatabase *fontDatabase() const;
125#ifndef QT_NO_CLIPBOARD
126 virtual QPlatformClipboard *clipboard() const;
127#endif
128#if QT_CONFIG(draganddrop)
129 virtual QPlatformDrag *drag() const;
130#endif
131 virtual QPlatformInputContext *inputContext() const;
132#if QT_CONFIG(accessibility)
133 virtual QPlatformAccessibility *accessibility() const;
134#endif
135
136 // Access native handles. The window handle is already available from Wid;
137 virtual QPlatformNativeInterface *nativeInterface() const;
138
139 virtual QPlatformServices *services() const;
140
169 };
170
171 virtual QVariant styleHint(StyleHint hint) const;
172 virtual Qt::WindowState defaultWindowState(Qt::WindowFlags) const;
173
174 virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
175 virtual QList<int> possibleKeys(const QKeyEvent *) const;
176
177 virtual QStringList themeNames() const;
178 virtual QPlatformTheme *createPlatformTheme(const QString &name) const;
179
180 virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
181
182#ifndef QT_NO_SESSIONMANAGER
183 virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const;
184#endif
185
186 virtual void sync();
187
188#ifndef QT_NO_OPENGL
189 virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
190#endif
191 virtual void setApplicationIcon(const QIcon &icon) const;
192 virtual void setApplicationBadge(qint64 number);
193
194 virtual void beep() const;
195 virtual void quit() const;
196
197#if QT_CONFIG(vulkan) || defined(Q_QDOC)
198 virtual QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const;
199#endif
200
201 template <auto func, typename... Args>
202 auto call(Args... args)
203 {
204 using namespace QNativeInterface::Private;
205 return QInterfaceProxy<func>::apply(this, args...);
206 }
207
208protected:
210};
211
213
214#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:423
Definition qlist.h:74
\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:127
\inmodule QtCore
Definition qvariant.h:64
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:250
static void * context
static bool initialize()
Definition qctf.cpp:67
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:55
static const wchar_t * themeNames[QWindowsVistaStylePrivate::NThemes]
aWidget window() -> setWindowTitle("New Window Title")
[2]
QJSValueList args