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#include <optional>
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#include <qpa/qplatformwindow_p.h>
19#if QT_CONFIG(vulkan)
20#include <qpa/qplatformvulkaninstance.h>
21#endif
22#include <EGL/egl.h>
23#include <QtCore/qpoint.h>
24#include <QtCore/qscopedpointer.h>
25#include <QInputDevice>
26#include <qohosplatformclipboard.h>
27#include <render/qxcomponent.h>
28#include <memory>
29
31class QPlatformOffscreenSurface;
32class QOffscreenSurface;
33class QThread;
39class QOhosPlatformServices;
40
44{
45
46public:
53
55
56 QOhosPlatformIntegration(const QStringList &paramList);
57
58 static void setDefaultDisplayMetrics(const QOhosDisplayInfo &m_displayInfo);
59
60 Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override;
61 QPlatformWindow *createPlatformWindow(QWindow *window) const override;
62 QPlatformWindow *createForeignWindow(QWindow *, WId) const override;
63 QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
64 QVariant styleHint(StyleHint hint) const override;
66#ifndef QT_NO_OPENGL
67 QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
68 QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override;
69#endif
71 QPlatformOffscreenSurface
72 *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
73
74 QPlatformFontDatabase *fontDatabase() const override;
75
76#ifndef QT_NO_CLIPBOARD
78#endif
79#if QT_CONFIG(draganddrop)
81#endif
82
83 bool hasCapability(Capability cap) const override;
84
85 QPlatformInputContext *inputContext() const override;
86 void initialize() override;
87 QPlatformServices *services() const override;
88
89#if QT_CONFIG(vulkan)
91#endif
92
93 QPlatformTheme *createPlatformTheme(const QString &name) const override;
94 QStringList themeNames() const override;
95
96 WId windowHandle(ArkUI_NodeHandle content) override;
97 void setMainWindowGeometryPersistenceEnabled(std::optional<bool> enabled) override;
98
100 static void setSystemLocale(QOhosSystemLocale *systemLocale);
101
104
107
108private:
109 std::shared_ptr<void> m_settingsCacheHandle;
110
111 std::shared_ptr<EGLDisplay> m_eglDisplay;
112
113 QThread *m_mainThread;
114 std::unique_ptr<QOhosPlatformFontDatabase> m_ohosFDB;
115 std::unique_ptr<QOhosPlatformServices> m_ohosPlatformServices;
116
117 std::unique_ptr<QOhosScreenManager> m_screenManager;
118
119 QScopedPointer<QOhosPlatformNativeInterface> m_ohosPlatformNativeInterface;
120
121 QScopedPointer<QPlatformInputContext> m_platformInputContext;
122 std::unique_ptr<QOhosInputMethodEventHandler> m_ohosInputMethodEventHandler;
123
124#ifndef QT_NO_CLIPBOARD
125 std::unique_ptr<QOhosPlatformClipboard> m_platformClipboard;
126#endif
127#if QT_CONFIG(draganddrop)
129#endif
130
131 static QScopedPointer<QOhosSystemLocale> m_systemLocale;
132 static WindowGeometryPersistencePolicy m_mainWindowPersistencePolicy;
133
134 std::shared_ptr<void> m_applicationStateTracker;
135};
136
137QT_END_NAMESPACE
138
139#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
bool windowEvent(QEvent *event) override
Reimplement this method to be able to do any platform specific event handling.
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.
QtOhos::enums::ohos::inputMethod::TextInputType TextInputType
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.
QtOhos::enums::ohos::inputMethod::EnterKeyType EnterKeyType
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.
QtOhos::enums::ohos::inputMethod::Direction Direction
void onMouseWheelEvent(const QOhosWheelEvent &event, QWindow *window)
void onNonClientAreaTouchEvents(QWindow *targetWindow, std::vector< QOhosWindowProxy::NonClientAreaTouchEvent > eventBatch)
void onHoverEvent(const QOhosHoverEvent &hoverEvent)
void onMouseEvent(const QOhosMouseEvent &mouseEvent)
void onTouchEventFromJsWindow(QWindow *optTargetWindow, const QList< QWindowSystemInterface::TouchPoint > &touchPoints)
void onGestureEventFromNativeNode(const QOhosGestureEvent &gestureEvent)
void onTouchEventFromXComponent(QWindow *targetWindow, std::chrono::nanoseconds timeStamp, const std::vector< QOhosTouchEventTouchPointData > &touchPoints, QInputDevice::DeviceType deviceType, QFlags< OhosKeyboardModifier > modifiers)
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()
static void setMainWindowGeometryPersistencePolicy(WindowGeometryPersistencePolicy policy)
QOhosScreenManager * screenManager() const
QPlatformOpenGLContext * createPlatformOpenGLContext(QOpenGLContext *context) const override
Factory function for QPlatformOpenGLContext.
WId windowHandle(ArkUI_NodeHandle content) override
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 setMainWindowGeometryPersistenceEnabled(std::optional< bool > enabled) override
void setDisplayIdFromOhos(std::optional< QOhosDisplayInfo::JsDisplayId > displayId)
void setExposedFromOhos(bool exposed)
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.
bool isWindowPcModeEnabled() const
static QOhosSettings & instance()
QOhosSurface * surfaceOrNull() const
void setWindowMask(const QOhosWindowProxy::WindowMask &windowMask)
void lower()
bool startMoving()
void raise()
QtOhos::enums::ohos::window::AvoidAreaType AvoidAreaType
QtOhos::enums::ohos::window::RectChangeReason RectChangeReason
QtOhos::enums::ohos::window::WindowEventType WindowEventType
QtOhos::enums::ohos::window::WindowStatusType WindowStatusType
static QWindowProxyRegistry & instance()
Combined button and popup list for selecting options.
bool isWindowRotatedByTabletScreenRotation(QWindow *window, QOhosWindowProxy::RectChangeOptions rectChangeOptions)
Qt::NativeGestureType gestureType
QInputDevice::DeviceType deviceType
QPointer< QWindow > targetWindow
QPointer< QWindow > targetWindow
QInputDevice::DeviceType deviceType
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
::OH_NativeXComponent_TouchPointToolType toolType
QFlags< OhosKeyboardModifier > modifiers