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
qandroidplatformintegration.h
Go to the documentation of this file.
1// Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
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#ifndef QANDROIDPLATFORMINTERATION_H
6#define QANDROIDPLATFORMINTERATION_H
7
10
11#include <QtGui/qtguiglobal.h>
12#include <qpa/qplatformintegration.h>
13#include <qpa/qplatformmenu.h>
14#include <qpa/qplatformnativeinterface.h>
15#include <qpa/qplatformopenglcontext.h>
16#include <qpa/qplatformoffscreensurface.h>
17#include <qpa/qplatformtheme.h>
18#include <private/qflatmap_p.h>
19#include <QtCore/qvarlengtharray.h>
20
21#include <EGL/egl.h>
22#include <memory>
23
24QT_BEGIN_NAMESPACE
25
26class QAndroidPlatformServices;
28class QPlatformAccessibility;
29
30struct AndroidStyle;
32{
33public:
34 void *nativeResourceForIntegration(const QByteArray &resource) override;
35 void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
36 void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
37 std::shared_ptr<AndroidStyle> m_androidStyle;
38
39protected:
40 void customEvent(QEvent *event) override;
41};
42
44#if QT_CONFIG(egl)
47#endif
48{
50
51public:
52 QAndroidPlatformIntegration(const QStringList &paramList);
54
55 void initialize() override;
56
57 bool hasCapability(QPlatformIntegration::Capability cap) const override;
58
59 QPlatformWindow *createPlatformWindow(QWindow *window) const override;
60 QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const override;
61 QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
62#if QT_CONFIG(egl)
65#endif
67 QAndroidPlatformScreen *screen() { return m_primaryScreen; }
68#if QT_CONFIG(egl)
71#endif
72
73 void setAvailableGeometry(const QRect &availableGeometry);
74 void setPhysicalSize(int width, int height);
75 void setScreenSize(int width, int height);
76 void setRefreshRate(qreal refreshRate);
77 bool isVirtualDesktop() { return true; }
78
79 QPlatformFontDatabase *fontDatabase() const override;
80
81 void handleScreenAdded(int displayId);
82 void handleScreenChanged(int displayId);
83 void handleScreenRemoved(int displayId);
84
85#ifndef QT_NO_CLIPBOARD
86 QPlatformClipboard *clipboard() const override;
87#endif
88
89 QPlatformInputContext *inputContext() const override;
91 QPlatformServices *services() const override;
92
93#if QT_CONFIG(accessibility)
95#endif
96
97 QVariant styleHint(StyleHint hint) const override;
98 Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override;
99
100 QStringList themeNames() const override;
101 QPlatformTheme *createPlatformTheme(const QString &name) const override;
102
103 static void setScreenOrientation(Qt::ScreenOrientation currentOrientation,
104 Qt::ScreenOrientation nativeOrientation);
105
106 QPointingDevice *touchDevice() const { return m_touchDevice; }
107 void setTouchDevice(QPointingDevice *touchDevice) { m_touchDevice = touchDevice; }
108
109 void flushPendingUpdates();
110
111 static void updateColorScheme(Qt::ColorScheme colorScheme);
112 static Qt::ColorScheme colorScheme() { return m_colorScheme; }
113#if QT_CONFIG(vulkan)
115#endif
116
117private:
118 EGLDisplay m_eglDisplay;
119 QPointingDevice *m_touchDevice;
120
121 QAndroidPlatformScreen *m_primaryScreen;
122
123 QThread *m_mainThread;
124
125 static Qt::ColorScheme m_colorScheme;
126
127 static Qt::ScreenOrientation m_orientation;
128 static Qt::ScreenOrientation m_nativeOrientation;
129 static bool m_showPasswordEnabled;
130
131 QPlatformFontDatabase *m_androidFDB;
132 QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
133 QScopedPointer<QAndroidPlatformServices> m_androidPlatformServices;
134
135 // Handling the multiple screens connected. Every display is identified
136 // with an unique (autoincremented) displayID. The values of this ID will
137 // not repeat during the OS runtime. We use this value as the key in the
138 // storage of screens.
140 , QVarLengthArray<int, 10>
142 // ID of the primary display, in documentation it is said to be always 0,
143 // but nevertheless it is retrieved
144 int m_primaryDisplayId = 0;
145
146#ifndef QT_NO_CLIPBOARD
147 QPlatformClipboard *m_androidPlatformClipboard;
148#endif
149
150 QAndroidSystemLocale *m_androidSystemLocale;
151#if QT_CONFIG(accessibility)
153#endif
154
155 QScopedPointer<QPlatformInputContext> m_inputContext;
156};
157
158QT_END_NAMESPACE
159
160#endif
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QStringList themeNames() const override
QPlatformNativeInterface * nativeInterface() const override
void setScreenSize(int width, int height)
void setPhysicalSize(int width, int height)
bool hasCapability(QPlatformIntegration::Capability cap) const override
void setTouchDevice(QPointingDevice *touchDevice)
QPlatformClipboard * clipboard() const override
Accessor for the platform integration's clipboard.
static void updateColorScheme(Qt::ColorScheme colorScheme)
Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override
QAndroidPlatformIntegration(const QStringList &paramList)
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QVariant styleHint(StyleHint hint) const override
static void setScreenOrientation(Qt::ScreenOrientation currentOrientation, Qt::ScreenOrientation nativeOrientation)
QPlatformServices * services() const override
void customEvent(QEvent *event) override
This event handler can be reimplemented in a subclass to receive custom events.
void * nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override
void * nativeResourceForIntegration(const QByteArray &resource) override
std::shared_ptr< AndroidStyle > m_androidStyle
Combined button and popup list for selecting options.