Jump to content

Qt for HarmonyOS/qtohosextras doc/Native Window ID Example: Difference between revisions

From Qt Wiki
Add example documentation from qdoc output (QTFOROH-2307)
 
Fix example page conversion (QTFOROH-2307)
Line 11: Line 11:
'''Note: '''tryGetNativeWindowId() must only be called after the window has been shown, and the returned ID is not guaranteed to remain valid for the lifetime of the application.
'''Note: '''tryGetNativeWindowId() must only be called after the window has been shown, and the returned ID is not guaranteed to remain valid for the lifetime of the application.


Files:
* [[Qt_for_HarmonyOS/qtohosextras_doc/Native_Window_ID_Example|nativewindowid/main.cpp]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/Native_Window_ID_Example|nativewindowid/nativewindowid.pro]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/Native_Window_ID_Example|nativewindowid/nativewindowid.pro]]


[[Category:Qt for HarmonyOS]]
[[Category:Qt for HarmonyOS]]

Revision as of 09:23, 16 September 2026

< Qt for HarmonyOS / qtohosextras doc

Native Window ID Example

Demonstrates obtaining the native OHOS window ID of a Qt window.


The main window has a button that creates additional windows. For every window the example calls QtOhosExtras::tryGetNativeWindowId() after the window has been shown and displays the result in the window title, or <invalid> when the returned pointer is null.

Note: tryGetNativeWindowId() must only be called after the window has been shown, and the returned ID is not guaranteed to remain valid for the lifetime of the application.