Qt for HarmonyOS/qtohosextras doc/QOhosWantInfo Class: Difference between revisions
Created page with "< Qt for HarmonyOS / qtohosextras doc = QOhosWantInfo Class = The QOhosWantInfo class is to represent Ohos want type. More... {| class="wikitable" |- ! Header: | #include <QOhosWantInfo> |- ! qmake: | QT += ohosextras |- ! Since: | Qt 5.12.12 |} * List of all members, including inherited members == Public Types == {| class="wikitable" style="width:100%" |- | class || '''ContactInfo_Cl..." |
Update from qdoc output (QTFOROH-2307) |
||
| Line 3: | Line 3: | ||
= QOhosWantInfo Class = | = QOhosWantInfo Class = | ||
The QOhosWantInfo class is to represent Ohos want type. More... | class [[Qt_for_HarmonyOS/qtohosextras_doc/Qt_Ohos_Extras_C++_Classes|QtOhosExtras]]::QOhosWantInfo | ||
The QOhosWantInfo class is to represent Ohos want type. [[#details|More...]] | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| Header: | |||
| #include <QOhosWantInfo> | | #include <QOhosWantInfo> | ||
|- | |- | ||
| qmake: | |||
| QT += ohosextras | | QT += ohosextras | ||
|- | |- | ||
| Since: | |||
| Qt 5.12.12 | | Qt 5.12.12 | ||
|} | |} | ||
* [[List_of_All_Members_for_QOhosWantInfo|List of all members, including inherited members]] | This class was introduced in Qt 5.12.12. | ||
* [[Qt_for_HarmonyOS/qtohosextras_doc/List_of_All_Members_for_QOhosWantInfo|List of all members, including inherited members]] | |||
== Public Types == | == Public Types == | ||
{| class="wikitable | {| class="wikitable" | ||
|- | |- | ||
| | | struct | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ContactInfo_Class|ContactInfo]]''' | |||
|- | |- | ||
| enum | | enum class | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#LaunchReason-enum|LaunchReason]]''' { Unknown, StartAbility, Continuation, PrepareContinuation, Preload } | |||
|} | |} | ||
== Public Functions == | == Public Functions == | ||
{| class="wikitable | {| class="wikitable" | ||
|- | |- | ||
| virtual | | virtual LaunchReason | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#launchReason|launchReason]]'''() const = 0 | |||
|- | |- | ||
| virtual | | virtual QSharedPointer<ContactInfo> | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#tryGetContactInfo|tryGetContactInfo]]'''() const = 0 | |||
|- | |- | ||
| virtual QSharedPointer<QList<QSharedPointer<ShareKit::QOhosSharedRecord>>> | |||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#tryGetSharedRecordsFromShareKit|tryGetSharedRecordsFromShareKit]]'''() const = 0 | |||
| virtual QSharedPointer<QList<QSharedPointer<ShareKit::QOhosSharedRecord>>> | |||
|- | |- | ||
| | | virtual QOhosWant | ||
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#want|want]]'''() const = 0 | |||
|} | |} | ||
== Detailed Description == | == Detailed Description == | ||
== Member Type Documentation == | |||
== | === <span id="LaunchReason-enum"></span>enum class QOhosWantInfo::LaunchReason === | ||
Enumerates the ability launch reasons. The value corresponds to launchParam.[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#launchReason|launchReason]] delivered by the platform and is obtained with [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#launchReason|QOhosWantInfo::launchReason]](). See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-app-ability-abilityconstant#launchreason AbilityConstant.LaunchReason]. | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Constant | |||
! Value | |||
! Description | |||
|- | |- | ||
| | | <code>QtOhosExtras::QOhosWantInfo::LaunchReason::Unknown</code> | ||
| <code>0</code> | |||
| Unknown reason. | |||
|- | |- | ||
| | | <code>QtOhosExtras::QOhosWantInfo::LaunchReason::StartAbility</code> | ||
| <code>1</code> | |||
| The ability is started by calling [[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbility|startAbility]]. | |||
|- | |- | ||
| PrepareContinuation || | | <code>QtOhosExtras::QOhosWantInfo::LaunchReason::Continuation</code> | ||
| <code>2</code> | |||
| The ability is started by means of cross-device migration. | |||
|- | |||
| <code>QtOhosExtras::QOhosWantInfo::LaunchReason::PrepareContinuation</code> | |||
| <code>3</code> | |||
| The ability is started in advance during cross-device migration. | |||
|- | |||
| <code>QtOhosExtras::QOhosWantInfo::LaunchReason::Preload</code> | |||
| <code>4</code> | |||
| The ability is started through preloading. | |||
|} | |} | ||
This enum was introduced or modified in Qt 5.12.12. | |||
== Member Function Documentation == | == Member Function Documentation == | ||
=== <span id=" | === <span id="launchReason"></span><code>[pure virtual] </code>[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#LaunchReason-enum|LaunchReason]] QOhosWantInfo::launchReason() const === | ||
Returns the launch reason associated with this Want info. The value can be used to complete different operations, for example, during cross-device migration to distinguish the LaunchReason::PrepareContinuation and LaunchReason::Continuation steps. | |||
<syntaxhighlight lang="cpp"> | |||
auto wantInfo = QtOhosExtras::QOhosAppContext::getAppLaunchWantInfo(); | |||
if (wantInfo->launchReason() == QtOhosExtras::QOhosWantInfo::LaunchReason::Continuation) { | |||
auto onContinueData = QtOhosExtras::tryGetOnContinueData(wantInfo->want()); | |||
// restore the application state from onContinueData ... | |||
} | |||
</syntaxhighlight> | |||
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#newWantInfoReceived|QOhosAbilityContext::newWantInfoReceived]](). | |||
=== <span id="tryGetContactInfo"></span>[pure virtual] QSharedPointer<[[ContactInfo_Class| | === <span id="tryGetContactInfo"></span><code>[pure virtual] </code>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/ContactInfo_Class|ContactInfo]]> QOhosWantInfo::tryGetContactInfo() const === | ||
Tries to get contact information from the associated Want. Returns <code>nullptr</code> if no contact information is found. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section19799132782117 systemShare.getContactInfo]. | Tries to get contact information from the associated Want. Returns <code>nullptr</code> if no contact information is found. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section19799132782117 systemShare.getContactInfo]. | ||
'''See also '''[[QOhosAbilityContext_Class#newWantInfoReceived|QOhosAbilityContext::newWantInfoReceived() | '''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#newWantInfoReceived|QOhosAbilityContext::newWantInfoReceived]]() and [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class#getAppLaunchWantInfo|QOhosAppContext::getAppLaunchWantInfo]](). | ||
=== <span id="tryGetSharedRecordsFromShareKit"></span>[pure virtual] QSharedPointer<QList<QSharedPointer<[[QOhosSharedRecord_Class|ShareKit::QOhosSharedRecord]]>>> QOhosWantInfo::tryGetSharedRecordsFromShareKit() const === | === <span id="tryGetSharedRecordsFromShareKit"></span><code>[pure virtual] </code>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[https://doc.qt.io/qt-5/qlist.html QList]<[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosSharedRecord_Class|ShareKit::QOhosSharedRecord]]>>> QOhosWantInfo::tryGetSharedRecordsFromShareKit() const === | ||
Tries to get shared records from | Tries to get shared records from assosiated want. The shared data is expected to be stored in the want parameters. Shared records are delivered on an application start or while the application is already running. Returns <code>nullptr</code> if no such data found. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section661613319216 systemShare.getSharedData]. | ||
'''See also '''[[QOhosAbilityContext_Class#newWantInfoReceived|QOhosAbilityContext::newWantInfoReceived() | '''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#newWantInfoReceived|QOhosAbilityContext::newWantInfoReceived]]() and [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class#getAppLaunchWantInfo|QOhosAppContext::getAppLaunchWantInfo]](). | ||
=== <span id="want"></span>[pure virtual] | === <span id="want"></span><code>[pure virtual] </code>[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] QOhosWantInfo::want() const === | ||
Return associated with this instance [[QOhosWant_Class|QOhosWant]] object. | Return associated with this instance [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] object. | ||
[[Category:Qt for HarmonyOS]] | [[Category:Qt for HarmonyOS]] | ||
Revision as of 08:33, 16 September 2026
< Qt for HarmonyOS / qtohosextras doc
QOhosWantInfo Class
class QtOhosExtras::QOhosWantInfo
The QOhosWantInfo class is to represent Ohos want type. More...
| Header: | #include <QOhosWantInfo> |
| qmake: | QT += ohosextras |
| Since: | Qt 5.12.12 |
This class was introduced in Qt 5.12.12.
Public Types
| struct | ContactInfo |
| enum class | LaunchReason { Unknown, StartAbility, Continuation, PrepareContinuation, Preload } |
Public Functions
| virtual LaunchReason | launchReason() const = 0 |
| virtual QSharedPointer<ContactInfo> | tryGetContactInfo() const = 0 |
| virtual QSharedPointer<QList<QSharedPointer<ShareKit::QOhosSharedRecord>>> | tryGetSharedRecordsFromShareKit() const = 0 |
| virtual QOhosWant | want() const = 0 |
Detailed Description
Member Type Documentation
enum class QOhosWantInfo::LaunchReason
Enumerates the ability launch reasons. The value corresponds to launchParam.launchReason delivered by the platform and is obtained with QOhosWantInfo::launchReason(). See AbilityConstant.LaunchReason.
| Constant | Value | Description |
|---|---|---|
QtOhosExtras::QOhosWantInfo::LaunchReason::Unknown
|
0
|
Unknown reason. |
QtOhosExtras::QOhosWantInfo::LaunchReason::StartAbility
|
1
|
The ability is started by calling startAbility. |
QtOhosExtras::QOhosWantInfo::LaunchReason::Continuation
|
2
|
The ability is started by means of cross-device migration. |
QtOhosExtras::QOhosWantInfo::LaunchReason::PrepareContinuation
|
3
|
The ability is started in advance during cross-device migration. |
QtOhosExtras::QOhosWantInfo::LaunchReason::Preload
|
4
|
The ability is started through preloading. |
This enum was introduced or modified in Qt 5.12.12.
Member Function Documentation
[pure virtual] LaunchReason QOhosWantInfo::launchReason() const
Returns the launch reason associated with this Want info. The value can be used to complete different operations, for example, during cross-device migration to distinguish the LaunchReason::PrepareContinuation and LaunchReason::Continuation steps.
auto wantInfo = QtOhosExtras::QOhosAppContext::getAppLaunchWantInfo();
if (wantInfo->launchReason() == QtOhosExtras::QOhosWantInfo::LaunchReason::Continuation) {
auto onContinueData = QtOhosExtras::tryGetOnContinueData(wantInfo->want());
// restore the application state from onContinueData ...
}
See also QOhosAbilityContext::newWantInfoReceived().
Tries to get contact information from the associated Want. Returns nullptr if no contact information is found. See systemShare.getContactInfo.
See also QOhosAbilityContext::newWantInfoReceived() and QOhosAppContext::getAppLaunchWantInfo().
Tries to get shared records from assosiated want. The shared data is expected to be stored in the want parameters. Shared records are delivered on an application start or while the application is already running. Returns nullptr if no such data found. See systemShare.getSharedData.
See also QOhosAbilityContext::newWantInfoReceived() and QOhosAppContext::getAppLaunchWantInfo().
[pure virtual] QOhosWant QOhosWantInfo::want() const
Return associated with this instance QOhosWant object.