Jump to content

Qt for HarmonyOS/qtohosextras doc/QtOhosExtras Namespace: Difference between revisions

From Qt Wiki
Created page with "<!-- Source: qtohosextras.html --> <span id="qtohosextras-namespace"></span> = QtOhosExtras Namespace = The QtOhosExtras namespace provides miscellaneous functions to aid Ohos development. More... <div class="table"> {| class="wikitable alignedsummary" |- | class="memItemLeft rightAlign topAlign"| Header: | class="memItemRight bottomAlign"| <span class="preprocessor">#include </span> |- | cl..."
 
Drop manual breadcrumb, MediaWiki renders it automatically (QTFOROH-2307)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- Source: qtohosextras.html -->
<span id="qtohosextras-namespace"></span>
= QtOhosExtras Namespace =
= QtOhosExtras Namespace =


The [[Qt_for_HarmonyOS/qtohosextras_doc/Qt_Ohos_Extras_C++_Classes|QtOhosExtras]] namespace provides miscellaneous functions to aid Ohos development. [[#details|More...]]
The QtOhosExtras namespace provides miscellaneous functions to aid Ohos development. [[#details|More...]]


<div class="table">
{| class="wikitable"
 
{| class="wikitable alignedsummary"
|-
|-
| class="memItemLeft rightAlign topAlign"| Header:
| Header:
| class="memItemRight bottomAlign"| <span class="preprocessor">#include </span>
| #include <QtOhosExtras>
|-
|-
| class="memItemLeft rightAlign topAlign"| qmake:
| qmake:
| class="memItemRight bottomAlign"| QT += ohosextras
| QT += ohosextras
|-
|-
| class="memItemLeft rightAlign topAlign"| Since:
| Since:
| class="memItemRight bottomAlign"| Qt 5.12.12
| Qt 5.12.12
|}
|}


This namespace was introduced in Qt 5.12.12.


</div>
<span id="namespaces"></span>
<span id="namespaces"></span>
== Namespaces ==
== Namespaces ==


<div class="table">
{| class="wikitable"
 
|-
{| class="wikitable alignedsummary"
| namespace
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/AppPermissions_Namespace|AppPermissions]]'''
|-
| namespace
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace|FileShare]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| namespace
| namespace
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace|FileShare]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/Multimedia_Namespace|Multimedia]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| namespace
| namespace
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosPasteboard_Namespace|QOhosPasteboard]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosPasteboard_Namespace|QOhosPasteboard]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| namespace
| namespace
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace|ShareKit]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace|ShareKit]]'''
|}
|}


</div>
<span id="classes"></span>
<span id="classes"></span>
== Classes ==
== Classes ==


<div class="table">
{| class="wikitable"
 
|-
{| class="wikitable alignedsummary"
| class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class|QOhosAbilityContext]]'''
|-
| class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class|QOhosAppContext]]'''
|-
| class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosBundleInfo_Class|QOhosBundleInfo]]'''
|-
| class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosDistributedDataObject_Class|QOhosDistributedDataObject]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| struct
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class|QOhosAbilityContext]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosElementName_Class|QOhosElementName]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class|QOhosAppContext]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class|QOhosOnContinueContext]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosBundleInfo_Class|QOhosBundleInfo]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOpenLinkOptions_Class|QOhosOpenLinkOptions]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class|QOhosOnContinueContext]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOpenLinkOptions_Class|QOhosOpenLinkOptions]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class|QOhosStartRequest]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| struct
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class|QOhosWantInfo]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| class
| class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class|QOhosWantInfo]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWindowCreateParams_Class|QOhosWindowCreateParams]]'''
|}
|}


</div>
<span id="types"></span>
<span id="types"></span>
== Types ==
== Types ==


<div class="table">
{| class="wikitable"
 
{| class="wikitable alignedsummary"
|-
|-
| class="memItemLeft rightAlign topAlign"| enum
| enum class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#CloseEventRootCause-enum|CloseEventRootCause]]''' { InternalClose, AbilityClose, WindowStageClose }
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#CloseEventRootCause-enum|CloseEventRootCause]]''' { InternalClose, AbilityClose, WindowStageClose }
|-
|-
| class="memItemLeft rightAlign topAlign"| enum
| enum class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#QOhosWantFlag-enum|QOhosWantFlag]]''' { AuthReadUriPermission, AuthWriteUriPermission, InstallOnDemand }
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#QOhosWantFlag-enum|QOhosWantFlag]]''' { AuthReadUriPermission, AuthWriteUriPermission, InstallOnDemand }
|-
|-
| class="memItemLeft rightAlign topAlign"| flags
| flags
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#QOhosWantFlag-enum|QOhosWantFlags]]'''
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#QOhosWantFlag-enum|QOhosWantFlags]]'''
|-
|-
| class="memItemLeft rightAlign topAlign"| enum
| enum class
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#WindowGeometryPersistenceHint-enum|WindowGeometryPersistenceHint]]''' { Disabled, Enabled, FollowSystemSetting }
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#WindowGeometryPersistenceHint-enum|WindowGeometryPersistenceHint]]''' { Disabled, Enabled, FollowSystemSetting }
|}
|}


</div>
<span id="functions"></span>
<span id="functions"></span>
== Functions ==
== Functions ==


<div class="table">
{| class="wikitable"
 
{| class="wikitable alignedsummary"
|-
|-
| class="memItemLeft rightAlign topAlign"| bool
| bool
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#authorizeFilePath|authorizeFilePath]]'''(QWindow *''parentWindow'', const QString &amp;''filePath'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#authorizeFilePath|authorizeFilePath]]'''(QWindow *''parentWindow'', const QString &''filePath'')
|-
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| QSharedPointer<QOhosOpenLinkOptions>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#convertToOhosExtrasWantInfo|convertToOhosExtrasWantInfo]]'''(int ''wantInfo'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#createOpenLinkOptions|createOpenLinkOptions]]'''()
|-
|-
| class="memItemLeft rightAlign topAlign"| int
| QSharedPointer<QOhosStartOptions>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#convertToQpaWantInfo|convertToQpaWantInfo]]'''(''QSharedPointer'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#createStartOptions|createStartOptions]]'''()
|-
|-
| class="memItemLeft rightAlign topAlign"| QtOhosExtras::QOhosWant
| QSharedPointer<QOhosStartRequest>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#convertWantFromJsonObject|convertWantFromJsonObject]]'''(const QJsonObject &amp;''jsonWant'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#createStartRequest|createStartRequest]]'''(const QOhosStartOptions &''options'')
|-
|-
| class="memItemLeft rightAlign topAlign"| QJsonObject
| QSharedPointer<QOhosWindowCreateParams>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#convertWantToJsonObject|convertWantToJsonObject]]'''(const QtOhosExtras::QOhosWant &amp;''want'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#createWindowCreateParams|createWindowCreateParams]]'''()
|-
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| CloseEventRootCause
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#createOpenLinkOptions|createOpenLinkOptions]]'''()
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#getCloseEventRootCause|getCloseEventRootCause]]'''(QCloseEvent *''closeEvent'')
|-
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| bool
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#createStartOptions|createStartOptions]]'''()
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#moveFileToTrash|moveFileToTrash]]'''(const QString &''filePath'')
|-
|-
| class="memItemLeft rightAlign topAlign"| QtOhosExtras::CloseEventRootCause
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#getCloseEventRootCause|getCloseEventRootCause]]'''(QCloseEvent *''closeEvent'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setAbilityInstanceDestroyEnabled|setAbilityInstanceDestroyEnabled]]'''(QWindow *''instanceWindow'', bool ''destroyEnabled'')
|-
|-
| class="memItemLeft rightAlign topAlign"| bool
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#moveFileToTrash|moveFileToTrash]]'''(const QString &amp;''filePath'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setBundledAbilityAndQWindowBindingKeyForQWindow|setBundledAbilityAndQWindowBindingKeyForQWindow]]'''(QWindow *''window'', const QString &''qAbilityQWindowBindingKey'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const QMetaObject *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumMetaObject|qt_getEnumMetaObject]]'''(''QtOhosExtras::QOhosAppContext::ColorThemeMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setMainWindowGeometryPersistenceHint|setMainWindowGeometryPersistenceHint]]'''(WindowGeometryPersistenceHint ''geometryPersistenceHint'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const QMetaObject *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumMetaObject-1|qt_getEnumMetaObject]]'''(''QtOhosExtras::QOhosStartOptions::ProcessMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setShowWindowAsFloatWindowHint|setShowWindowAsFloatWindowHint]]'''(QWindow *''window'', bool ''showAsFloatWindow'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const QMetaObject *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumMetaObject-2|qt_getEnumMetaObject]]'''(''QtOhosExtras::QOhosStartOptions::StartupVisibility'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setShowWindowAsFloatWindowHint-1|setShowWindowAsFloatWindowHint]]'''(QWidget *''widget'', bool ''showAsFloatWindow'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const QMetaObject *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumMetaObject-3|qt_getEnumMetaObject]]'''(''QtOhosExtras::QOhosStartOptions::WindowMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setSurfaceBackgroundColor|setSurfaceBackgroundColor]]'''(QWindow *''window'', const QColor &''color'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const QMetaObject *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumMetaObject-4|qt_getEnumMetaObject]]'''(''QtOhosExtras::QOhosStartOptions::SupportWindowMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setSurfaceBackgroundColor-1|setSurfaceBackgroundColor]]'''(QWidget *''widget'', const QColor &''color'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const QMetaObject *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumMetaObject-5|qt_getEnumMetaObject]]'''(''QtOhosExtras::CloseEventRootCause'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowCornerRadius|setWindowCornerRadius]]'''(QWindow *''window'', double ''radius'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const QMetaObject *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumMetaObject-6|qt_getEnumMetaObject]]'''(''QtOhosExtras::WindowGeometryPersistenceHint'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowCornerRadius-1|setWindowCornerRadius]]'''(QWidget *''widget'', double ''radius'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const char *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumName|qt_getEnumName]]'''(''QtOhosExtras::QOhosAppContext::ColorThemeMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowDragResizable|setWindowDragResizable]]'''(QWindow *''window'', bool ''dragResizable'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const char *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumName-1|qt_getEnumName]]'''(''QtOhosExtras::QOhosStartOptions::ProcessMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowDragResizable-1|setWindowDragResizable]]'''(QWidget *''widget'', bool ''dragResizable'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const char *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumName-2|qt_getEnumName]]'''(''QtOhosExtras::QOhosStartOptions::StartupVisibility'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowKeepScreenOn|setWindowKeepScreenOn]]'''(QWindow *''window'', bool ''keepScreenOn'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const char *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumName-3|qt_getEnumName]]'''(''QtOhosExtras::QOhosStartOptions::WindowMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowKeepScreenOn-1|setWindowKeepScreenOn]]'''(QWidget *''widget'', bool ''keepScreenOn'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const char *
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumName-4|qt_getEnumName]]'''(''QtOhosExtras::QOhosStartOptions::SupportWindowMode'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowPrivacyMode|setWindowPrivacyMode]]'''(QWindow *''window'', bool ''privacyModeEnabled'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const char *
| QSharedPointer<QOhosOperationStatus>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumName-5|qt_getEnumName]]'''(''QtOhosExtras::CloseEventRootCause'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbility|startAbility]]'''(const QOhosWant &''want'')
|-
|-
| class="memItemLeft rightAlign topAlign"| const char *
| QSharedPointer<QOhosOperationStatus>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#qt_getEnumName-6|qt_getEnumName]]'''(''QtOhosExtras::WindowGeometryPersistenceHint'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbility-1|startAbility]]'''(const QOhosWant &''want'', const QOhosStartOptions &''options'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| QSharedPointer<QOhosOperationStatus>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#requestQOhosPermissionFromUserIfNeeded|requestQOhosPermissionFromUserIfNeeded]]'''(QObject *''resultConsumerQtContext'', QWindow *''optInstanceMainWindow'', const QString &amp;''permissionName'', int ''resultConsumer'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbility-2|startAbility]]'''(const QOhosWant &''want'', const QOhosStartRequest &''startRequest'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| QSharedPointer<QOhosOperationStatus>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#requestQOhosPermissionOnSettingIfNeeded|requestQOhosPermissionOnSettingIfNeeded]]'''(QObject *''resultConsumerQtContext'', QWindow *''optInstanceMainWindow'', int ''permission'', int ''resultConsumer'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbilityByType|startAbilityByType]]'''(const QString &''appType'', const QJsonObject &''wantParameters'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setAbilityInstanceDestroyEnabled|setAbilityInstanceDestroyEnabled]]'''(QWindow *''instanceWindow'', bool ''destroyEnabled'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAppProcess|startAppProcess]]'''(const QString &''processId'', const QOhosWant &''requestWant'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setBundledAbilityAndQWindowBindingKeyForQWindow|setBundledAbilityAndQWindowBindingKeyForQWindow]]'''(QWindow *''window'', const QString &amp;''qAbilityQWindowBindingKey'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAppProcess-1|startAppProcess]]'''(const QString &''processId'', const QOhosWant &''requestWant'', const QOhosStartOptions &''options'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setMainWindowGeometryPersistenceHint|setMainWindowGeometryPersistenceHint]]'''(QtOhosExtras::WindowGeometryPersistenceHint ''geometryPersistenceHint'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAppProcess-2|startAppProcess]]'''(const QString &''processId'', const QOhosWant &''requestWant'', const QOhosStartRequest &''startRequest'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setShowWindowAsFloatWindowHint|setShowWindowAsFloatWindowHint]]'''(QWindow *''window'', bool ''showAsFloatWindow'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startNewAbilityInstance|startNewAbilityInstance]]'''(QWidget *''instanceWidget'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| QSharedPointer<double>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setShowWindowAsFloatWindowHint-1|setShowWindowAsFloatWindowHint]]'''(QWidget *''widget'', bool ''showAsFloatWindow'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryGetNativeWindowId|tryGetNativeWindowId]]'''(QWindow *''window'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| QSharedPointer<QByteArray>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setSurfaceBackgroundColor|setSurfaceBackgroundColor]]'''(QWindow *''window'', const QColor &amp;''color'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryGetOnContinueData|tryGetOnContinueData]]'''(const QOhosWant &''want'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| QSharedPointer<double>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setSurfaceBackgroundColor-1|setSurfaceBackgroundColor]]'''(QWidget *''widget'', const QColor &amp;''color'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryGetScreenDisplayId|tryGetScreenDisplayId]]'''(QScreen *''screen'')
|-
|-
| class="memItemLeft rightAlign topAlign"| void
| QList<QSharedPointer<QOhosDistributedDataObject>>
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowCornerRadius|setWindowCornerRadius]]'''(QWindow *''window'', double ''radius'')
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryRestoreOnContinueDistributedDataObjects|tryRestoreOnContinueDistributedDataObjects]]'''(const QOhosWant &''want'')
|-
| class="memItemLeft rightAlign topAlign"| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowCornerRadius-1|setWindowCornerRadius]]'''(QWidget *''widget'', double ''radius'')
|-
| class="memItemLeft rightAlign topAlign"| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowKeepScreenOn|setWindowKeepScreenOn]]'''(QWindow *''window'', bool ''keepScreenOn'')
|-
| class="memItemLeft rightAlign topAlign"| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowKeepScreenOn-1|setWindowKeepScreenOn]]'''(QWidget *''widget'', bool ''keepScreenOn'')
|-
| class="memItemLeft rightAlign topAlign"| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#setWindowPrivacyMode|setWindowPrivacyMode]]'''(QWindow *''window'', bool ''privacyModeEnabled'')
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbility|startAbility]]'''(const QtOhosExtras::QOhosWant &amp;''want'')
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbility-1|startAbility]]'''(const QtOhosExtras::QOhosWant &amp;''want'', const QtOhosExtras::QOhosStartOptions &amp;''options'')
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAbilityByType|startAbilityByType]]'''(const QString &amp;''appType'', const QJsonObject &amp;''wantParameters'')
|-
| class="memItemLeft rightAlign topAlign"| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAppProcess|startAppProcess]]'''(const QString &amp;''processId'', const QtOhosExtras::QOhosWant &amp;''requestWant'')
|-
| class="memItemLeft rightAlign topAlign"| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startAppProcess-1|startAppProcess]]'''(const QString &amp;''processId'', const QtOhosExtras::QOhosWant &amp;''requestWant'', const QtOhosExtras::QOhosStartOptions &amp;''options'')
|-
| class="memItemLeft rightAlign topAlign"| void
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#startNewAbilityInstance|startNewAbilityInstance]]'''(QWidget *''instanceWidget'')
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryGetNativeWindowId|tryGetNativeWindowId]]'''(QWindow *''window'')
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryGetOnContinueData|tryGetOnContinueData]]'''(const QtOhosExtras::QOhosWant &amp;''want'')
|-
| class="memItemLeft rightAlign topAlign"| QSharedPointer
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryGetScreenDisplayId|tryGetScreenDisplayId]]'''(QScreen *''screen'')
|-
| class="memItemLeft rightAlign topAlign"| int
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryMapQOhosPermissionFromName|tryMapQOhosPermissionFromName]]'''(''const QString &amp;'')
|-
| class="memItemLeft rightAlign topAlign"| int
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#tryMapQOhosPermissionToName|tryMapQOhosPermissionToName]]'''(''int'')
|-
| class="memItemLeft rightAlign topAlign"| QFlags
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#operator-7c|operator|]]'''(QOhosWantFlags::enum_type ''f1'', QOhosWantFlags::enum_type ''f2'')
|-
| class="memItemLeft rightAlign topAlign"| QFlags
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#operator-7c-1|operator|]]'''(QOhosWantFlags::enum_type ''f1'', QFlags ''f2'')
|-
| class="memItemLeft rightAlign topAlign"| QIncompatibleFlag
| class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#operator-7c-2|operator|]]'''(QOhosWantFlags::enum_type ''f1'', int ''f2'')
|}
|}


== Detailed Description ==


</div>
== Namespaces ==
<span id="details"></span>


<div class="descr">
=== namespace QtOhosExtras::AppPermissions ===


<span id="details"></span>
<syntaxhighlight lang="cpp">
== Detailed Description ==


The [[Qt_for_HarmonyOS/qtohosextras_doc/Qt_Ohos_Extras_C++_Classes|QtOhosExtras]] namespace provides miscellaneous functions to aid Ohos development.
auto *appContext = QtOhosExtras::QOhosAppContext::instance();
if (!appContext->isPermissionGranted(QtOhosExtras::AppPermissions::Permission::AccessBluetooth)) {
    QObject::connect(
        appContext, &QtOhosExtras::QOhosAppContext::permissionRequestResponseWithResultReceived,
        [](QtOhosExtras::AppPermissions::Permission permission,
            QtOhosExtras::AppPermissions::PermissionResult result) {
            if (result.permissionGranted) {
                // start using the permission-protected feature ...
            }
        });
    appContext->requestPermissionFromUserIfNeeded(
        QtOhosExtras::AppPermissions::Permission::AccessBluetooth);
}


</syntaxhighlight>


</div>
This namespace was introduced in Qt 5.12.12.
<div class="nmspace">
 
<span id="namespaces-1"></span>
== Namespaces ==


<span id="namespace-qtohosextrasfileshare"></span>
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class|QtOhosExtras::QOhosAppContext]] and [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class|QtOhosExtras::QOhosAbilityContext]].
=== <span></span>namespace QtOhosExtras::<span class="name">FileShare</span> ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace|FileShare]] to expose file permission API.
=== namespace QtOhosExtras::FileShare ===


This API uses file system paths, which differ from the URIs used internally by HarmonyOS. For example, the path <code>/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> will be converted to the URI <code>file://com.your.example/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> , where <code>com.your.example</code> is app bundle name.
This API uses file system paths, which differ from the URIs used internally by HarmonyOS. For example, the path <code>/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> will be converted to the URI <code>file://com.your.example/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> , where <code>com.your.example</code> is app bundle name.
Line 297: Line 236:
To learn more about file paths and URIs in HarmonyOS, see [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/app-sandbox-directory-V5 sandbox documentation].
To learn more about file paths and URIs in HarmonyOS, see [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/app-sandbox-directory-V5 sandbox documentation].


'''Warning:''' This API relies on the underlying OHOS implementation. The following functions: [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#checkPersistent|checkPersistent]]() may be unavailable on some devices. Additionally, there may be limitations on the maximum number of policies, and certain permissions may need to be explicitly granted to the application.
'''Warning: '''This API relies on the underlying OHOS implementation. The following functions: [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#checkPersistent|checkPersistent]]() may be unavailable on some devices. Additionally, there may be limitations on the maximum number of policies, and certain permissions may need to be explicitly granted to the application.


For more details and limitations, refer to the [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V14/native-fileshare-guidelines-V14 API documentation].
For more details and limitations, refer to the [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V14/native-fileshare-guidelines-V14 API documentation].
Line 303: Line 242:
This namespace was introduced in Qt 5.12.12.
This namespace was introduced in Qt 5.12.12.


<span id="namespace-qtohosextrasqohospasteboard"></span>
=== namespace QtOhosExtras::Multimedia ===
=== <span></span>namespace QtOhosExtras::<span class="name">QOhosPasteboard</span> ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosPasteboard_Namespace|QOhosPasteboard]] class is to manage native pasteboard.
The Multimedia namespace contains functions and types for controlling audio stream usage on HarmonyOS. It allows setting audio stream usage hints on QSoundEffect and QSound objects, which influences how the system routes and manages audio output.


This namespace was introduced in Qt 5.12.12.
This namespace was introduced in Qt 5.12.12.


<span id="namespace-qtohosextrassharekit"></span>
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/Multimedia_Namespace#AudioStreamUsageHint-enum|QtOhosExtras::Multimedia::AudioStreamUsageHint]].
=== <span></span>namespace QtOhosExtras::<span class="name">ShareKit</span> ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace|ShareKit]] to expose Share Kit API.
=== namespace QtOhosExtras::QOhosPasteboard ===


This namespace was introduced in Qt 5.12.12.
This namespace was introduced in Qt 5.12.12.


=== namespace QtOhosExtras::ShareKit ===


</div>
This namespace was introduced in Qt 5.12.12.
<div class="classes">


<span id="classes-1"></span>
== Classes ==
== Classes ==


<span id="class-qohosabilitycontext"></span>
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class|QOhosAbilityContext]] ===
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class|QOhosAbilityContext]] ===
 
The QOhosAbilityContext class is to manage native UI Ability context. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5 UIAbilityContext]. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#details|More...]]
 
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class|QOhosAppContext]] ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class|QOhosAbilityContext]] class is to manage native UI Ability context. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5 UIAbilityContext]. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#details|More...]]
The QOhosAppContext class contains API to manage native application context. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class#details|More...]]


<span id="class-qohosappcontext"></span>
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosBundleInfo_Class|QOhosBundleInfo]] ===
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class|QOhosAppContext]] ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class|QOhosAppContext]] class contains API to manage native application context. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAppContext_Class#details|More...]]
The QOhosBundleInfo class contains API to provide native application bundle info. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosBundleInfo_Class#details|More...]]


<span id="class-qohosbundleinfo"></span>
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosDistributedDataObject_Class|QOhosDistributedDataObject]] ===
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosBundleInfo_Class|QOhosBundleInfo]] ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosBundleInfo_Class|QOhosBundleInfo]] class contains API to provide native application bundle info. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosBundleInfo_Class#details|More...]]
The QOhosDistributedDataObject class shares a fixed set of named fields across devices that belong to the same trusted network. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosDistributedDataObject_Class#details|More...]]


<span id="class-qohosoncontinuecontext"></span>
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosElementName_Class|QOhosElementName]] ===
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class|QOhosOnContinueContext]] ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class|QOhosOnContinueContext]] class manages onContinue context. It provides system data, like source application version code and set the onContinue result that is requested by the system. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V13/js-apis-app-ability-uiability-V13#uiabilityoncontinue UIAbility onContinue]. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class#details|More...]]
The QOhosElementName struct identifies an ability component. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosElementName_Class#details|More...]]


<span id="class-qohosopenlinkoptions"></span>
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class|QOhosOnContinueContext]] ===
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOpenLinkOptions_Class|QOhosOpenLinkOptions]] ===


<span id="class-qohosoperationstatus"></span>
The QOhosOnContinueContext class manages onContinue context. It provides system data, like source application version code and set the onContinue result that is requested by the system. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V13/js-apis-app-ability-uiability-V13#uiabilityoncontinue UIAbility onContinue]. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class#details|More...]]
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]] ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]] class provides interface to get an opertaion status. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class#details|More...]]
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOpenLinkOptions_Class|QOhosOpenLinkOptions]] ===


<span id="class-qohosstartoptions"></span>
The QOhosOpenLinkOptions class provides options for the [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#tryOpenLink|QOhosAbilityContext::tryOpenLink]]() call. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOpenLinkOptions_Class#details|More...]]
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] class is to provide new options for new started ability or process. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class#details|More...]]
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]] ===


<span id="class-qohoswant"></span>
The QOhosOperationStatus class provides an interface to check an operation status. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class#details|More...]]
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] ===


[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] wraps Ohos [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/want-V5 Want] class. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class#details|More...]]
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] ===


<span id="class-qohoswantinfo"></span>
The QOhosStartOptions class is to provide new options for new started ability or process. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class#details|More...]]
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class|QOhosWantInfo]] ===


The [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class|QOhosWantInfo]] class is to represent Ohos want type. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#details|More...]]
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class|QOhosStartRequest]] ===


The QOhosStartRequest class emits signals for start ability. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class#details|More...]]


</div>
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] ===
<div class="types">
 
QOhosWant wraps Ohos [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/want-V5 Want] class. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class#details|More...]]
 
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class|QOhosWantInfo]] ===
 
The QOhosWantInfo class is to represent Ohos want type. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWantInfo_Class#details|More...]]
 
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWindowCreateParams_Class|QOhosWindowCreateParams]] ===
 
The QOhosWindowCreateParams class provides window creation parameters for a started ability window. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWindowCreateParams_Class#details|More...]]


<span id="type-documentation"></span>
== Type Documentation ==
== Type Documentation ==


<span id="CloseEventRootCause-enum"></span>
=== <span id="CloseEventRootCause-enum"></span>enum class QtOhosExtras::CloseEventRootCause ===
=== <span id="CloseEventRootCause-enum"></span>enum QtOhosExtras::<span class="name">CloseEventRootCause</span> ===


Enumerates the close event root cause.
Enumerates the close event root cause.


<div class="table">
{| class="wikitable"
 
|-
{| class="wikitable valuelist"
! Constant
|- class="odd" valign="top"
! Value
! class="tblConst"| Constant
! Description
! class="tblval"| Value
! class="tbldscr"| Description
|-
|-
| class="topAlign"| <code>QtOhosExtras::InternalClose</code>
| <code>QtOhosExtras::CloseEventRootCause::InternalClose</code>
| class="topAlign tblval"| <code>0</code>
| <code>0</code>
| class="topAlign"| Close root cause not specified or unknown.
| Close root cause not specified or unknown.
|-
|-
| class="topAlign"| <code>QtOhosExtras::AbilityClose</code>
| <code>QtOhosExtras::CloseEventRootCause::AbilityClose</code>
| class="topAlign tblval"| <code>1</code>
| <code>1</code>
| class="topAlign"| Close root cause of preparing to terminate.
| Close root cause of preparing to terminate.
|-
|-
| class="topAlign"| <code>QtOhosExtras::WindowStageClose</code>
| <code>QtOhosExtras::CloseEventRootCause::WindowStageClose</code>
| class="topAlign tblval"| <code>2</code>
| <code>2</code>
| class="topAlign"| Close root cause of native Window Stage or Sub-Window close.
| Close root cause of native Window Stage or Sub-Window close.
|}
|}


</div>
This enum was introduced or modified in Qt 5.12.12.
This enum was introduced or modified in Qt 5.12.12.


<span id="QOhosWantFlag-enum"></span>
=== <span id="QOhosWantFlag-enum"></span>enum class QtOhosExtras::QOhosWantFlag<br/>flags QtOhosExtras::QOhosWantFlags ===
=== <span id="QOhosWantFlag-enum"></span>enum QtOhosExtras::<span class="name">QOhosWantFlag</span><br />
flags QtOhosExtras::<span class="name">QOhosWantFlags</span> ===


QOhosWantFlag specifies how the Want will be handled. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-ability-wantconstant-V5#flags Flags].
QOhosWantFlag specifies how the Want will be handled. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-ability-wantconstant-V5#flags Flags].


<div class="table">
{| class="wikitable"
 
|-
{| class="wikitable valuelist"
! Constant
|- class="odd" valign="top"
! Value
! class="tblConst"| Constant
! Description
! class="tblval"| Value
! class="tbldscr"| Description
|-
|-
| class="topAlign"| <code>QtOhosExtras::AuthReadUriPermission</code>
| <code>QtOhosExtras::QOhosWantFlag::AuthReadUriPermission</code>
| class="topAlign tblval"| <code>1 &lt;&lt; 0</code>
| <code>1 << 0</code>
| class="topAlign"| Grants the permission to read the URI.
| Grants the permission to read the URI.
|-
|-
| class="topAlign"| <code>QtOhosExtras::AuthWriteUriPermission</code>
| <code>QtOhosExtras::QOhosWantFlag::AuthWriteUriPermission</code>
| class="topAlign tblval"| <code>1 &lt;&lt; 1</code>
| <code>1 << 1</code>
| class="topAlign"| Grants the permission to write data to the URI.
| Grants the permission to write data to the URI.
|-
|-
| class="topAlign"| <code>QtOhosExtras::InstallOnDemand</code>
| <code>QtOhosExtras::QOhosWantFlag::InstallOnDemand</code>
| class="topAlign tblval"| <code>1 &lt;&lt; 2</code>
| <code>1 << 2</code>
| class="topAlign"| Ability will be installed if it has not been installed.
| Ability will be installed if it has not been installed.
|}
|}


</div>
This enum was introduced or modified in Qt 5.12.12.
This enum was introduced or modified in Qt 5.12.12.


The QOhosWantFlags type is a typedef for [[../qtcore/qflags.html|QFlags]]. It stores an OR combination of QOhosWantFlag values.
The QOhosWantFlags type is a typedef for [https://doc.qt.io/qt-5/qflags.html QFlags]<QOhosWantFlag>. It stores an OR combination of QOhosWantFlag values.


<span id="WindowGeometryPersistenceHint-enum"></span>
=== <span id="WindowGeometryPersistenceHint-enum"></span>enum class QtOhosExtras::WindowGeometryPersistenceHint ===
=== <span id="WindowGeometryPersistenceHint-enum"></span>enum QtOhosExtras::<span class="name">WindowGeometryPersistenceHint</span> ===


Enumerates the policy for window geometry persistence support. Specifies how a window’s geometry (the size and position) is determined when it is shown.
Enumerates the policy for window geometry persistence support. Specifies how a window’s geometry (the size and position) is determined when it is shown.


<div class="table">
{| class="wikitable"
 
|-
{| class="wikitable valuelist"
! Constant
|- class="odd" valign="top"
! Value
! class="tblConst"| Constant
! Description
! class="tblval"| Value
! class="tbldscr"| Description
|-
|-
| class="topAlign"| <code>QtOhosExtras::Disabled</code>
| <code>QtOhosExtras::WindowGeometryPersistenceHint::Disabled</code>
| class="topAlign tblval"| <code>0</code>
| <code>0</code>
| class="topAlign"| Use default window's geometry.
| Use default window's geometry.
|-
|-
| class="topAlign"| <code>QtOhosExtras::Enabled</code>
| <code>QtOhosExtras::WindowGeometryPersistenceHint::Enabled</code>
| class="topAlign tblval"| <code>1</code>
| <code>1</code>
| class="topAlign"| Restore previous window's geometry (position and size when before window was closed).
| Restore previous window's geometry (position and size when before window was closed).
|-
|-
| class="topAlign"| <code>QtOhosExtras::FollowSystemSetting</code>
| <code>QtOhosExtras::WindowGeometryPersistenceHint::FollowSystemSetting</code>
| class="topAlign tblval"| <code>2</code>
| <code>2</code>
| class="topAlign"| Let the system decide whether to use <code>Disabled</code> or <code>Enabled</code> value.
| Let the system decide whether to use <code>Disabled</code> or <code>Enabled</code> value.
|}
|}


</div>
This enum was introduced or modified in Qt 5.12.12.
This enum was introduced or modified in Qt 5.12.12.


</div>
<div class="func">
<span id="function-documentation"></span>
== Function Documentation ==
== Function Documentation ==


<span id="authorizeFilePath"></span>
=== <span id="authorizeFilePath"></span>bool QtOhosExtras::authorizeFilePath([https://doc.qt.io/qt-5/qwindow.html QWindow] *''parentWindow'', const [https://doc.qt.io/qt-5/qstring.html QString] &''filePath'') ===
=== <span id="authorizeFilePath"></span><span class="type">bool</span> QtOhosExtras::<span class="name">authorizeFilePath</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''parentWindow'', const <span class="type">[[../qtcore/qstring.html|QString]]</span> &amp;''filePath'') ===


Request authorization on the User selected ''parentWindow'' for a given ''filePath''. The system File Dialog in authorization mode will be presented to the User. According to User choice returns true if file path is authorized, false otherwise. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-file-picker#documentselectoptions authMode]
Request authorization on the User selected ''parentWindow'' for a given ''filePath''. The system File Dialog in authorization mode will be presented to the User. According to User choice returns true if file path is authorized, false otherwise. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-file-picker#documentselectoptions authMode]
Line 481: Line 399:
This function was introduced in Qt 5.12.12.
This function was introduced in Qt 5.12.12.


<span id="convertToOhosExtrasWantInfo"></span>
=== <span id="createOpenLinkOptions"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOpenLinkOptions_Class|QOhosOpenLinkOptions]]> QtOhosExtras::createOpenLinkOptions() ===
=== convertToOhosExtrasWantInfo ===
 
<syntaxhighlight lang="cpp">
QSharedPointer<QtOhosExtras::QOhosWantInfo> QtOhosExtras::convertToOhosExtrasWantInfo(int ''wantInfo'')
</syntaxhighlight>


<span id="convertToQpaWantInfo"></span>
Creates an options object to be used with [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#tryOpenLink|QOhosAbilityContext::tryOpenLink]]().
=== <span id="convertToQpaWantInfo"></span><span class="type">int</span> QtOhosExtras::<span class="name">convertToQpaWantInfo</span>(''QSharedPointer'') ===


<span id="convertWantFromJsonObject"></span>
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#tryOpenLink|QOhosAbilityContext::tryOpenLink]]().
=== <span id="convertWantFromJsonObject"></span><span class="type">[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QtOhosExtras::QOhosWant]]</span> QtOhosExtras::<span class="name">convertWantFromJsonObject</span>(const <span class="type">[[../qtcore/qjsonobject.html|QJsonObject]]</span> &amp;''jsonWant'') ===


<span id="convertWantToJsonObject"></span>
=== <span id="createStartOptions"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]]> QtOhosExtras::createStartOptions() ===
=== <span id="convertWantToJsonObject"></span><span class="type">[[../qtcore/qjsonobject.html|QJsonObject]]</span> QtOhosExtras::<span class="name">convertWantToJsonObject</span>(const <span class="type">[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QtOhosExtras::QOhosWant]]</span> &amp;''want'') ===
 
<span id="createOpenLinkOptions"></span>
=== createOpenLinkOptions ===
 
<syntaxhighlight lang="cpp">
QSharedPointer<QtOhosExtras::QOhosOpenLinkOptions> QtOhosExtras::createOpenLinkOptions()
</syntaxhighlight>
 
<span id="createStartOptions"></span>
=== createStartOptions ===
 
<syntaxhighlight lang="cpp">
QSharedPointer<QtOhosExtras::QOhosStartOptions> QtOhosExtras::createStartOptions()
</syntaxhighlight>


Creates [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] instance.
Creates [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] instance.


<span id="getCloseEventRootCause"></span>
=== <span id="createStartRequest"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class|QOhosStartRequest]]> QtOhosExtras::createStartRequest(const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] &''options'') ===
=== <span id="getCloseEventRootCause"></span><span class="type">[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#CloseEventRootCause-enum|QtOhosExtras::CloseEventRootCause]]</span> QtOhosExtras::<span class="name">getCloseEventRootCause</span>(<span class="type">[[../qtgui/qcloseevent.html|QCloseEvent]]</span> *''closeEvent'') ===


Converts a given ''closeEvent'' to [[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#CloseEventRootCause-enum|QtOhosExtras::CloseEventRootCause]].
Creates a start request for given ''options'' and adapts the completion handler into Qt signals.


Returns related [[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#CloseEventRootCause-enum|QtOhosExtras::CloseEventRootCause]] value.
Connect to [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class#requestSucceeded|QOhosStartRequest::requestSucceeded]]() and [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class#requestFailed|QOhosStartRequest::requestFailed]]() to receive completion handler results.


<span id="moveFileToTrash"></span>
See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-app-ability-startoptions Completion Handler].
=== <span id="moveFileToTrash"></span><span class="type">bool</span> QtOhosExtras::<span class="name">moveFileToTrash</span>(const <span class="type">[[../qtcore/qstring.html|QString]]</span> &amp;''filePath'') ===


Moves the file specified by ''filePath'' to the trash. Returns true if successful, false otherwise.
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class|QOhosStartRequest]].


This function provides functionality of QFile::moveToTrash() from Qt 5.15.
=== <span id="createWindowCreateParams"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWindowCreateParams_Class|QOhosWindowCreateParams]]> QtOhosExtras::createWindowCreateParams() ===


<span id="qt_getEnumMetaObject"></span>
Creates [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWindowCreateParams_Class|QOhosWindowCreateParams]] instance.
=== <span id="qt_getEnumMetaObject"></span>const <span class="type">[[../qtcore/qmetaobject.html|QMetaObject]]</span> *QtOhosExtras::<span class="name">qt_getEnumMetaObject</span>(''QtOhosExtras::QOhosAppContext::ColorThemeMode'') ===


<span id="qt_getEnumMetaObject-1"></span>
=== <span id="getCloseEventRootCause"></span>[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#CloseEventRootCause-enum|CloseEventRootCause]] QtOhosExtras::getCloseEventRootCause([https://doc.qt.io/qt-5/qcloseevent.html QCloseEvent] *''closeEvent'') ===
=== <span id="qt_getEnumMetaObject-1"></span>const <span class="type">[[../qtcore/qmetaobject.html|QMetaObject]]</span> *QtOhosExtras::<span class="name">qt_getEnumMetaObject</span>(''QtOhosExtras::QOhosStartOptions::ProcessMode'') ===


<span id="qt_getEnumMetaObject-2"></span>
Converts a given ''closeEvent'' to [[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#CloseEventRootCause-enum|QtOhosExtras::CloseEventRootCause]] and returns the related value.
=== <span id="qt_getEnumMetaObject-2"></span>const <span class="type">[[../qtcore/qmetaobject.html|QMetaObject]]</span> *QtOhosExtras::<span class="name">qt_getEnumMetaObject</span>(''QtOhosExtras::QOhosStartOptions::StartupVisibility'') ===


<span id="qt_getEnumMetaObject-3"></span>
=== <span id="moveFileToTrash"></span>bool QtOhosExtras::moveFileToTrash(const [https://doc.qt.io/qt-5/qstring.html QString] &''filePath'') ===
=== <span id="qt_getEnumMetaObject-3"></span>const <span class="type">[[../qtcore/qmetaobject.html|QMetaObject]]</span> *QtOhosExtras::<span class="name">qt_getEnumMetaObject</span>(''QtOhosExtras::QOhosStartOptions::WindowMode'') ===


<span id="qt_getEnumMetaObject-4"></span>
Moves the file specified by ''filePath'' to the trash. Returns true if successful, false otherwise.
=== <span id="qt_getEnumMetaObject-4"></span>const <span class="type">[[../qtcore/qmetaobject.html|QMetaObject]]</span> *QtOhosExtras::<span class="name">qt_getEnumMetaObject</span>(''QtOhosExtras::QOhosStartOptions::SupportWindowMode'') ===


<span id="qt_getEnumMetaObject-5"></span>
This function provides functionality of [https://doc.qt.io/qt-5/qfile.html#moveToTrash QFile::moveToTrash]() from Qt 5.15.
=== <span id="qt_getEnumMetaObject-5"></span>const <span class="type">[[../qtcore/qmetaobject.html|QMetaObject]]</span> *QtOhosExtras::<span class="name">qt_getEnumMetaObject</span>(''QtOhosExtras::CloseEventRootCause'') ===


<span id="qt_getEnumMetaObject-6"></span>
=== <span id="setAbilityInstanceDestroyEnabled"></span>void QtOhosExtras::setAbilityInstanceDestroyEnabled([https://doc.qt.io/qt-5/qwindow.html QWindow] *''instanceWindow'', bool ''destroyEnabled'') ===
=== <span id="qt_getEnumMetaObject-6"></span>const <span class="type">[[../qtcore/qmetaobject.html|QMetaObject]]</span> *QtOhosExtras::<span class="name">qt_getEnumMetaObject</span>(''QtOhosExtras::WindowGeometryPersistenceHint'') ===


<span id="qt_getEnumName"></span>
Sets whether the Ability related with ''instanceWindow'' can be automatically destroyed by the system when the user clicks on the window's "close" button. If ''destroyEnabled'' is <code>true</code>, the system destroys the Ability automatically (and Qt needs to adapt to this). If ''destroyEnabled'' = <code>false</code>, the window is not automatically destroyed, but instead standard Qt path for window close is triggered, i.e. [https://doc.qt.io/qt-5/qwindow.html#close QWindow::close]().
=== <span id="qt_getEnumName"></span>const <span class="type">char</span> *QtOhosExtras::<span class="name">qt_getEnumName</span>(''QtOhosExtras::QOhosAppContext::ColorThemeMode'') ===


<span id="qt_getEnumName-1"></span>
By default, the flag is set to <code>false</code>.
=== <span id="qt_getEnumName-1"></span>const <span class="type">char</span> *QtOhosExtras::<span class="name">qt_getEnumName</span>(''QtOhosExtras::QOhosStartOptions::ProcessMode'') ===
 
<span id="qt_getEnumName-2"></span>
=== <span id="qt_getEnumName-2"></span>const <span class="type">char</span> *QtOhosExtras::<span class="name">qt_getEnumName</span>(''QtOhosExtras::QOhosStartOptions::StartupVisibility'') ===
 
<span id="qt_getEnumName-3"></span>
=== <span id="qt_getEnumName-3"></span>const <span class="type">char</span> *QtOhosExtras::<span class="name">qt_getEnumName</span>(''QtOhosExtras::QOhosStartOptions::WindowMode'') ===
 
<span id="qt_getEnumName-4"></span>
=== <span id="qt_getEnumName-4"></span>const <span class="type">char</span> *QtOhosExtras::<span class="name">qt_getEnumName</span>(''QtOhosExtras::QOhosStartOptions::SupportWindowMode'') ===
 
<span id="qt_getEnumName-5"></span>
=== <span id="qt_getEnumName-5"></span>const <span class="type">char</span> *QtOhosExtras::<span class="name">qt_getEnumName</span>(''QtOhosExtras::CloseEventRootCause'') ===
 
<span id="qt_getEnumName-6"></span>
=== <span id="qt_getEnumName-6"></span>const <span class="type">char</span> *QtOhosExtras::<span class="name">qt_getEnumName</span>(''QtOhosExtras::WindowGeometryPersistenceHint'') ===


<span id="requestQOhosPermissionFromUserIfNeeded"></span>
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosAbilityContext_Class#setDestroyFromSystemEnabled|QOhosAbilityContext::setDestroyFromSystemEnabled]]().
=== <span id="requestQOhosPermissionFromUserIfNeeded"></span><span class="type">void</span> QtOhosExtras::<span class="name">requestQOhosPermissionFromUserIfNeeded</span>(<span class="type">[[../qtcore/qobject.html|QObject]]</span> *''resultConsumerQtContext'', <span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''optInstanceMainWindow'', const <span class="type">[[../qtcore/qstring.html|QString]]</span> &amp;''permissionName'', <span class="type">int</span> ''resultConsumer'') ===


<span id="requestQOhosPermissionOnSettingIfNeeded"></span>
=== <span id="setBundledAbilityAndQWindowBindingKeyForQWindow"></span>void QtOhosExtras::setBundledAbilityAndQWindowBindingKeyForQWindow([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'', const [https://doc.qt.io/qt-5/qstring.html QString] &''qAbilityQWindowBindingKey'') ===
=== <span id="requestQOhosPermissionOnSettingIfNeeded"></span><span class="type">void</span> QtOhosExtras::<span class="name">requestQOhosPermissionOnSettingIfNeeded</span>(<span class="type">[[../qtcore/qobject.html|QObject]]</span> *''resultConsumerQtContext'', <span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''optInstanceMainWindow'', <span class="type">int</span> ''permission'', <span class="type">int</span> ''resultConsumer'') ===


<span id="setAbilityInstanceDestroyEnabled"></span>
Function marks that the window is supposed to be used with QBundledEmbeddedUiExtensionAbility instance that has specific "Ability <=> [https://doc.qt.io/qt-5/qwindow.html QWindow] binding key" assigned in form of 'io.qt.public.bundledAbilityAndQWindowBindingKey' want parameter matching the provided ''qAbilityQWindowBindingKey''.
=== <span id="setAbilityInstanceDestroyEnabled"></span><span class="type">void</span> QtOhosExtras::<span class="name">setAbilityInstanceDestroyEnabled</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''instanceWindow'', <span class="type">bool</span> ''destroyEnabled'') ===


Sets whether the Ability related with ''instanceWindow'' can be automatically destroyed by the system when the user clicks on the window's &quot;close&quot; button. If ''destroyEnabled'' is <code>true</code>, the system destroys the Ability automatically (and Qt needs to adapt to this). If ''destroyEnabled'' = <code>false</code>, the window is not automatically destroyed, but instead standard Qt path for window close is triggered, i.e. [[../qtgui/qwindow.html#close|QWindow::close]]().
The ''window'' that is passed to this function needs to have no parent/transient parent any may not be visible. The window will become visible either after the function call, if the corresponding instance of the QBundledEmbeddedUiExtensionAbility is already present, or after the corresponding instance is started.


By default, the flag is set to <code>false</code>.
The concept of multiple EmbeddedUIExtensionAbilities is described in OpenHarmony docs: https://gitee.com/openharmony/docs/blob/master/en/application-dev/application-models/embeddeduiextensionability.md


'''See also''' QtOhosExtras::QOhosAbilityContext::setDestroyFromSystemEnabled().
=== <span id="setMainWindowGeometryPersistenceHint"></span>void QtOhosExtras::setMainWindowGeometryPersistenceHint([[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#WindowGeometryPersistenceHint-enum|WindowGeometryPersistenceHint]] ''geometryPersistenceHint'') ===
 
<span id="setBundledAbilityAndQWindowBindingKeyForQWindow"></span>
=== <span id="setBundledAbilityAndQWindowBindingKeyForQWindow"></span><span class="type">void</span> QtOhosExtras::<span class="name">setBundledAbilityAndQWindowBindingKeyForQWindow</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''window'', const <span class="type">[[../qtcore/qstring.html|QString]]</span> &amp;''qAbilityQWindowBindingKey'') ===
 
<span id="setMainWindowGeometryPersistenceHint"></span>
=== <span id="setMainWindowGeometryPersistenceHint"></span><span class="type">void</span> QtOhosExtras::<span class="name">setMainWindowGeometryPersistenceHint</span>(<span class="type">[[Qt_for_HarmonyOS/qtohosextras_doc/QtOhosExtras_Namespace#WindowGeometryPersistenceHint-enum|QtOhosExtras::WindowGeometryPersistenceHint]]</span> ''geometryPersistenceHint'') ===


Sets a given ''geometryPersistenceHint'' on first main window shown.
Sets a given ''geometryPersistenceHint'' on first main window shown.
Line 600: Line 461:
Read about details in [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-window#setwindowrectautosave here].
Read about details in [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-window#setwindowrectautosave here].


<span id="setShowWindowAsFloatWindowHint"></span>
=== <span id="setShowWindowAsFloatWindowHint"></span>void QtOhosExtras::setShowWindowAsFloatWindowHint([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'', bool ''showAsFloatWindow'') ===
=== <span id="setShowWindowAsFloatWindowHint"></span><span class="type">void</span> QtOhosExtras::<span class="name">setShowWindowAsFloatWindowHint</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''window'', <span class="type">bool</span> ''showAsFloatWindow'') ===


Sets or unsets a given ''window'' as floating window according to ''showAsFloatWindow'' flag. Read more about floating window type [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5 here].
Sets or unsets a given ''window'' as floating window according to ''showAsFloatWindow'' flag. Read more about floating window type [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5 here].


<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
  auto window = std::make_unique<MainWindow>();
  auto window = std::make_unique<MainWindow>();
  QtOhosExtras::setShowWindowAsFloatWindowHint(window.get(), true);
  QtOhosExtras::setShowWindowAsFloatWindowHint(window.get(), true);
  window->show();</syntaxhighlight>
  window->show();
<span id="setShowWindowAsFloatWindowHint-1"></span>
 
=== <span id="setShowWindowAsFloatWindowHint-1"></span><span class="type">void</span> QtOhosExtras::<span class="name">setShowWindowAsFloatWindowHint</span>(<span class="type">[[../qtwidgets/qwidget.html|QWidget]]</span> *''widget'', <span class="type">bool</span> ''showAsFloatWindow'') ===
</syntaxhighlight>
 
=== <span id="setShowWindowAsFloatWindowHint-1"></span>void QtOhosExtras::setShowWindowAsFloatWindowHint([https://doc.qt.io/qt-5/qwidget.html QWidget] *''widget'', bool ''showAsFloatWindow'') ===


Sets or unsets a given ''widget'' as floating window according to ''showAsFloatWindow'' flag. Read more about floating window type [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5 here].
Sets or unsets a given ''widget'' as floating window according to ''showAsFloatWindow'' flag. Read more about floating window type [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5 here].


<span id="setSurfaceBackgroundColor"></span>
=== <span id="setSurfaceBackgroundColor"></span>void QtOhosExtras::setSurfaceBackgroundColor([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'', const [https://doc.qt.io/qt-5/qcolor.html QColor] &''color'') ===
=== <span id="setSurfaceBackgroundColor"></span><span class="type">void</span> QtOhosExtras::<span class="name">setSurfaceBackgroundColor</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''window'', const <span class="type">[[../qtgui/qcolor.html|QColor]]</span> &amp;''color'') ===


Sets a given ''color'' as background color on the ''window'' inner native layer.
Sets a given ''color'' as background color on the ''window'' inner native layer.


<span id="setSurfaceBackgroundColor-1"></span>
=== <span id="setSurfaceBackgroundColor-1"></span>void QtOhosExtras::setSurfaceBackgroundColor([https://doc.qt.io/qt-5/qwidget.html QWidget] *''widget'', const [https://doc.qt.io/qt-5/qcolor.html QColor] &''color'') ===
=== <span id="setSurfaceBackgroundColor-1"></span><span class="type">void</span> QtOhosExtras::<span class="name">setSurfaceBackgroundColor</span>(<span class="type">[[../qtwidgets/qwidget.html|QWidget]]</span> *''widget'', const <span class="type">[[../qtgui/qcolor.html|QColor]]</span> &amp;''color'') ===


Sets a given ''color'' as background color on the ''widget'' inner native layer.
Sets a given ''color'' as background color on the ''widget'' inner native layer.


'''Warning:''' Currently, dynamic color change on a widget is not supported yet.
'''Warning: '''Currently, dynamic color change on a widget is not supported yet.


<span id="setWindowCornerRadius"></span>
=== <span id="setWindowCornerRadius"></span>void QtOhosExtras::setWindowCornerRadius([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'', double ''radius'') ===
=== <span id="setWindowCornerRadius"></span><span class="type">void</span> QtOhosExtras::<span class="name">setWindowCornerRadius</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''window'', <span class="type">double</span> ''radius'') ===


Sets corner ''radius'' for a ''window''. Given ''window'' has to be a sub or floating window type. It can be achieved for example: - by setting [[../qtcore/qt.html#WindowType-enum|Qt::WindowFlags]], like: [[../qtcore/qt.html#WindowType-enum|Qt::Window]], [[../qtcore/qt.html#WindowType-enum|Qt::Popup]], [[../qtcore/qt.html#WindowType-enum|Qt::Dialog]] etc. - explicitly using QtOhosExtras::setShowWindowAsFloatWindowHint() function. More on windows in: [https://doc.qt.io/archives/qt-5.15/qwindow.html Qt official docs]. The ''radius'' must not be a negative number. There's no upper limit in value, although visually OHOS uses maximum achievable value. In order for this function to work properly, it has to be called before the window is shown.
Sets corner ''radius'' for a ''window''. Given ''window'' has to be a sub or floating window type. It can be achieved for example: - by setting [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::WindowFlags], like: [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::Window], [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::Popup], [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::Dialog] etc. - explicitly using QtOhosExtras::setShowWindowAsFloatWindowHint() function. More on windows in: [https://doc.qt.io/archives/qt-5.15/qwindow.html Qt official docs]. The ''radius'' must not be a negative number. There's no upper limit in value, although visually OHOS uses maximum achievable value. In order for this function to work properly, it has to be called before the window is shown.


Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-window here].
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-window here].


<span id="setWindowCornerRadius-1"></span>
=== <span id="setWindowCornerRadius-1"></span>void QtOhosExtras::setWindowCornerRadius([https://doc.qt.io/qt-5/qwidget.html QWidget] *''widget'', double ''radius'') ===
=== <span id="setWindowCornerRadius-1"></span><span class="type">void</span> QtOhosExtras::<span class="name">setWindowCornerRadius</span>(<span class="type">[[../qtwidgets/qwidget.html|QWidget]]</span> *''widget'', <span class="type">double</span> ''radius'') ===


Sets corner ''radius'' for a ''widget''. Given ''widget'' has to be formed as a new window, it means it cannot be embedded in a parent widget. It can be achieved for example: - by setting [[../qtcore/qt.html#WindowType-enum|Qt::WindowFlags]], like: [[../qtcore/qt.html#WindowType-enum|Qt::Window]], [[../qtcore/qt.html#WindowType-enum|Qt::Popup]], [[../qtcore/qt.html#WindowType-enum|Qt::Dialog]] etc. - explicitly using QtOhosExtras::setShowWindowAsFloatWindowHint() function. More on widgets as windows in: [https://doc.qt.io/archives/qt-5.15/qwidget.html Qt official docs]. The ''radius'' must not be a negative number. There's no upper limit in value, although visually OHOS uses maximum achievable value. In order for this function to work properly, it has to be called before the widget is shown.
Sets corner ''radius'' for a ''widget''. Given ''widget'' has to be formed as a new window, it means it cannot be embedded in a parent widget. It can be achieved for example: - by setting [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::WindowFlags], like: [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::Window], [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::Popup], [https://doc.qt.io/qt-5/qt.html#WindowType-enum Qt::Dialog] etc. - explicitly using QtOhosExtras::setShowWindowAsFloatWindowHint() function. More on widgets as windows in: [https://doc.qt.io/archives/qt-5.15/qwidget.html Qt official docs]. The ''radius'' must not be a negative number. There's no upper limit in value, although visually OHOS uses maximum achievable value. In order for this function to work properly, it has to be called before the widget is shown.


Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-window here].
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-window here].


<span id="setWindowKeepScreenOn"></span>
=== <span id="setWindowDragResizable"></span>void QtOhosExtras::setWindowDragResizable([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'', bool ''dragResizable'') ===
=== <span id="setWindowKeepScreenOn"></span><span class="type">void</span> QtOhosExtras::<span class="name">setWindowKeepScreenOn</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''window'', <span class="type">bool</span> ''keepScreenOn'') ===
 
Enables or disables ''window'' resize ability (dragging), as per the ''dragResizable'' parameter.
 
The function takes effect on sub windows and floating windows.
 
'''Note: '''This function can be called on a ''window'' after being shown.
 
'''Note: '''The functionality isn't supported on application main windows (i.e. first [https://doc.qt.io/qt-5/qwidget.html QWidget] shown in application, or [https://doc.qt.io/qt-5/qwidget.html QWidget] shown without parent, or [https://doc.qt.io/qt-5/qwidget.html QWidget] explicitly tagged as main window before show).
 
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references/arkts-apis-window-window#enabledrag20 here].
 
=== <span id="setWindowDragResizable-1"></span>void QtOhosExtras::setWindowDragResizable([https://doc.qt.io/qt-5/qwidget.html QWidget] *''widget'', bool ''dragResizable'') ===
 
Enables or disables ''widget'' resize ability (dragging).
 
Given ''widget'' has to be formed as a new window, it means it cannot be embedded in a parent widget. The function takes effect on sub windows (window flags: <code>Qt::Window</code>, <code>Qt::Dialog</code>, <code>Qt::Popup</code>, <code>Qt::ToolTip</code> etc) and floating windows (marked with <code>QtOhosExtras::setShowWindowAsFloatWindowHint()</code> function)
 
'''Note: '''This function can be called on a ''widget'' before as well as after being shown.
 
'''Note: '''The functionality isn't supported on application main windows (i.e. first [https://doc.qt.io/qt-5/qwidget.html QWidget] shown in application, or [https://doc.qt.io/qt-5/qwidget.html QWidget] shown without parent, or [https://doc.qt.io/qt-5/qwidget.html QWidget] explicitly tagged as main window before show).
 
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references/arkts-apis-window-window#enabledrag20 here].
 
=== <span id="setWindowKeepScreenOn"></span>void QtOhosExtras::setWindowKeepScreenOn([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'', bool ''keepScreenOn'') ===


Sets or unsets a given ''window'' to keep the screen on according to ''keepScreenOn'' flag.
Sets or unsets a given ''window'' to keep the screen on according to ''keepScreenOn'' flag.
Line 647: Line 529:
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#setwindowkeepscreenon here].
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#setwindowkeepscreenon here].


<span id="setWindowKeepScreenOn-1"></span>
=== <span id="setWindowKeepScreenOn-1"></span>void QtOhosExtras::setWindowKeepScreenOn([https://doc.qt.io/qt-5/qwidget.html QWidget] *''widget'', bool ''keepScreenOn'') ===
=== <span id="setWindowKeepScreenOn-1"></span><span class="type">void</span> QtOhosExtras::<span class="name">setWindowKeepScreenOn</span>(<span class="type">[[../qtwidgets/qwidget.html|QWidget]]</span> *''widget'', <span class="type">bool</span> ''keepScreenOn'') ===


Sets or unsets a given ''widget'' to keep the screen on according to ''keepScreenOn'' flag.
Sets or unsets a given ''widget'' to keep the screen on according to ''keepScreenOn'' flag.
Line 654: Line 535:
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#setwindowkeepscreenon here].
Read more: [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#setwindowkeepscreenon here].


<span id="setWindowPrivacyMode"></span>
=== <span id="setWindowPrivacyMode"></span>void QtOhosExtras::setWindowPrivacyMode([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'', bool ''privacyModeEnabled'') ===
=== <span id="setWindowPrivacyMode"></span><span class="type">void</span> QtOhosExtras::<span class="name">setWindowPrivacyMode</span>(<span class="type">[[../qtgui/qwindow.html|QWindow]]</span> *''window'', <span class="type">bool</span> ''privacyModeEnabled'') ===


Change window privacy mode according to a given ''window'' and ''privacyModeEnabled''. Read more about window privacy mode [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#setwindowprivacymode9 here]
Change window privacy mode according to a given ''window'' and ''privacyModeEnabled''. Read more about window privacy mode [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#setwindowprivacymode9 here]


<span id="startAbility"></span>
=== <span id="startAbility"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]]> QtOhosExtras::startAbility(const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''want'') ===
=== startAbility ===


<syntaxhighlight lang="cpp">
Starts an Ability for a given ''want''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartability Start Ability].
QSharedPointer<QtOhosExtras::QOhosOperationStatus> QtOhosExtras::startAbility(const QtOhosExtras::QOhosWant &''want'')
</syntaxhighlight>


Starts an Ability for a given ''want''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartability Start Ability].
'''Warning: '''Currently, operation status result is hardcoded as "successful" (even if ability were not started).


'''Warning:''' Currently, operation status result is hardcoded as &quot;successful&quot; (even if ability were not started).
=== <span id="startAbility-1"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]]> QtOhosExtras::startAbility(const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''want'', const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] &''options'') ===


<span id="startAbility-1"></span>
Starts an Ability for a given ''want'' and ''options''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartability-1 Start Ability].
=== startAbility ===


<syntaxhighlight lang="cpp">
'''Warning: '''Currently, operation status result is hardcoded as "successful" (even if ability were not started).
QSharedPointer<QtOhosExtras::QOhosOperationStatus> QtOhosExtras::startAbility(const QtOhosExtras::QOhosWant &''want'', const QtOhosExtras::QOhosStartOptions &''options'')
</syntaxhighlight>


Starts an Ability for a given ''want'' and ''options''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartability-1 Start Ability].
=== <span id="startAbility-2"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]]> QtOhosExtras::startAbility(const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''want'', const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class|QOhosStartRequest]] &''startRequest'') ===


'''Warning:''' Currently, operation status result is hardcoded as &quot;successful&quot; (even if ability were not started).
Starts an Ability for a given ''want'' and ''startRequest''.


<span id="startAbilityByType"></span>
The ''startRequest'' carries the completion handler from start options. Connect to [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class#requestSucceeded|QOhosStartRequest::requestSucceeded]]() and [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class#requestFailed|QOhosStartRequest::requestFailed]]() to receive completion handler results. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartability-1 Start Ability].
=== startAbilityByType ===


<syntaxhighlight lang="cpp">
=== <span id="startAbilityByType"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class|QOhosOperationStatus]]> QtOhosExtras::startAbilityByType(const [https://doc.qt.io/qt-5/qstring.html QString] &''appType'', const [https://doc.qt.io/qt-5/qjsonobject.html QJsonObject] &''wantParameters'') ===
QSharedPointer<QtOhosExtras::QOhosOperationStatus> QtOhosExtras::startAbilityByType(const QString &''appType'', const QJsonObject &''wantParameters'')
</syntaxhighlight>


Starts an Ability for a given ''appType'' and ''wantParameters''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartabilitybytype11-1 Start Ability].
Starts an Ability for a given ''appType'' and ''wantParameters''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartabilitybytype11-1 Start Ability].


Returns true on success
Returns an operation status object; its [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOperationStatus_Class#success|QOhosOperationStatus::success]]() reports whether the request succeeded.


<span id="startAppProcess"></span>
=== <span id="startAppProcess"></span>void QtOhosExtras::startAppProcess(const [https://doc.qt.io/qt-5/qstring.html QString] &''processId'', const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''requestWant'') ===
=== <span id="startAppProcess"></span><span class="type">void</span> QtOhosExtras::<span class="name">startAppProcess</span>(const <span class="type">[[../qtcore/qstring.html|QString]]</span> &amp;''processId'', const <span class="type">[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QtOhosExtras::QOhosWant]]</span> &amp;''requestWant'') ===


Starts application process for a given ''processId'' and ''requestWant''.
Starts application process for a given ''processId'' and ''requestWant''.


<span id="startAppProcess-1"></span>
=== <span id="startAppProcess-1"></span>void QtOhosExtras::startAppProcess(const [https://doc.qt.io/qt-5/qstring.html QString] &''processId'', const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''requestWant'', const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QOhosStartOptions]] &''options'') ===
=== <span id="startAppProcess-1"></span><span class="type">void</span> QtOhosExtras::<span class="name">startAppProcess</span>(const <span class="type">[[../qtcore/qstring.html|QString]]</span> &amp;''processId'', const <span class="type">[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QtOhosExtras::QOhosWant]]</span> &amp;''requestWant'', const <span class="type">[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartOptions_Class|QtOhosExtras::QOhosStartOptions]]</span> &amp;''options'') ===


Starts application process for a given ''processId'', ''requestWant'' and ''options''.
Starts application process for a given ''processId'', ''requestWant'' and ''options''.


<span id="startNewAbilityInstance"></span>
=== <span id="startAppProcess-2"></span>void QtOhosExtras::startAppProcess(const [https://doc.qt.io/qt-5/qstring.html QString] &''processId'', const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''requestWant'', const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class|QOhosStartRequest]] &''startRequest'') ===
=== <span id="startNewAbilityInstance"></span><span class="type">void</span> QtOhosExtras::<span class="name">startNewAbilityInstance</span>(<span class="type">[[../qtwidgets/qwidget.html|QWidget]]</span> *''instanceWidget'') ===
 
Starts application process for a given ''processId'', ''requestWant'' and ''startRequest''. The ''startRequest'' carries the completion handler from start options. Connect to [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class#requestSucceeded|QOhosStartRequest::requestSucceeded]]() and [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class#requestFailed|QOhosStartRequest::requestFailed]]() to receive completion handler results.
 
See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-inner-application-uiabilitycontext-V5#uiabilitycontextstartability-1 Start Ability].
 
'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosStartRequest_Class|QOhosStartRequest]].
 
=== <span id="startNewAbilityInstance"></span>void QtOhosExtras::startNewAbilityInstance([https://doc.qt.io/qt-5/qwidget.html QWidget] *''instanceWidget'') ===


Starts another instance of the UIAbility used by the Qt app with specified widget inside
Starts another instance of the UIAbility used by the Qt app with specified widget inside


The caller should pass newly created [[../qtwidgets/qwidget.html|QWidget]] ''instanceWidget'', without any setting any parent, calling show() or winId() on it.
The caller should pass newly created [https://doc.qt.io/qt-5/qwidget.html QWidget] ''instanceWidget'', without any setting any parent, calling show() or winId() on it.


<span id="tryGetNativeWindowId"></span>
=== <span id="tryGetNativeWindowId"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<double> QtOhosExtras::tryGetNativeWindowId([https://doc.qt.io/qt-5/qwindow.html QWindow] *''window'') ===
=== tryGetNativeWindowId ===
 
<syntaxhighlight lang="cpp">
QSharedPointer<double> QtOhosExtras::tryGetNativeWindowId(QWindow *''window'')
</syntaxhighlight>


Function tries to obtain native window ID (ID associated with system window object) of given ''window''. The failure of the operation is indicated by returned value equal to <code>nullptr</code>.
Function tries to obtain native window ID (ID associated with system window object) of given ''window''. The failure of the operation is indicated by returned value equal to <code>nullptr</code>.


'''Note:''' This function must be called only after the ''window'' has been shown.
'''Note: '''This function must be called only after the ''window'' has been shown.


'''Warning:''' Returned native window ID isn't guaranteed to be valid throughout the lifetime of application. Application stability and performance may be poor after using this function, use it at your own risk!
'''Warning: '''Returned native window ID isn't guaranteed to be valid throughout the lifetime of application. Application stability and performance may be poor after using this function, use it at your own risk!


Read more on native window ID (WindowProperties.id): [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#windowproperties here]
Read more on native window ID (WindowProperties.id): [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-window-V5#windowproperties here]


<span id="tryGetOnContinueData"></span>
=== <span id="tryGetOnContinueData"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[https://doc.qt.io/qt-5/qbytearray.html QByteArray]> QtOhosExtras::tryGetOnContinueData(const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''want'') ===
=== tryGetOnContinueData ===
 
<syntaxhighlight lang="cpp">
QSharedPointer<QByteArray> QtOhosExtras::tryGetOnContinueData(const QtOhosExtras::QOhosWant &''want'')
</syntaxhighlight>


<span id="tryGetScreenDisplayId"></span>
Tries to get continuation / migration related data that was provided on the source device. Returns <code>nullptr</code> if no such data found. The data is expected to be stored in the ''want'' parameters. See [https://developer.huawei.com/consumer/en/doc/harmonyos-guides/app-continuation-guide Application Continuation].
=== tryGetScreenDisplayId ===


<syntaxhighlight lang="cpp">
=== <span id="tryGetScreenDisplayId"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<double> QtOhosExtras::tryGetScreenDisplayId([https://doc.qt.io/qt-5/qscreen.html QScreen] *''screen'') ===
QSharedPointer<double> QtOhosExtras::tryGetScreenDisplayId(QScreen *''screen'')
</syntaxhighlight>


Function tries to obtain native display ID of given ''screen''. The failure of the operation is indicated by returning <code>nullptr</code> .
Function tries to obtain native display ID of given ''screen''. The failure of the operation is indicated by returning <code>nullptr</code> .
Line 742: Line 605:
Read more on display ID (Display.id): [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-display-V5#display here]
Read more on display ID (Display.id): [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-display-V5#display here]


<span id="tryMapQOhosPermissionFromName"></span>
=== <span id="tryRestoreOnContinueDistributedDataObjects"></span>[https://doc.qt.io/qt-5/qlist.html QList]<[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosDistributedDataObject_Class|QOhosDistributedDataObject]]>> QtOhosExtras::tryRestoreOnContinueDistributedDataObjects(const [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosWant_Class|QOhosWant]] &''want'') ===
=== <span id="tryMapQOhosPermissionFromName"></span><span class="type">int</span> QtOhosExtras::<span class="name">tryMapQOhosPermissionFromName</span>(''const QString &amp;'') ===
 
<span id="tryMapQOhosPermissionToName"></span>
=== <span id="tryMapQOhosPermissionToName"></span><span class="type">int</span> QtOhosExtras::<span class="name">tryMapQOhosPermissionToName</span>(''int'') ===
 
<span id="operator-7c"></span>
=== Function ===
 
<syntaxhighlight lang="cpp">
QFlags<QOhosWantFlags::enum_type> QtOhosExtras::operator|(QOhosWantFlags::enum_type ''f1'', QOhosWantFlags::enum_type ''f2'')
</syntaxhighlight>
 
<span id="operator-7c-1"></span>
=== Function ===


<syntaxhighlight lang="cpp">
Recreates the distributed data objects that were migrated in ''want'' by [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class#setResponseOnDistributedDataObjectsSaveResults|QOhosOnContinueContext::setResponseOnDistributedDataObjectsSaveResults]]() on the source device, and returns them. Returns an empty list if ''want'' carries no distributed data objects.
QFlags<QOhosWantFlags::enum_type> QtOhosExtras::operator|(QOhosWantFlags::enum_type ''f1'', QFlags<QOhosWantFlags::enum_type> ''f2'')
</syntaxhighlight>


<span id="operator-7c-2"></span>
Each returned object joins its session asynchronously, so connect to its dataChanged(), statusChanged() and progressChanged() signals right away to avoid missing the initial sync.
=== <span id="operator-7c-2"></span><span class="type">[[../qtcore/qincompatibleflag.html|QIncompatibleFlag]]</span> QtOhosExtras::<span class="name">operator|</span>(<span class="type">QOhosWantFlags::enum_type</span> ''f1'', <span class="type">int</span> ''f2'') ===


'''See also '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosOnContinueContext_Class#setResponseOnDistributedDataObjectsSaveResults|QOhosOnContinueContext::setResponseOnDistributedDataObjectsSaveResults]]().


</div>
[[Category:Qt for HarmonyOS]]

Latest revision as of 06:30, 17 September 2026

QtOhosExtras Namespace

The QtOhosExtras namespace provides miscellaneous functions to aid Ohos development. More...

Header: #include <QtOhosExtras>
qmake: QT += ohosextras
Since: Qt 5.12.12

This namespace was introduced in Qt 5.12.12.

Namespaces

namespace AppPermissions
namespace FileShare
namespace Multimedia
namespace QOhosPasteboard
namespace ShareKit

Classes

class QOhosAbilityContext
class QOhosAppContext
class QOhosBundleInfo
class QOhosDistributedDataObject
struct QOhosElementName
class QOhosOnContinueContext
class QOhosOpenLinkOptions
class QOhosOperationStatus
class QOhosStartOptions
class QOhosStartRequest
struct QOhosWant
class QOhosWantInfo
class QOhosWindowCreateParams

Types

enum class CloseEventRootCause { InternalClose, AbilityClose, WindowStageClose }
enum class QOhosWantFlag { AuthReadUriPermission, AuthWriteUriPermission, InstallOnDemand }
flags QOhosWantFlags
enum class WindowGeometryPersistenceHint { Disabled, Enabled, FollowSystemSetting }

Functions

bool authorizeFilePath(QWindow *parentWindow, const QString &filePath)
QSharedPointer<QOhosOpenLinkOptions> createOpenLinkOptions()
QSharedPointer<QOhosStartOptions> createStartOptions()
QSharedPointer<QOhosStartRequest> createStartRequest(const QOhosStartOptions &options)
QSharedPointer<QOhosWindowCreateParams> createWindowCreateParams()
CloseEventRootCause getCloseEventRootCause(QCloseEvent *closeEvent)
bool moveFileToTrash(const QString &filePath)
void setAbilityInstanceDestroyEnabled(QWindow *instanceWindow, bool destroyEnabled)
void setBundledAbilityAndQWindowBindingKeyForQWindow(QWindow *window, const QString &qAbilityQWindowBindingKey)
void setMainWindowGeometryPersistenceHint(WindowGeometryPersistenceHint geometryPersistenceHint)
void setShowWindowAsFloatWindowHint(QWindow *window, bool showAsFloatWindow)
void setShowWindowAsFloatWindowHint(QWidget *widget, bool showAsFloatWindow)
void setSurfaceBackgroundColor(QWindow *window, const QColor &color)
void setSurfaceBackgroundColor(QWidget *widget, const QColor &color)
void setWindowCornerRadius(QWindow *window, double radius)
void setWindowCornerRadius(QWidget *widget, double radius)
void setWindowDragResizable(QWindow *window, bool dragResizable)
void setWindowDragResizable(QWidget *widget, bool dragResizable)
void setWindowKeepScreenOn(QWindow *window, bool keepScreenOn)
void setWindowKeepScreenOn(QWidget *widget, bool keepScreenOn)
void setWindowPrivacyMode(QWindow *window, bool privacyModeEnabled)
QSharedPointer<QOhosOperationStatus> startAbility(const QOhosWant &want)
QSharedPointer<QOhosOperationStatus> startAbility(const QOhosWant &want, const QOhosStartOptions &options)
QSharedPointer<QOhosOperationStatus> startAbility(const QOhosWant &want, const QOhosStartRequest &startRequest)
QSharedPointer<QOhosOperationStatus> startAbilityByType(const QString &appType, const QJsonObject &wantParameters)
void startAppProcess(const QString &processId, const QOhosWant &requestWant)
void startAppProcess(const QString &processId, const QOhosWant &requestWant, const QOhosStartOptions &options)
void startAppProcess(const QString &processId, const QOhosWant &requestWant, const QOhosStartRequest &startRequest)
void startNewAbilityInstance(QWidget *instanceWidget)
QSharedPointer<double> tryGetNativeWindowId(QWindow *window)
QSharedPointer<QByteArray> tryGetOnContinueData(const QOhosWant &want)
QSharedPointer<double> tryGetScreenDisplayId(QScreen *screen)
QList<QSharedPointer<QOhosDistributedDataObject>> tryRestoreOnContinueDistributedDataObjects(const QOhosWant &want)

Detailed Description

Namespaces

namespace QtOhosExtras::AppPermissions

 auto *appContext = QtOhosExtras::QOhosAppContext::instance();
 if (!appContext->isPermissionGranted(QtOhosExtras::AppPermissions::Permission::AccessBluetooth)) {
     QObject::connect(
         appContext, &QtOhosExtras::QOhosAppContext::permissionRequestResponseWithResultReceived,
         [](QtOhosExtras::AppPermissions::Permission permission,
            QtOhosExtras::AppPermissions::PermissionResult result) {
             if (result.permissionGranted) {
                 // start using the permission-protected feature ...
             }
         });
     appContext->requestPermissionFromUserIfNeeded(
         QtOhosExtras::AppPermissions::Permission::AccessBluetooth);
 }

This namespace was introduced in Qt 5.12.12.

See also QtOhosExtras::QOhosAppContext and QtOhosExtras::QOhosAbilityContext.

namespace QtOhosExtras::FileShare

This API uses file system paths, which differ from the URIs used internally by HarmonyOS. For example, the path /data/storage/el1/bundle/entry/resources/resfile/test.txt will be converted to the URI file://com.your.example/data/storage/el1/bundle/entry/resources/resfile/test.txt , where com.your.example is app bundle name.

To learn more about file paths and URIs in HarmonyOS, see sandbox documentation.

Warning: This API relies on the underlying OHOS implementation. The following functions: persistPermission(), revokePermission(), activatePermission(), deactivatePermission(), and checkPersistent() may be unavailable on some devices. Additionally, there may be limitations on the maximum number of policies, and certain permissions may need to be explicitly granted to the application.

For more details and limitations, refer to the API documentation.

This namespace was introduced in Qt 5.12.12.

namespace QtOhosExtras::Multimedia

The Multimedia namespace contains functions and types for controlling audio stream usage on HarmonyOS. It allows setting audio stream usage hints on QSoundEffect and QSound objects, which influences how the system routes and manages audio output.

This namespace was introduced in Qt 5.12.12.

See also QtOhosExtras::Multimedia::AudioStreamUsageHint.

namespace QtOhosExtras::QOhosPasteboard

This namespace was introduced in Qt 5.12.12.

namespace QtOhosExtras::ShareKit

This namespace was introduced in Qt 5.12.12.

Classes

class QOhosAbilityContext

The QOhosAbilityContext class is to manage native UI Ability context. See UIAbilityContext. More...

class QOhosAppContext

The QOhosAppContext class contains API to manage native application context. More...

class QOhosBundleInfo

The QOhosBundleInfo class contains API to provide native application bundle info. More...

class QOhosDistributedDataObject

The QOhosDistributedDataObject class shares a fixed set of named fields across devices that belong to the same trusted network. More...

class QOhosElementName

The QOhosElementName struct identifies an ability component. More...

class QOhosOnContinueContext

The QOhosOnContinueContext class manages onContinue context. It provides system data, like source application version code and set the onContinue result that is requested by the system. See UIAbility onContinue. More...

class QOhosOpenLinkOptions

The QOhosOpenLinkOptions class provides options for the QOhosAbilityContext::tryOpenLink() call. More...

class QOhosOperationStatus

The QOhosOperationStatus class provides an interface to check an operation status. More...

class QOhosStartOptions

The QOhosStartOptions class is to provide new options for new started ability or process. More...

class QOhosStartRequest

The QOhosStartRequest class emits signals for start ability. More...

class QOhosWant

QOhosWant wraps Ohos Want class. More...

class QOhosWantInfo

The QOhosWantInfo class is to represent Ohos want type. More...

class QOhosWindowCreateParams

The QOhosWindowCreateParams class provides window creation parameters for a started ability window. More...

Type Documentation

enum class QtOhosExtras::CloseEventRootCause

Enumerates the close event root cause.

Constant Value Description
QtOhosExtras::CloseEventRootCause::InternalClose 0 Close root cause not specified or unknown.
QtOhosExtras::CloseEventRootCause::AbilityClose 1 Close root cause of preparing to terminate.
QtOhosExtras::CloseEventRootCause::WindowStageClose 2 Close root cause of native Window Stage or Sub-Window close.

This enum was introduced or modified in Qt 5.12.12.

enum class QtOhosExtras::QOhosWantFlag
flags QtOhosExtras::QOhosWantFlags

QOhosWantFlag specifies how the Want will be handled. See Flags.

Constant Value Description
QtOhosExtras::QOhosWantFlag::AuthReadUriPermission 1 << 0 Grants the permission to read the URI.
QtOhosExtras::QOhosWantFlag::AuthWriteUriPermission 1 << 1 Grants the permission to write data to the URI.
QtOhosExtras::QOhosWantFlag::InstallOnDemand 1 << 2 Ability will be installed if it has not been installed.

This enum was introduced or modified in Qt 5.12.12.

The QOhosWantFlags type is a typedef for QFlags<QOhosWantFlag>. It stores an OR combination of QOhosWantFlag values.

enum class QtOhosExtras::WindowGeometryPersistenceHint

Enumerates the policy for window geometry persistence support. Specifies how a window’s geometry (the size and position) is determined when it is shown.

Constant Value Description
QtOhosExtras::WindowGeometryPersistenceHint::Disabled 0 Use default window's geometry.
QtOhosExtras::WindowGeometryPersistenceHint::Enabled 1 Restore previous window's geometry (position and size when before window was closed).
QtOhosExtras::WindowGeometryPersistenceHint::FollowSystemSetting 2 Let the system decide whether to use Disabled or Enabled value.

This enum was introduced or modified in Qt 5.12.12.

Function Documentation

bool QtOhosExtras::authorizeFilePath(QWindow *parentWindow, const QString &filePath)

Request authorization on the User selected parentWindow for a given filePath. The system File Dialog in authorization mode will be presented to the User. According to User choice returns true if file path is authorized, false otherwise. See authMode

This function was introduced in Qt 5.12.12.

QSharedPointer<QOhosOpenLinkOptions> QtOhosExtras::createOpenLinkOptions()

Creates an options object to be used with QOhosAbilityContext::tryOpenLink().

See also QOhosAbilityContext::tryOpenLink().

QSharedPointer<QOhosStartOptions> QtOhosExtras::createStartOptions()

Creates QOhosStartOptions instance.

QSharedPointer<QOhosStartRequest> QtOhosExtras::createStartRequest(const QOhosStartOptions &options)

Creates a start request for given options and adapts the completion handler into Qt signals.

Connect to QOhosStartRequest::requestSucceeded() and QOhosStartRequest::requestFailed() to receive completion handler results.

See Completion Handler.

See also QOhosStartRequest.

QSharedPointer<QOhosWindowCreateParams> QtOhosExtras::createWindowCreateParams()

Creates QOhosWindowCreateParams instance.

CloseEventRootCause QtOhosExtras::getCloseEventRootCause(QCloseEvent *closeEvent)

Converts a given closeEvent to QtOhosExtras::CloseEventRootCause and returns the related value.

bool QtOhosExtras::moveFileToTrash(const QString &filePath)

Moves the file specified by filePath to the trash. Returns true if successful, false otherwise.

This function provides functionality of QFile::moveToTrash() from Qt 5.15.

void QtOhosExtras::setAbilityInstanceDestroyEnabled(QWindow *instanceWindow, bool destroyEnabled)

Sets whether the Ability related with instanceWindow can be automatically destroyed by the system when the user clicks on the window's "close" button. If destroyEnabled is true, the system destroys the Ability automatically (and Qt needs to adapt to this). If destroyEnabled = false, the window is not automatically destroyed, but instead standard Qt path for window close is triggered, i.e. QWindow::close().

By default, the flag is set to false.

See also QOhosAbilityContext::setDestroyFromSystemEnabled().

void QtOhosExtras::setBundledAbilityAndQWindowBindingKeyForQWindow(QWindow *window, const QString &qAbilityQWindowBindingKey)

Function marks that the window is supposed to be used with QBundledEmbeddedUiExtensionAbility instance that has specific "Ability <=> QWindow binding key" assigned in form of 'io.qt.public.bundledAbilityAndQWindowBindingKey' want parameter matching the provided qAbilityQWindowBindingKey.

The window that is passed to this function needs to have no parent/transient parent any may not be visible. The window will become visible either after the function call, if the corresponding instance of the QBundledEmbeddedUiExtensionAbility is already present, or after the corresponding instance is started.

The concept of multiple EmbeddedUIExtensionAbilities is described in OpenHarmony docs: https://gitee.com/openharmony/docs/blob/master/en/application-dev/application-models/embeddeduiextensionability.md

void QtOhosExtras::setMainWindowGeometryPersistenceHint(WindowGeometryPersistenceHint geometryPersistenceHint)

Sets a given geometryPersistenceHint on first main window shown.

If this function is called with geometryPersistenceHint `Enabled`, the first main window's geometry will be saved when the window is closed and restored on the next application launch. By default this feature is disabled.

This method must be called before first main window is shown. Otherwise geometry persistence policy will not be updated.

Only supported on 2-in-1 devices.

Read about details in here.

void QtOhosExtras::setShowWindowAsFloatWindowHint(QWindow *window, bool showAsFloatWindow)

Sets or unsets a given window as floating window according to showAsFloatWindow flag. Read more about floating window type here.

 auto window = std::make_unique<MainWindow>();
 QtOhosExtras::setShowWindowAsFloatWindowHint(window.get(), true);
 window->show();

void QtOhosExtras::setShowWindowAsFloatWindowHint(QWidget *widget, bool showAsFloatWindow)

Sets or unsets a given widget as floating window according to showAsFloatWindow flag. Read more about floating window type here.

void QtOhosExtras::setSurfaceBackgroundColor(QWindow *window, const QColor &color)

Sets a given color as background color on the window inner native layer.

void QtOhosExtras::setSurfaceBackgroundColor(QWidget *widget, const QColor &color)

Sets a given color as background color on the widget inner native layer.

Warning: Currently, dynamic color change on a widget is not supported yet.

void QtOhosExtras::setWindowCornerRadius(QWindow *window, double radius)

Sets corner radius for a window. Given window has to be a sub or floating window type. It can be achieved for example: - by setting Qt::WindowFlags, like: Qt::Window, Qt::Popup, Qt::Dialog etc. - explicitly using QtOhosExtras::setShowWindowAsFloatWindowHint() function. More on windows in: Qt official docs. The radius must not be a negative number. There's no upper limit in value, although visually OHOS uses maximum achievable value. In order for this function to work properly, it has to be called before the window is shown.

Read more: here.

void QtOhosExtras::setWindowCornerRadius(QWidget *widget, double radius)

Sets corner radius for a widget. Given widget has to be formed as a new window, it means it cannot be embedded in a parent widget. It can be achieved for example: - by setting Qt::WindowFlags, like: Qt::Window, Qt::Popup, Qt::Dialog etc. - explicitly using QtOhosExtras::setShowWindowAsFloatWindowHint() function. More on widgets as windows in: Qt official docs. The radius must not be a negative number. There's no upper limit in value, although visually OHOS uses maximum achievable value. In order for this function to work properly, it has to be called before the widget is shown.

Read more: here.

void QtOhosExtras::setWindowDragResizable(QWindow *window, bool dragResizable)

Enables or disables window resize ability (dragging), as per the dragResizable parameter.

The function takes effect on sub windows and floating windows.

Note: This function can be called on a window after being shown.

Note: The functionality isn't supported on application main windows (i.e. first QWidget shown in application, or QWidget shown without parent, or QWidget explicitly tagged as main window before show).

Read more: here.

void QtOhosExtras::setWindowDragResizable(QWidget *widget, bool dragResizable)

Enables or disables widget resize ability (dragging).

Given widget has to be formed as a new window, it means it cannot be embedded in a parent widget. The function takes effect on sub windows (window flags: Qt::Window, Qt::Dialog, Qt::Popup, Qt::ToolTip etc) and floating windows (marked with QtOhosExtras::setShowWindowAsFloatWindowHint() function)

Note: This function can be called on a widget before as well as after being shown.

Note: The functionality isn't supported on application main windows (i.e. first QWidget shown in application, or QWidget shown without parent, or QWidget explicitly tagged as main window before show).

Read more: here.

void QtOhosExtras::setWindowKeepScreenOn(QWindow *window, bool keepScreenOn)

Sets or unsets a given window to keep the screen on according to keepScreenOn flag.

Read more: here.

void QtOhosExtras::setWindowKeepScreenOn(QWidget *widget, bool keepScreenOn)

Sets or unsets a given widget to keep the screen on according to keepScreenOn flag.

Read more: here.

void QtOhosExtras::setWindowPrivacyMode(QWindow *window, bool privacyModeEnabled)

Change window privacy mode according to a given window and privacyModeEnabled. Read more about window privacy mode here

QSharedPointer<QOhosOperationStatus> QtOhosExtras::startAbility(const QOhosWant &want)

Starts an Ability for a given want. See Start Ability.

Warning: Currently, operation status result is hardcoded as "successful" (even if ability were not started).

QSharedPointer<QOhosOperationStatus> QtOhosExtras::startAbility(const QOhosWant &want, const QOhosStartOptions &options)

Starts an Ability for a given want and options. See Start Ability.

Warning: Currently, operation status result is hardcoded as "successful" (even if ability were not started).

QSharedPointer<QOhosOperationStatus> QtOhosExtras::startAbility(const QOhosWant &want, const QOhosStartRequest &startRequest)

Starts an Ability for a given want and startRequest.

The startRequest carries the completion handler from start options. Connect to QOhosStartRequest::requestSucceeded() and QOhosStartRequest::requestFailed() to receive completion handler results. See Start Ability.

QSharedPointer<QOhosOperationStatus> QtOhosExtras::startAbilityByType(const QString &appType, const QJsonObject &wantParameters)

Starts an Ability for a given appType and wantParameters. See Start Ability.

Returns an operation status object; its QOhosOperationStatus::success() reports whether the request succeeded.

void QtOhosExtras::startAppProcess(const QString &processId, const QOhosWant &requestWant)

Starts application process for a given processId and requestWant.

void QtOhosExtras::startAppProcess(const QString &processId, const QOhosWant &requestWant, const QOhosStartOptions &options)

Starts application process for a given processId, requestWant and options.

void QtOhosExtras::startAppProcess(const QString &processId, const QOhosWant &requestWant, const QOhosStartRequest &startRequest)

Starts application process for a given processId, requestWant and startRequest. The startRequest carries the completion handler from start options. Connect to QOhosStartRequest::requestSucceeded() and QOhosStartRequest::requestFailed() to receive completion handler results.

See Start Ability.

See also QOhosStartRequest.

void QtOhosExtras::startNewAbilityInstance(QWidget *instanceWidget)

Starts another instance of the UIAbility used by the Qt app with specified widget inside

The caller should pass newly created QWidget instanceWidget, without any setting any parent, calling show() or winId() on it.

QSharedPointer<double> QtOhosExtras::tryGetNativeWindowId(QWindow *window)

Function tries to obtain native window ID (ID associated with system window object) of given window. The failure of the operation is indicated by returned value equal to nullptr.

Note: This function must be called only after the window has been shown.

Warning: Returned native window ID isn't guaranteed to be valid throughout the lifetime of application. Application stability and performance may be poor after using this function, use it at your own risk!

Read more on native window ID (WindowProperties.id): here

QSharedPointer<QByteArray> QtOhosExtras::tryGetOnContinueData(const QOhosWant &want)

Tries to get continuation / migration related data that was provided on the source device. Returns nullptr if no such data found. The data is expected to be stored in the want parameters. See Application Continuation.

QSharedPointer<double> QtOhosExtras::tryGetScreenDisplayId(QScreen *screen)

Function tries to obtain native display ID of given screen. The failure of the operation is indicated by returning nullptr .

Read more on display ID (Display.id): here

QList<QSharedPointer<QOhosDistributedDataObject>> QtOhosExtras::tryRestoreOnContinueDistributedDataObjects(const QOhosWant &want)

Recreates the distributed data objects that were migrated in want by QOhosOnContinueContext::setResponseOnDistributedDataObjectsSaveResults() on the source device, and returns them. Returns an empty list if want carries no distributed data objects.

Each returned object joins its session asynchronously, so connect to its dataChanged(), statusChanged() and progressChanged() signals right away to avoid missing the initial sync.

See also QOhosOnContinueContext::setResponseOnDistributedDataObjectsSaveResults().