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
4#ifndef QANDROIDPLATFORMINTERATION_H
5#define QANDROIDPLATFORMINTERATION_H
6
9
10#include <QtGui/qtguiglobal.h>
11#include <qpa/qplatformintegration.h>
12#include <qpa/qplatformmenu.h>
13#include <qpa/qplatformnativeinterface.h>
14#include <qpa/qplatformopenglcontext.h>
15#include <qpa/qplatformoffscreensurface.h>
16#include <qpa/qplatformtheme.h>
17#include <private/qflatmap_p.h>
18#include <QtCore/qvarlengtharray.h>
19
20#include <EGL/egl.h>
21#include <memory>
22
23QT_BEGIN_NAMESPACE
24
25class QAndroidPlatformServices;
27class QPlatformAccessibility;
28
29struct AndroidStyle;
31{
32public:
33 void *nativeResourceForIntegration(const QByteArray &resource) override;
34 void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
35 void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
36 std::shared_ptr<AndroidStyle> m_androidStyle;
37
38protected:
39 void customEvent(QEvent *event) override;
40};
41
43#if QT_CONFIG(egl)
46#endif
47{
49
50public:
51 QAndroidPlatformIntegration(const QStringList &paramList);
53
54 void initialize() override;
55
56 bool hasCapability(QPlatformIntegration::Capability cap) const override;
57
58 QPlatformWindow *createPlatformWindow(QWindow *window) const override;
59 QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const override;
60 QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
61#if QT_CONFIG(egl)
64#endif
66 QAndroidPlatformScreen *screen() { return m_primaryScreen; }
67#if QT_CONFIG(egl)
70#endif
71
72 void setAvailableGeometry(const QRect &availableGeometry);
73 void setPhysicalSize(int width, int height);
74 void setScreenSize(int width, int height);
75 void setRefreshRate(qreal refreshRate);
76 bool isVirtualDesktop() { return true; }
77
78 QPlatformFontDatabase *fontDatabase() const override;
79
80 void handleScreenAdded(int displayId);
81 void handleScreenChanged(int displayId);
82 void handleScreenRemoved(int displayId);
83
84#ifndef QT_NO_CLIPBOARD
85 QPlatformClipboard *clipboard() const override;
86#endif
87
88 QPlatformInputContext *inputContext() const override;
90 QPlatformServices *services() const override;
91
92#if QT_CONFIG(accessibility)
94#endif
95
96 QVariant styleHint(StyleHint hint) const override;
97 Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override;
98
99 QStringList themeNames() const override;
100 QPlatformTheme *createPlatformTheme(const QString &name) const override;
101
102 static void setScreenOrientation(Qt::ScreenOrientation currentOrientation,
103 Qt::ScreenOrientation nativeOrientation);
104
105 QPointingDevice *touchDevice() const { return m_touchDevice; }
106 void setTouchDevice(QPointingDevice *touchDevice) { m_touchDevice = touchDevice; }
107
108 void flushPendingUpdates();
109
110 static void updateColorScheme(Qt::ColorScheme colorScheme);
111 static Qt::ColorScheme colorScheme() { return m_colorScheme; }
112#if QT_CONFIG(vulkan)
114#endif
115
116private:
117 EGLDisplay m_eglDisplay;
118 QPointingDevice *m_touchDevice;
119
120 QAndroidPlatformScreen *m_primaryScreen;
121
122 QThread *m_mainThread;
123
124 static Qt::ColorScheme m_colorScheme;
125
126 static Qt::ScreenOrientation m_orientation;
127 static Qt::ScreenOrientation m_nativeOrientation;
128 static bool m_showPasswordEnabled;
129
130 QPlatformFontDatabase *m_androidFDB;
131 QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
132 QScopedPointer<QAndroidPlatformServices> m_androidPlatformServices;
133
134 // Handling the multiple screens connected. Every display is identified
135 // with an unique (autoincremented) displayID. The values of this ID will
136 // not repeat during the OS runtime. We use this value as the key in the
137 // storage of screens.
139 , QVarLengthArray<int, 10>
141 // ID of the primary display, in documentation it is said to be always 0,
142 // but nevertheless it is retrieved
143 int m_primaryDisplayId = 0;
144
145#ifndef QT_NO_CLIPBOARD
146 QPlatformClipboard *m_androidPlatformClipboard;
147#endif
148
149 QAndroidSystemLocale *m_androidSystemLocale;
150#if QT_CONFIG(accessibility)
152#endif
153
154 QScopedPointer<QPlatformInputContext> m_inputContext;
155};
156
157QT_END_NAMESPACE
158
159#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