Qt for HarmonyOS/qtohosextras doc/Preload Example
< 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.