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