Qt for HarmonyOS/qtohosextras doc/QOhosWantInfo Class
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.