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
qohosplatformintegration.h
Go to the documentation of this file.
1// Copyright (C) 2025 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 QOHOSPLATFORMINTERATION_H
5#define QOHOSPLATFORMINTERATION_H
6
7#include <QtGui/qtguiglobal.h>
8
9
10#include <qohosdisplayinfo.h>
11#include <qohosscreenmanager.h>
12#include <qpa/qplatformnativeinterface.h>
13#include <qpa/qplatformopenglcontext.h>
14#include <qpa/qplatformintegration.h>
15#include <qpa/qplatformoffscreensurface.h>
16#include <qpa/qplatforminputcontext.h>
17#include <qpa/qplatformtheme.h>
18#if QT_CONFIG(vulkan)
19#include <qpa/qplatformvulkaninstance.h>
20#endif
21#include <EGL/egl.h>
22#include <QtCore/qpoint.h>
23#include <QtCore/qscopedpointer.h>
24#include <QInputDevice>
25#include <qohosplatformclipboard.h>
26#include <render/qxcomponent.h>
27#include <memory>
28
30class QPlatformOffscreenSurface;
31class QOffscreenSurface;
32class QThread;
39
42{
43
44public:
51
53
54 QOhosPlatformIntegration(const QStringList &paramList);
55
56 static void setDefaultDisplayMetrics(const QOhosDisplayInfo &m_displayInfo);
57
58 Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override;
59 QPlatformWindow *createPlatformWindow(QWindow *window) const override;
60 QPlatformWindow *createForeignWindow(QWindow *, WId) const override;
61 QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
62 QVariant styleHint(StyleHint hint) const override;
64#ifndef QT_NO_OPENGL
65 QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
66 QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override;
67#endif
69 QPlatformOffscreenSurface
70 *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
71
72 QPlatformFontDatabase *fontDatabase() const override;
73
74#ifndef QT_NO_CLIPBOARD
76#endif
77#if QT_CONFIG(draganddrop)
79#endif
80
81 bool hasCapability(Capability cap) const override;
82
83 QPlatformInputContext *inputContext() const override;
84 void initialize() override;
85 QPlatformServices *services() const override;
86
87#if QT_CONFIG(vulkan)
89#endif
90
91 QPlatformTheme *createPlatformTheme(const QString &name) const override;
92 QStringList themeNames() const override;
93
95 static void setSystemLocale(QOhosSystemLocale *systemLocale);
96
99
102
103private:
104 EGLDisplay m_eglDisplay;
105
106 QThread *m_mainThread;
107 std::unique_ptr<QOhosPlatformFontDatabase> m_ohosFDB;
108 std::unique_ptr<QOhosPlatformServices> m_ohosPlatformServices;
109
110 std::unique_ptr<QOhosScreenManager> m_screenManager;
111
112 QScopedPointer<QOhosPlatformNativeInterface> m_ohosPlatformNativeInterface;
113
115
116 QScopedPointer<QPlatformInputContext> m_platformInputContext;
117 std::unique_ptr<QOhosInputMethodEventHandler> m_ohosInputMethodEventHandler;
118
119#ifndef QT_NO_CLIPBOARD
120 std::unique_ptr<QOhosPlatformClipboard> m_platformClipboard;
121#endif
122#if QT_CONFIG(draganddrop)
124#endif
125
126 static QScopedPointer<QOhosSystemLocale> m_systemLocale;
127 static WindowGeometryPersistencePolicy m_mainWindowPersistencePolicy;
128
129 std::shared_ptr<void> m_applicationStateTracker;
130};
131
132QT_END_NAMESPACE
133
134#endif // QOHOSPLATFORMINTERATION_H
QOhosFloatingWindow(QWindow *window)
~QOhosFloatingWindow() override
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
bool startSystemMove() override
Reimplement this method to start a system move operation if the system supports it and return true to...
QOhosView * ownedViewOrNull() const override
void onWindowStateChanged(Qt::WindowStates oldWindowState, Qt::WindowStates currentWindowState) override
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void onWindowFlagsChanged(Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags) override
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
QOhosSurface * ownedSurfaceOrNull() const override
void setMask(const QRegion &region) override
Reimplement to be able to let Qt set the mask of a window.
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
void update(Qt::InputMethodQueries queries) override
Notification on editor updates.
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
void setSoftwareKeyboardVisibilityStatus(bool visible)
void showInputPanel() override
Request to show input panel.
void invokeAction(QInputMethod::Action action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
void setLastInputTypeToTriggerSoftKeyboard(RequestKeyboardReason inputType)
void reset() override
Method to be called when input method needs to be reset.
void hideInputPanel() override
Request to hide input panel.
bool isValid() const override
Returns input context validity.
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
bool isInputPanelVisible() const override
Returns input panel visibility status.
QObject * focusObjectOrNull() const
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
bool isAnimating() const override
This function can be reimplemented to return true whenever input method is animating shown or hidden.
void onMouseWheelEvent(const QOhosWheelEvent &event, QWindow *window)
void onNonClientAreaTouchEvents(QWindow *targetWindow, std::vector< QOhosWindowProxy::NonClientAreaTouchEvent > eventBatch)
void onGestureEventFromNativeNode(QWindow *targetWindow, std::int64_t timestamp, qreal value, QPointF localPosition, QPointF screenPosition, Qt::NativeGestureType gestureType, QInputDevice::DeviceType deviceType)
void onMouseEvent(const QOhosMouseEvent &mouseEvent)
void onTouchEventFromJsWindow(QWindow *optTargetWindow, const QList< QWindowSystemInterface::TouchPoint > &touchPoints)
void onTouchEventFromXComponent(QWindow *targetWindow, std::chrono::nanoseconds timeStamp, const std::vector< QOhosTouchEventTouchPointData > &touchPoints, QInputDevice::DeviceType deviceType)
void onHoverEvent(bool isHover, const QPointF &local, const QPointF &global, QWindow *window)
void onNonClientAreaMouseEvents(QWindow *targetWindow, std::vector< QOhosWindowProxy::NonClientAreaMouseEvent > eventBatch)
void onKeyEvent(const QOhosKeyEvent &keyEvent, QWindow *targetWindow)
virtual bool equals(const QOhosKeyEvent &other) const =0
virtual QOhosOptional< QOhosQtKeyEvent > tryConvertToQOhosQtKeyEvent() const =0
virtual ~QOhosKeyEvent()
std::enable_if_t< qohosplugincore_h_detail::isQOhosOptional< QOhosInvokeResult< Func, T > >, QOhosInvokeResult< Func, T > > andThen(Func &&func) const
static void setMainWindowGeometryPersistencePolicy(WindowGeometryPersistencePolicy policy)
QOhosScreenManager * screenManager() const
QPlatformOpenGLContext * createPlatformOpenGLContext(QOpenGLContext *context) const override
Factory function for QPlatformOpenGLContext.
QOhosPlatformClipboard * clipboard() const override
Accessor for the platform integration's clipboard.
QPlatformOffscreenSurface * createPlatformOffscreenSurface(QOffscreenSurface *surface) const override
Factory function for QOffscreenSurface.
static void setDefaultDisplayMetrics(const QOhosDisplayInfo &m_displayInfo)
bool hasCapability(Capability cap) const override
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformServices * services() const override
QPlatformNativeInterface * nativeInterface() const override
QOpenGLContext * createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
static QOhosPlatformIntegration * instance()
QPlatformTheme * createPlatformTheme(const QString &name) const override
QVariant styleHint(StyleHint hint) const override
QStringList themeNames() const override
static WindowGeometryPersistencePolicy getMainWindowGeometryPersistencePolicy()
Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override
QPlatformWindow * createForeignWindow(QWindow *, WId) const override
QOhosInputMethodEventHandler * inputMethodEventHandler() const
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
QOhosPlatformIntegration(const QStringList &paramList)
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
static QOhosSystemLocale * systemLocale()
static void setSystemLocale(QOhosSystemLocale *systemLocale)
void setDisplayIdFromOhos(QOhosOptional< QOhosDisplayInfo::JsDisplayId > displayId)
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void notifyInputSystemsWindowActiveStatusChanged(bool active)
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
QOhosSurface * surfaceOrNull() const
void setWindowMask(const QOhosWindowProxy::WindowMask &windowMask)
void lower()
ViewGeometry viewGeometry() const
bool startMoving()
bool isSubWindowCoveringFullScreen() const
void raise()
static QWindowProxyRegistry & instance()
bool isWindowPcModeEnabled()
Combined button and popup list for selecting options.
bool isWindowRotatedByTabletScreenRotation(QWindow *window, QOhosWindowProxy::RectChangeOptions rectChangeOptions)
Qt::KeyboardModifiers convertOhosToQtKeyboardModifiers(QFlags< OhosKeyboardModifier > ohosKeysModifiers)
QFlags< OhosKeyboardModifier > readKeyModifiersFromKeyState(QSpan< const OhosKeyToModifier > keysToModifiers)
QFlags< OhosKeyboardModifier > readKeyModifiersFromOhosUiInputEvent(::ArkUI_UIInputEvent *uiInputEvent)
OhosKeyboardModifier
QOhosRuntimeDeviceTypeAndMode queryQOhosRuntimeDeviceAndMode()
::Input_KeyStateAction keyStateActionKeyActive
std::vector<::Input_KeyCode > keysToCheck
std::int32_t(* getKeyStateActionFunc)(const ::Input_KeyState *)
OhosKeyboardModifier modifier
QFlags< OhosKeyboardModifier > modifiers
QPointer< QWindow > targetWindow
std::chrono::milliseconds timestampMs
Qt::KeyboardModifiers modifiers
QEvent::Type keyAction
Qt::KeyboardModifiers guiApplicationKeyboardModifiers
quint32 nativeKeyCode
::OH_NativeXComponent_TouchPoint touchPoint
QFlags< OhosKeyboardModifier > modifiers