Jump to content

Qt for HarmonyOS/qtohosextras doc/Restart Application Example

From Qt Wiki
Revision as of 09:09, 16 September 2026 by Shawn Luo (talk | contribs) (Add example documentation from qdoc output (QTFOROH-2307))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< Qt for HarmonyOS / qtohosextras doc

Restart Application Example

Demonstrates restarting the application with or without its launch want parameters.


The window shows two buttons and a table listing the io.qt launch want parameters read from QOhosAppContext::getAppLaunchWant(). The first button calls QOhosAppContext::restartApp(), which restarts the application with the original launch want and keeps all parameters. The second clears the parameters of the launch want and calls the restartApp(const QOhosWant &) overload, restarting without them.

Note: restartApp() does not return: the process is terminated and started again. The application must hold system focus when the function is called, and overly frequent restarts are throttled by the system.

Files: