A form element that holds one or more attachments on a feature. More...
| Header | #include <Attachments |
| Since | Esri |
| Inherits | Esri |
Public Functions
| virtual | ~ |
| Esri | add |
(since Esri QFuture | add |
(since Esri QFuture | add |
(since Esri QFuture | add |
(since Esri QFuture | add |
(since Esri Esri | attachment |
| QList | attachments() const |
| void | delete |
| QFuture | fetch |
(since Esri QList | inputs() const |
(since Esri bool | is |
(since Esri bool | is |
| bool | is |
(since Esri bool | is |
| QString | keyword() const |
(since Esri std | max |
(since Esri quint32 | min |
(since Esri QList | validation |
Signals
| void | editable |
(since Esri void | validation |
Detailed Description
The AttachmentsFormElement specifies how one or more attachments can participate in the form. When present in the form, the user has the ability to edit the list of attachments specific to the form element.
Member Function Documentation
[override virtual noexcept] AttachmentsFormElement::~AttachmentsFormElement ()
Destructor.
Esri::ArcGISRuntime::FormAttachment *AttachmentsFormElement::addAttachment (const QString &name, const QString &contentType , const QByteArray &data)
Returns adds a new attachment to this AttachmentsFormElement.
- name - The attachment name.
- contentType - The type of content.
- data - The attachment data.
[since Esri::ArcGISRuntime 300.0] QFuture<Esri::ArcGISRuntime::FormAttachment *> AttachmentsFormElement::addAttachmentAsync (const QString &name, const QString &contentType , const QString &filePath , QObject *parent = nullptr)
Adds a new attachment to this AttachmentsFormElement from the specified file.
- name - The name of the Attachment.
- contentType - The type of content.
- filePath - Path to a file that will be used for the attachment's content.
- parent - The optional parent QObject
ErrorType::CommonFileNotFound will be set if the file does not exist.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
This function was introduced in Esri::ArcGISRuntime 300.0.
[since Esri::ArcGISRuntime 300.1] QFuture<Esri::ArcGISRuntime::FormAttachment *> AttachmentsFormElement::addAttachmentFromDataAsync (const QString &contentType , const QByteArray &data, QObject *parent = nullptr)
Adds a new attachment to this AttachmentsFormElement.
- contentType - The type of content.
- data - The attachment data.
- parent - The optional parent QObject
The attachment name is generated automatically. When isUseOriginalFilename is true, or you wish to provide a custom name, use the overload of this method with the name parameter.
If the attachment is an image and it exceeds the maximum size specified by ImageFormInput::maxImageSize, it will be resized to meet that requirement before being added.
ErrorType::FeatureFormExceedsMaximumAttachmentCountError will be set if adding this attachment would exceed the maximum number of attachments allowed.
ErrorType::FeatureFormExceedsMaximumAttachmentDurationError will be set if the attachment exceeds the maximum duration specified by AudioFormInput::maxDuration or VideoFormInput::maxDuration.
ErrorType::FeatureFormExceedsMaximumAttachmentSizeError will be set if the attachment exceeds the maximum size specified by DocumentFormInput::maxFileSize.
ErrorType::FeatureFormIncorrectAttachmentTypeError will be set if the type of the FormAttachment does not match an allowed AttachmentsFormInputType.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
This function was introduced in Esri::ArcGISRuntime 300.1.
[since Esri::ArcGISRuntime 300.1] QFuture<Esri::ArcGISRuntime::FormAttachment *> AttachmentsFormElement::addAttachmentFromDataAsync (const QString &name, const QString &contentType , const QByteArray &data, QObject *parent = nullptr)
Adds a new attachment to this AttachmentsFormElement using the supplied final attachment name.
- name - The attachment name.
- contentType - The type of content.
- data - The attachment data.
The attachment name is provided by the `name` parameter. When isUseOriginalFilename is true, this should be the original file name; otherwise, use the overload of this method without a name to have one generated automatically.
If the attachment is an image and it exceeds the maximum size specified by ImageFormInput::maxImageSize, it will be resized to meet that requirement before being added.
ErrorType::FeatureFormExceedsMaximumAttachmentCountError will be set if adding this attachment would exceed the maximum number of attachments allowed.
ErrorType::FeatureFormExceedsMaximumAttachmentDurationError will be set if the attachment exceeds the maximum duration specified by AudioFormInput::maxDuration or VideoFormInput::maxDuration.
ErrorType::FeatureFormExceedsMaximumAttachmentSizeError will be set if the attachment exceeds the maximum size specified by DocumentFormInput::maxFileSize.
ErrorType::FeatureFormIncorrectAttachmentTypeError will be set if the type of the FormAttachment does not match an allowed AttachmentsFormInputType.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
This function was introduced in Esri::ArcGISRuntime 300.1.
[since Esri::ArcGISRuntime 300.1] QFuture<Esri::ArcGISRuntime::FormAttachment *> AttachmentsFormElement::addAttachmentFromFileAsync (const QString &contentType , const QString &filePath , QObject *parent = nullptr)
Adds a new attachment to this AttachmentsFormElement from the specified file.
- contentType - The type of content.
- filePath - Path to a file that will be used for the attachment's content.
- parent - The parent for the returned QFuture.
The attachment name is generated automatically. When isUseOriginalFilename is true, or you wish to provide a custom name, use the overload of this method with the name parameter.
If the attachment is an image and it exceeds the maximum size specified by ImageFormInput::maxImageSize, it will be resized to meet that requirement before being added.
ErrorType::CommonFileNotFound will be set if the file does not exist.
ErrorType::FeatureFormExceedsMaximumAttachmentCountError will be set if adding this attachment would exceed the maximum number of attachments allowed.
ErrorType::FeatureFormExceedsMaximumAttachmentDurationError will be set if the attachment exceeds the maximum duration specified by AudioFormInput::maxDuration or VideoFormInput::maxDuration.
ErrorType::FeatureFormExceedsMaximumAttachmentSizeError will be set if the attachment exceeds the maximum size specified by DocumentFormInput::maxFileSize.
ErrorType::FeatureFormIncorrectAttachmentTypeError will be set if the type of the FormAttachment does not match an allowed AttachmentsFormInputType.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
This function was introduced in Esri::ArcGISRuntime 300.1.
[since Esri::ArcGISRuntime 300.1] Esri::ArcGISRuntime::AttachmentKeywordAssociation AttachmentsFormElement::attachmentKeywordAssociation () const
Defines and returns how existing attachments are associated with this element.
This determines whether existing attachments are matched by any keyword, by an exact keyword match, or by an exact keyword match including attachments that have no keyword. If not provided in the form definition, the default value is AttachmentKeywordAssociation::Exact.
This function was introduced in Esri::ArcGISRuntime 300.1.
QList<Esri::ArcGISRuntime::FormAttachment *> AttachmentsFormElement::attachments() const
Returns all the current attachments. This is empty if attachments haven't yet been fetched.
See also fetchAttachmentsAsync.
void AttachmentsFormElement::deleteAttachment (Esri::ArcGISRuntime::FormAttachment *attachment)
Deletes an attachment from the Feature.
- attachment - The FormAttachment to delete.
[signal] void AttachmentsFormElement::editableChanged (bool isEditable )
Signal emitted when the editable state changes.
- isEditable - The new isEditable of the element.
QFuture<void> AttachmentsFormElement::fetchAttachmentsAsync ()
Fetches the attachments from the Feature and populates attachments. Attachments are not re-fetched if they have already been fetched.
This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.
See Working with QFuture for further details.
[since Esri::ArcGISRuntime 300.1] QList<Esri::ArcGISRuntime::AttachmentsFormInput *> AttachmentsFormElement::inputs() const
Returns the input types that can be used to add attachments.
This function was introduced in Esri::ArcGISRuntime 300.1.
[since Esri::ArcGISRuntime 300.1] bool AttachmentsFormElement::isAllowUserRename () const
Returns true if the user can rename attachments added through this element, false otherwise.
If false, client applications should prevent user-driven attachment renaming for this element. If not provided in the form definition, the default value is true.
This function was introduced in Esri::ArcGISRuntime 300.1.
[since Esri::ArcGISRuntime 300.1] bool AttachmentsFormElement::isDisplayFilename () const
Returns true if attachment file names should be displayed, false otherwise.
If not provided in the form definition, the default value is false.
This function was introduced in Esri::ArcGISRuntime 300.1.
bool AttachmentsFormElement::isEditable () const
Returns true if the element is editable, false otherwise.
This property can be modified by the editable expression, which can be set during Feature Form authoring.
[since Esri::ArcGISRuntime 300.1] bool AttachmentsFormElement::isUseOriginalFilename () const
Returns true if uploaded attachments preserve their original file name, false otherwise.
If false, the attachment should be added without a name to allow the system to generate one automatically. If not provided in the form definition, the default value is true.
This function was introduced in Esri::ArcGISRuntime 300.1.
QString AttachmentsFormElement::keyword() const
Returns a string to identify the attachment(s).
When a file is attached using the form, this property sets the value of the keywords field for the attachment. When a form displays existing attachments, this property is used to query attachments with an exact match on the keywords field.
[since Esri::ArcGISRuntime 300.1] std::optional <quint32> AttachmentsFormElement::maxAttachmentCount () const
Returns the maximum number of attachments allowed for this element.
The std::nullopt value indicates there is no maximum number of attachments.
This function was introduced in Esri::ArcGISRuntime 300.1.
[since Esri::ArcGISRuntime 300.1] quint32 AttachmentsFormElement::minAttachmentCount () const
Returns the minimum number of attachments required for this element.
This function was introduced in Esri::ArcGISRuntime 300.1.
[since Esri::ArcGISRuntime 300.1] QList<Esri::ArcGISRuntime::Error > AttachmentsFormElement::validationErrors () const
Returns an array of validation errors for this element.
The errors returned may be any of the following error types:
- ErrorType::FeatureFormExceedsMaximumAttachmentCountError
- ErrorType::FeatureFormExceedsMaximumAttachmentSizeError
- ErrorType::FeatureFormIncorrectAttachmentTypeError
- ErrorType::FeatureFormLessThanMinimumAttachmentCountError
This function was introduced in Esri::ArcGISRuntime 300.1.
See also FormInput and FeatureForm::elementValidationErrors.
[signal, since Esri::ArcGISRuntime 300.1] void AttachmentsFormElement::validationErrorsChanged (const QList<Esri::ArcGISRuntime::Error > &errors)
Invokes the callback when the validation errors of the AttachmentsFormElement changes.
- errors - The array of validation errors.
This function was introduced in Esri::ArcGISRuntime 300.1.