Jump to content

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

From Qt Wiki
No edit summary
Update from qdoc output (QTFOROH-2307)
 
Line 2: Line 2:


= ShareKit Namespace =
= ShareKit Namespace =
QtOhosExtras::ShareKit


The ShareKit to expose Share Kit API. [[#details|More...]]
The ShareKit to expose Share Kit API. [[#details|More...]]
Line 7: Line 9:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Header:
| Header:
| #include <ShareKit>
| #include <ShareKit>
|-
|-
! qmake:
| qmake:
| QT += ohosextras
| QT += ohosextras
|-
|-
! Since:
| Since:
| Qt 5.12.12
| Qt 5.12.12
|}
|}
This namespace was introduced in Qt 5.12.12.


== Classes ==
== Classes ==


{| class="wikitable" style="width:100%"
{| class="wikitable"
|-
| class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareControllerOptions_Class|QOhosShareControllerOptions]]'''
|-
|-
| class || '''[[QOhosShareControllerOptions_Class|QOhosShareControllerOptions]]''' || The QOhosShareControllerOptions class is to configure items, such as the preview mode of the shared content, selection mode, and other information, and pop-up window anchor. It determines the display style of the sharing panel.
| class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareOperationResult_Class|QOhosShareOperationResult]]'''
|-
|-
| class || '''[[QOhosSharedRecord_Class|QOhosSharedRecord]]''' || The QOhosSharedRecord class represents a record to be shared with other application. A record can be created using.
| class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosSharedRecord_Class|QOhosSharedRecord]]'''
|}
|}


== Types ==
== Types ==


{| class="wikitable" style="width:100%"
{| class="wikitable"
|-
|-
| enum || '''[[#ShareAbilityType-enum|ShareAbilityType]]''' || { CopyToPasteboard, SaveToMediaAsset, SaveAsFile, Print, SaveToSuperHub }
| enum class
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace#ShareAbilityType-enum|ShareAbilityType]]''' { CopyToPasteboard, SaveToMediaAsset, SaveAsFile, Print, SaveToSuperHub }
|}
|}


== Functions ==
== Functions ==


{| class="wikitable" style="width:100%"
{| class="wikitable"
|-
|-
| QSharedPointer<QtOhosExtras::ShareKit::QOhosSharedRecord> || '''[[#createContentRecord|createContentRecord]]'''(const QMimeType &''mimeType'', const QString &''content'')
| QSharedPointer<QOhosSharedRecord>
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace#createContentRecord|createContentRecord]]'''(const QMimeType &''mimeType'', const QString &''content'')
|-
|-
| QSharedPointer<QtOhosExtras::ShareKit::QOhosShareControllerOptions> || '''[[#createControllerOptions|createControllerOptions]]'''()
| QSharedPointer<QOhosShareControllerOptions>
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace#createControllerOptions|createControllerOptions]]'''()
|-
|-
| QSharedPointer<QtOhosExtras::ShareKit::QOhosSharedRecord> || '''[[#createFileRecord|createFileRecord]]'''(const QFileInfo &''fileInfo'')
| QSharedPointer<QOhosSharedRecord>
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace#createFileRecord|createFileRecord]]'''(const QFileInfo &''fileInfo'')
|-
|-
| QSharedPointer<QtOhosExtras::ShareKit::QOhosSharedRecord> || '''[[#createUrlRecord|createUrlRecord]]'''(const QUrl &''url'')
| QSharedPointer<QOhosSharedRecord>
| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace#createUrlRecord|createUrlRecord]]'''(const QUrl &''url'')
|}
|}


== Detailed Description ==
== Detailed Description ==


<span id="details"></span>
== Classes ==
The ShareKit to expose Share Kit API.
 
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareControllerOptions_Class|QOhosShareControllerOptions]] ===
 
The QOhosShareControllerOptions class is to configure items, such as the preview mode of the shared content, selection mode, and other information, and pop-up window anchor. It determines the display style of the sharing panel. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareControllerOptions_Class#details|More...]]
 
===  class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareOperationResult_Class|QOhosShareOperationResult]] ===


== Type Documentation ==
ShareOperationResult wraps Ohos [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section17135118312 ShareOperationResult] interface. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareOperationResult_Class#details|More...]]


=== <span id="ShareAbilityType-enum"></span>enum ShareKit::ShareAbilityType ===
=== class [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosSharedRecord_Class|QOhosSharedRecord]] ===


The QOhosSharedRecord class represents a record to be shared with other application. [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosSharedRecord_Class#details|More...]]


== Type Documentation ==


== Function Documentation ==
=== <span id="ShareAbilityType-enum"></span>enum class ShareKit::ShareAbilityType ===


=== <span id="createContentRecord"></span>QSharedPointer<QtOhosExtras::ShareKit::QOhosSharedRecord> ShareKit::createContentRecord(const QMimeType &mimeType, const QString &content) ===
Enumerates system sharing abilities shown on the sharing panel. Used with [[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareControllerOptions_Class#setExcludedAbilities|QOhosShareControllerOptions::setExcludedAbilities]]() to hide selected abilities from the panel. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#shareabilitytype ShareAbilityType].


Creates a shared "content" record with a given ''mimeType'' and ''content''. Shared record can be created with content (this function) or as a file shared record
{| class="wikitable"
|-
! Constant
! Value
! Description
|-
| <code>QtOhosExtras::ShareKit::ShareAbilityType::CopyToPasteboard</code>
| <code>0</code>
| Copy the shared content to the pasteboard.
|-
| <code>QtOhosExtras::ShareKit::ShareAbilityType::SaveToMediaAsset</code>
| <code>1</code>
| Save the shared content to the Gallery.
|-
| <code>QtOhosExtras::ShareKit::ShareAbilityType::SaveAsFile</code>
| <code>2</code>
| Save the shared content as a file.
|-
| <code>QtOhosExtras::ShareKit::ShareAbilityType::Print</code>
| <code>3</code>
| Print the shared content.
|-
| <code>QtOhosExtras::ShareKit::ShareAbilityType::SaveToSuperHub</code>
| <code>4</code>
| Save the shared content to SuperHub.
|}


See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section20696483813 SharedRecord.content]
This enum was introduced or modified in Qt 5.12.12.


'''See also:''' QtOhosExtras::ShareKit::createFileRecord().
== Function Documentation ==


=== <span id="createControllerOptions"></span>QSharedPointer<QtOhosExtras::ShareKit::QOhosShareControllerOptions> ShareKit::createControllerOptions() ===
=== <span id="createContentRecord"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosSharedRecord_Class|QOhosSharedRecord]]> ShareKit::createContentRecord(const [https://doc.qt.io/qt-5/qmimetype.html QMimeType] &''mimeType'', const [https://doc.qt.io/qt-5/qstring.html QString] &''content'') ===


Creates a controller options instnace. Controller options can be used to configure preview mode, selection mode and pop-up window anchor. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section107934816010 ShareControllerOptions]
Creates a shared "content" record with a given ''mimeType'' and ''content''. Shared record can be created with content (this function) or as a file shared record, see [[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace#createFileRecord|createFileRecord]](). See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section20696483813 SharedRecord.content]


=== <span id="createFileRecord"></span>QSharedPointer<QtOhosExtras::ShareKit::QOhosSharedRecord> ShareKit::createFileRecord(const QFileInfo &fileInfo) ===
=== <span id="createControllerOptions"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosShareControllerOptions_Class|QOhosShareControllerOptions]]> ShareKit::createControllerOptions() ===


Creates a shared "file" record with a given ''fileInfo''. Shared record can be created with file (this function) or as a content record
Creates a controller options instnace. Controller options can be used to configure preview mode, selection mode and pop-up window anchor. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section107934816010 ShareControllerOptions]


See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section20696483813 SharedRecord.uri]
=== <span id="createFileRecord"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosSharedRecord_Class|QOhosSharedRecord]]> ShareKit::createFileRecord(const [https://doc.qt.io/qt-5/qfileinfo.html QFileInfo] &''fileInfo'') ===


'''See also:''' QtOhosExtras::ShareKit::createContentRecord().
Creates a shared "file" record with a given ''fileInfo''. Shared record can be created with file (this function) or as a content record, see [[Qt_for_HarmonyOS/qtohosextras_doc/ShareKit_Namespace#createContentRecord|createContentRecord]](). See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section20696483813 SharedRecord.uri]


=== <span id="createUrlRecord"></span>QSharedPointer<QtOhosExtras::ShareKit::QOhosSharedRecord> ShareKit::createUrlRecord(const QUrl &url) ===
=== <span id="createUrlRecord"></span>[https://doc.qt.io/qt-5/qsharedpointer.html QSharedPointer]<[[Qt_for_HarmonyOS/qtohosextras_doc/QOhosSharedRecord_Class|QOhosSharedRecord]]> ShareKit::createUrlRecord(const [https://doc.qt.io/qt-5/qurl.html QUrl] &''url'') ===


Creates a shared record with a given ''url''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section20696483813 SharedRecord.content]
Creates a shared record with a given ''url''. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section20696483813 SharedRecord.content]


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

Latest revision as of 08:38, 16 September 2026

< Qt for HarmonyOS / qtohosextras doc

ShareKit Namespace

QtOhosExtras::ShareKit

The ShareKit to expose Share Kit API. More...

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

This namespace was introduced in Qt 5.12.12.

Classes

class QOhosShareControllerOptions
class QOhosShareOperationResult
class QOhosSharedRecord

Types

enum class ShareAbilityType { CopyToPasteboard, SaveToMediaAsset, SaveAsFile, Print, SaveToSuperHub }

Functions

QSharedPointer<QOhosSharedRecord> createContentRecord(const QMimeType &mimeType, const QString &content)
QSharedPointer<QOhosShareControllerOptions> createControllerOptions()
QSharedPointer<QOhosSharedRecord> createFileRecord(const QFileInfo &fileInfo)
QSharedPointer<QOhosSharedRecord> createUrlRecord(const QUrl &url)

Detailed Description

Classes

class QOhosShareControllerOptions

The QOhosShareControllerOptions class is to configure items, such as the preview mode of the shared content, selection mode, and other information, and pop-up window anchor. It determines the display style of the sharing panel. More...

class QOhosShareOperationResult

ShareOperationResult wraps Ohos ShareOperationResult interface. More...

class QOhosSharedRecord

The QOhosSharedRecord class represents a record to be shared with other application. More...

Type Documentation

enum class ShareKit::ShareAbilityType

Enumerates system sharing abilities shown on the sharing panel. Used with QOhosShareControllerOptions::setExcludedAbilities() to hide selected abilities from the panel. See ShareAbilityType.

Constant Value Description
QtOhosExtras::ShareKit::ShareAbilityType::CopyToPasteboard 0 Copy the shared content to the pasteboard.
QtOhosExtras::ShareKit::ShareAbilityType::SaveToMediaAsset 1 Save the shared content to the Gallery.
QtOhosExtras::ShareKit::ShareAbilityType::SaveAsFile 2 Save the shared content as a file.
QtOhosExtras::ShareKit::ShareAbilityType::Print 3 Print the shared content.
QtOhosExtras::ShareKit::ShareAbilityType::SaveToSuperHub 4 Save the shared content to SuperHub.

This enum was introduced or modified in Qt 5.12.12.

Function Documentation

QSharedPointer<QOhosSharedRecord> ShareKit::createContentRecord(const QMimeType &mimeType, const QString &content)

Creates a shared "content" record with a given mimeType and content. Shared record can be created with content (this function) or as a file shared record, see createFileRecord(). See SharedRecord.content

QSharedPointer<QOhosShareControllerOptions> ShareKit::createControllerOptions()

Creates a controller options instnace. Controller options can be used to configure preview mode, selection mode and pop-up window anchor. See ShareControllerOptions

QSharedPointer<QOhosSharedRecord> ShareKit::createFileRecord(const QFileInfo &fileInfo)

Creates a shared "file" record with a given fileInfo. Shared record can be created with file (this function) or as a content record, see createContentRecord(). See SharedRecord.uri

QSharedPointer<QOhosSharedRecord> ShareKit::createUrlRecord(const QUrl &url)

Creates a shared record with a given url. See SharedRecord.content