QNativeInterface::QHarmonyWindow Struct
Native interface to a window on HarmonyOS. More...
| Header: | #include <QWindow> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui)target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
- List of all members, including inherited members
- QHarmonyWindow is part of Native Interfaces.
Public Functions
| QHarmonyWindow() | |
| QHarmonyWindow(const QNativeInterface::QHarmonyWindow &) | |
| QHarmonyWindow(QNativeInterface::QHarmonyWindow &&) | |
| virtual QHarmonyJsObjectRef | ability() const = 0 |
| virtual QHarmonyJsObjectRef | jsWindow() const = 0 |
| QNativeInterface::QHarmonyWindow & | operator=(QNativeInterface::QHarmonyWindow &&) |
| QNativeInterface::QHarmonyWindow & | operator=(const QNativeInterface::QHarmonyWindow &) |
Detailed Description
Accessed through QWindow::nativeInterface().
On HarmonyOS, an ArkTS UIAbility instance shows a top-level QWindow in a window.Window. Platform APIs that are bound to a window need these objects, for example a picker that opens over the window, or an ability started from it. This interface provides them as QHarmonyJsObjectRef handles, which you dereference on the JS thread. Only top-level windows are shown this way. For a child window, both functions return null references. Use the interface of its top-level window instead.
Both functions return at once, without waiting for the JS thread. The objects are available when QWindow::show() returns and stay the same while the window stays visible and top-level. After the window is hidden or reparented, the functions may return null references. Showing the window again, or recreating it with QWindow::destroy() and show(), may give different objects.
This interface does not track what the platform does with the objects. If the platform destroys the ability or the window.Window, the functions may still return references to the destroyed objects, and code that uses the references on the JS thread must handle that.
See also Qt for HarmonyOS Platform API.
Member Function Documentation
[constexpr noexcept default] QHarmonyWindow::QHarmonyWindow()
Default-constructs an instance of QHarmonyWindow.
[delete] QHarmonyWindow::QHarmonyWindow(const QNativeInterface::QHarmonyWindow &)
Copy-constructs an instance of QHarmonyWindow. This function is deleted.
[delete] QHarmonyWindow::QHarmonyWindow(QNativeInterface::QHarmonyWindow &&)
Move-constructs an instance of QHarmonyWindow. This function is deleted.
[pure virtual] QHarmonyJsObjectRef QHarmonyWindow::ability() const
Returns the UIAbility instance that shows the window. Returns a null reference if no ability shows the window, for example if the platform has not attached the window to an ability yet.
[pure virtual] QHarmonyJsObjectRef QHarmonyWindow::jsWindow() const
Returns the window.Window that the window is shown in, or a null reference if the window is not shown in one.
[delete] QNativeInterface::QHarmonyWindow &QHarmonyWindow::operator=(QNativeInterface::QHarmonyWindow &&)
Move-assigns other to this QHarmonyWindow instance. This function is deleted.
[delete] QNativeInterface::QHarmonyWindow &QHarmonyWindow::operator=(const QNativeInterface::QHarmonyWindow &)
Copy-assigns other to this QHarmonyWindow instance. This function is deleted.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.