Jump to content

Qt for HarmonyOS/qtohosextras doc/Want FDs Sender Example: Difference between revisions

From Qt Wiki
Add example documentation from qdoc output (QTFOROH-2307)
 
Fix example page conversion (QTFOROH-2307)
Line 11: Line 11:
'''Note: '''The descriptors must still be open when startAbility() is called, so the [https://doc.qt.io/qt-5/qfile.html QFile] objects are kept alive for the duration of the call. Use application-specific keys and do not reuse a key in both QOhosWant::fds and QOhosWant::parameters.
'''Note: '''The descriptors must still be open when startAbility() is called, so the [https://doc.qt.io/qt-5/qfile.html QFile] objects are kept alive for the duration of the call. Use application-specific keys and do not reuse a key in both QOhosWant::fds and QOhosWant::parameters.


Files:
* [[Qt_for_HarmonyOS/qtohosextras_doc/Want_FDs_Sender_Example|abilitycontext/wantfdssender/main.cpp]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/Want_FDs_Sender_Example|abilitycontext/wantfdssender/wantfdssender.pro]]
* [[Qt_for_HarmonyOS/qtohosextras_doc/Want_FDs_Sender_Example|abilitycontext/wantfdssender/wantfdssender.pro]]


[[Category:Qt for HarmonyOS]]
[[Category:Qt for HarmonyOS]]

Revision as of 09:29, 16 September 2026

< Qt for HarmonyOS / qtohosextras doc

Want FDs Sender Example

Demonstrates sending open file descriptors to another ability through a want.


The form collects the target bundle, module and ability names and a set of files chosen through a file dialog. Send FD opens every file, stores its handle in QOhosWant::fds under the keys keyFd0, keyFd1 and so on, logs the dev / ino numbers for cross-checking on the receiver side, and starts the target with QtOhosExtras::startAbility().

Note: The descriptors must still be open when startAbility() is called, so the QFile objects are kept alive for the duration of the call. Use application-specific keys and do not reuse a key in both QOhosWant::fds and QOhosWant::parameters.