Qt 5.7 | Qt WebEngine | QML Types | WebEngineDownloadItem QML Type

Qt 5.7.1 Reference Documentation

# WebEngineDownloadItem QML Type

Provides information about a download. More...

Import Statement: | import QtWebEngine 1.3
Since: | QtWebEngine 1.1

- List of all members, including inherited members

## Properties

- id : int
- mimeType : string
- path : string
- receivedBytes : int
- savePageFormat : enumeration
- state : enumeration
- totalBytes : int

## Methods

- void accept()
- void cancel()

## Detailed Description

Stores the state of a download to be used to manage requested downloads.

By default, the download is rejected unless the user explicitly accepts it with WebEngineDownloadItem::accept().

## Property Documentation

id : int

Holds the download item's ID.

mimeType : string

Holds the MIME type of the download.

This QML property was introduced in QtWebEngine 1.2.

path : string

Holds the full target path where data is being downloaded to.

The path includes the file name. The default suggested path is the standard download location and file name is deduced not to overwrite already existing files.

The download path can only be set in the `WebEngineProfile.onDownloadRequested` handler before the download is accepted.

See also WebEngineProfile::downloadRequested() and accept().

receivedBytes : int

Holds the amount of data in bytes that has been downloaded so far.

savePageFormat : enumeration

Describes the format that is used to save a web page.

Constant | Description
--- | ---
`WebEngineDownloadItem.UnknownSaveFormat` | This is not a request for downloading a complete web page.
`WebEngineDownloadItem.SingleHtmlSaveFormat` | The page is saved as a single HTML page. Resources such as images are not saved.
`WebEngineDownloadItem.CompleteHtmlSaveFormat` | The page is saved as a complete HTML page, for example a directory containing the single HTML page and the resources.
`WebEngineDownloadItem.MimeHtmlSaveFormat` | The page is saved as a complete web page in the MIME HTML format.

This QML property was introduced in QtWebEngine 1.3.

state : enumeration

Describes the state of the download:

Constant | Description
--- | ---
`WebEngineDownloadItem.DownloadRequested` | Download has been requested, but it has not been accepted yet.
`WebEngineDownloadItem.DownloadInProgress` | Download is in progress.
`WebEngineDownloadItem.DownloadCompleted` | Download completed successfully.
`WebEngineDownloadItem.DownloadInterrupted` | Download has been interrupted (by the server or because of lost connectivity).

totalBytes : int

Holds the total amount of data to download in bytes.

`-1` means the total size is unknown.

## Method Documentation

void accept()

Accepts the download request, which will start the download.

See also WebEngineDownloadItem::cancel().

void cancel()

Cancels the download.