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#if QT_CONFIG(draganddrop)
91#endif
92
93 QPlatformInputContext *inputContext() const override;
95 QPlatformServices *services() const override;
96
97#if QT_CONFIG(accessibility)
99#endif
100
101 QVariant styleHint(StyleHint hint) const override;
102 Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override;
103
104 QStringList themeNames() const override;
105 QPlatformTheme *createPlatformTheme(const QString &name) const override;
106
107 static void setScreenOrientation(Qt::ScreenOrientation currentOrientation,
108 Qt::ScreenOrientation nativeOrientation);
109
110 QPointingDevice *touchDevice() const { return m_touchDevice; }
111 void setTouchDevice(QPointingDevice *touchDevice) { m_touchDevice = touchDevice; }
112
113 void flushPendingUpdates();
114
115 static void updateColorScheme(Qt::ColorScheme colorScheme);
116 static Qt::ColorScheme colorScheme() { return m_colorScheme; }
117#if QT_CONFIG(vulkan)
119#endif
120
121private:
122 EGLDisplay m_eglDisplay;
123 QPointingDevice *m_touchDevice;
124
125 QAndroidPlatformScreen *m_primaryScreen;
126
127 QThread *m_mainThread;
128
129 static Qt::ColorScheme m_colorScheme;
130
131 static Qt::ScreenOrientation m_orientation;
132 static Qt::ScreenOrientation m_nativeOrientation;
133 static bool m_showPasswordEnabled;
134
135 QPlatformFontDatabase *m_androidFDB;
136 QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
137 QScopedPointer<QAndroidPlatformServices> m_androidPlatformServices;
138
139 // Handling the multiple screens connected. Every display is identified
140 // with an unique (autoincremented) displayID. The values of this ID will
141 // not repeat during the OS runtime. We use this value as the key in the
142 // storage of screens.
144 , QVarLengthArray<int, 10>
146 // ID of the primary display, in documentation it is said to be always 0,
147 // but nevertheless it is retrieved
148 int m_primaryDisplayId = 0;
149
150#ifndef QT_NO_CLIPBOARD
151 QPlatformClipboard *m_androidPlatformClipboard;
152#endif
153
154#if QT_CONFIG(draganddrop)
156#endif
157
158 QAndroidSystemLocale *m_androidSystemLocale;
159#if QT_CONFIG(accessibility)
161#endif
162
163 QScopedPointer<QPlatformInputContext> m_inputContext;
164};
165
166QT_END_NAMESPACE
167
168#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.