Qt for HarmonyOS/qtohosextras doc/Preload Example: Difference between revisions
Add example documentation from qdoc output (QTFOROH-2307) |
Fix example page conversion (QTFOROH-2307) |
||
| Line 9: | Line 9: | ||
At startup the example inspects QOhosAppContext::getAppLaunchWantInfo() and QOhosWantInfo::launchReason(). When the reason is LaunchReason::StartAbility the window is shown immediately. When the reason is LaunchReason::Preload the window stays hidden; the example connects to QOhosAbilityContext::newWantInfoReceived() and shows the window on the first want whose launch reason is StartAbility, then disconnects the handler. | At startup the example inspects QOhosAppContext::getAppLaunchWantInfo() and QOhosWantInfo::launchReason(). When the reason is LaunchReason::StartAbility the window is shown immediately. When the reason is LaunchReason::Preload the window stays hidden; the example connects to QOhosAbilityContext::newWantInfoReceived() and shows the window on the first want whose launch reason is StartAbility, then disconnects the handler. | ||
* [[Qt_for_HarmonyOS/qtohosextras_doc/Preload_Example|abilitycontext/preload/preload.pro]] | * [[Qt_for_HarmonyOS/qtohosextras_doc/Preload_Example|abilitycontext/preload/preload.pro]] | ||
[[Category:Qt for HarmonyOS]] | [[Category:Qt for HarmonyOS]] | ||
Revision as of 09:24, 16 September 2026
< Qt for HarmonyOS / qtohosextras doc
Preload Example
Demonstrates handling the Preload launch reason so a preloaded ability shows its window only when actually started.
At startup the example inspects QOhosAppContext::getAppLaunchWantInfo() and QOhosWantInfo::launchReason(). When the reason is LaunchReason::StartAbility the window is shown immediately. When the reason is LaunchReason::Preload the window stays hidden; the example connects to QOhosAbilityContext::newWantInfoReceived() and shows the window on the first want whose launch reason is StartAbility, then disconnects the handler.