Jump to content

Qt for HarmonyOS/qtohosextras doc/Bundled Embedded UI Extension Example

From Qt Wiki
Revision as of 09:20, 16 September 2026 by Shawn Luo (talk | contribs) (Fix example page conversion (QTFOROH-2307))

< Qt for HarmonyOS / qtohosextras doc

Bundled Embedded UI Extension Example

Demonstrates binding Qt windows to bundled EmbeddedUIExtensionAbility instances by key.


The example creates two identical windows, each containing a label and a button that rewrites the label text. Each window is bound to a QBundledEmbeddedUiExtensionAbility instance with QtOhosExtras::setBundledAbilityAndQWindowBindingKeyForQWindow(), using the binding keys "A" and "B". The underlying QWindow is created up front by calling QWidget::winId() before the binding function is invoked.

Note: The bound windows must have no parent or transient parent and must not be shown by the application. A window becomes visible only when the extension ability instance whose want carries the matching io.qt.public.bundledAbilityAndQWindowBindingKey parameter is started.