WebEngineDownloadItem QML 類型

提供下載的有關信息。 更多...

import 語句: 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 ()

取消下載。