Jump to content

Qt for HarmonyOS/qtohosextras doc/App Bundle Info Example: Difference between revisions

From Qt Wiki
Add code snippets to example pages (QTFOROH-2307)
No edit summary
Line 1: Line 1:
< [[Qt_for_HarmonyOS/qtohosextras_doc|Qt for HarmonyOS / qtohosextras doc]]
= App Bundle Info Example =
= App Bundle Info Example =



Revision as of 02:06, 17 September 2026

App Bundle Info Example

Demonstrates how to read the application's bundle information at runtime.


The example shows a single label with the application's version code. The value is obtained at startup with QtOhosExtras::QOhosAppContext::instance(), followed by QOhosAppContext::getBundleInfo() and QOhosBundleInfo::versionCode(). The call is synchronous, so no signal handling is required.

     auto *appContext = QtOhosExtras::QOhosAppContext::instance();
     auto bundleInfo = appContext->getBundleInfo();

     QLabel label(QString("Application Version Code: %1").arg(bundleInfo->versionCode()));