WebEngineDownloadItem QML 类型

提供关于下载的信息。 更多...

导入语句: import QtWebEngine 1.5
Since: QtWebEngine 1.1

特性

方法

详细描述

存储用于管理请求下载的下载状态。

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

特性文档编制

id : int

保存下载项的 ID。


[read-only] interruptReason : enumeration

返回下载为什么中断的原因:

常量 描述
WebEngineDownloadItem.NoReason 未知原因或未中断。
WebEngineDownloadItem.FileFailed 常规文件操作故障。
WebEngineDownloadItem.FileAccessDenied 文件无法在本地写入,由于访问限定。
WebEngineDownloadItem.FileNoSpace 目标驱动器空间不足。
WebEngineDownloadItem.FileNameTooLong 目录或文件名太长。
WebEngineDownloadItem.FileTooLarge 文件大小超过文件系统限制。
WebEngineDownloadItem.FileVirusInfected 文件被病毒感染。
WebEngineDownloadItem.FileTransientError 临时问题 (例如:文件在使用中、内存不足或一次打开太多文件)。
WebEngineDownloadItem.FileBlocked 文件被阻塞由于本地策略。
WebEngineDownloadItem.FileSecurityCheckFailed 试图检查下载失败的安全性,由于意外原因。
WebEngineDownloadItem.FileTooShort 尝试寻址超出文件末尾,当打开文件时 (作为再继续先前被中断下载的一部分)。
WebEngineDownloadItem.FileHashMismatch 部分文件不匹配预期哈希。
WebEngineDownloadItem.NetworkFailed 常规网络故障。
WebEngineDownloadItem.NetworkTimeout 网络操作已超时。
WebEngineDownloadItem.NetworkDisconnected 网络连接已被终止。
WebEngineDownloadItem.NetworkServerDown 服务器宕机。
WebEngineDownloadItem.NetworkInvalidRequest 网络请求无效 (例如:原始或重定向 URL 无效,方案不受支持或被策略禁止)。
WebEngineDownloadItem.ServerFailed 常规服务器故障。
WebEngineDownloadItem.ServerBadContent 服务器没有请求的数据。
WebEngineDownloadItem.ServerUnauthorized 服务器未授权访问资源。
WebEngineDownloadItem.ServerCertProblem 服务器证书发生问题。
WebEngineDownloadItem.ServerForbidden 访问被服务器禁止。
WebEngineDownloadItem.ServerUnreachable 意外服务器响应 (可能指示响应服务器,可能不是企图服务器)。
WebEngineDownloadItem.UserCanceled 用户取消下载。

该 QML 特性在 QtWebEngine 1.5 引入。

另请参阅 interruptReasonString .


interruptReasonString : string

返回人类可读的中断下载原因的描述。

该 QML 特性在 QtWebEngine 1.5 引入。

另请参阅 interruptReason .


mimeType : string

保存下载的 MIME 类型。

该 QML 特性在 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.

另请参阅 WebEngineProfile::downloadRequested() and accept() .


receivedBytes : int

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


savePageFormat : enumeration

描述用于保存网页的格式。

常量 描述
WebEngineDownloadItem.UnknownSaveFormat 这不是下载完整网页的请求。
WebEngineDownloadItem.SingleHtmlSaveFormat 页面被另存为单 HTML 页面。图像等资源不被保存。
WebEngineDownloadItem.CompleteHtmlSaveFormat 页面被另存为完整 HTML 页面,例如:目录包含单 HTML 页面和资源。
WebEngineDownloadItem.MimeHtmlSaveFormat 页面以 MIME HTML 格式,被另存为完整网页。

该 QML 特性在 QtWebEngine 1.3 引入。


state : enumeration

描述下载的状态:

常量 描述
WebEngineDownloadItem.DownloadRequested 已请求下载,但尚未被接受。
WebEngineDownloadItem.DownloadInProgress 下载正在进行中。
WebEngineDownloadItem.DownloadCompleted 下载成功完成。
WebEngineDownloadItem.DownloadCancelled 下载被用户取消。
WebEngineDownloadItem.DownloadInterrupted 下载已被中断 (由服务器或由于丢失连接)。

totalBytes : int

保存要下载的数据总量 (以字节为单位)。

-1 意味着总尺寸未知。


[read-only] type : enumeration

描述请求下载的类型。

常量 描述
WebEngineDownloadItem.Attachment Web 服务器的响应包括 Content-Disposition 头具有 attachment 指令。若 Content-Disposition 存在于回复中,Web 服务器指示客户端应该提示用户保存内容,不管内容类型。见 RFC 2616 第 19.5.1 节 了解细节。
WebEngineDownloadItem.DownloadAttribute 用户点击的链接具有 download 属性。见 HTML 下载属性 了解细节。
WebEngineDownloadItem.UserRequested 用户发起下载,例如通过选择 Web 操作。
WebEngineDownloadItem.SavePage 请求保存当前页面 (例如通过 WebEngineView.SavePage Web 动作)。

该 QML 特性在 QtWebEngine 1.4 引入。


方法文档编制

void accept ()

接受下载请求,将开始下载。


void cancel ()

取消下载。