|
| void | progressChanged (qreal progress) |
| | Emitted when download progress changes.
|
| |
| void | runningChanged (bool running) |
| | Emitted when running state changes.
|
| |
| void | errorStringChanged (const QString &errorString) |
| | Emitted when error string changes.
|
| |
| void | urlChanged (const QUrl &url) |
| | Emitted when URL changes.
|
| |
| void | localPathChanged (const QString &localPath) |
| | Emitted when local path changes.
|
| |
| void | totalBytesChanged (qint64 totalBytes) |
| | Emitted when total bytes changes.
|
| |
| void | bytesReceivedChanged (qint64 bytesReceived) |
| | Emitted when bytes received changes.
|
| |
| void | autoDecompressChanged (bool autoDecompress) |
| | Emitted when auto-decompress setting changes.
|
| |
| void | outputPathChanged (const QString &outputPath) |
| | Emitted when output path setting changes.
|
| |
| void | expectedHashChanged (const QString &expectedHash) |
| | Emitted when expected hash setting changes.
|
| |
| void | stateChanged (State state) |
| | Emitted when state changes.
|
| |
| void | finished (bool success, const QString &localPath, const QString &errorMessage) |
| |
| void | downloadProgress (qint64 bytesReceived, qint64 totalBytes) |
| | Emitted during download with byte counts.
|
| |
| void | decompressionProgress (qreal progress) |
| | Emitted during decompression (0.0 to 1.0)
|
| |
File download with progress, decompression, and hash verification
Features:
- HTTP/HTTPS and local file:// downloads
- Automatic redirect handling
- Progress reporting with cancellation
- Optional auto-decompression of .gz/.xz/.zst/.bz2 files
- Optional SHA-256 hash verification
- Streaming to file (memory-efficient)
- QML-compatible properties and signals
Example C++ usage:
[](
bool success,
const QString &localPath,
const QString &
error) {
if (success) {
qDebug() << "Downloaded to:" << localPath;
} else {
qWarning() <<
"Download failed:" <<
error;
}
});
download->start("https://example.com/file.zip");
void finished(bool success, const QString &localPath, const QString &errorMessage)
Example QML usage:
id: downloader
autoDecompress: true
onProgressChanged: progressBar.value = progress
onFinished: (success, path,
error) => {
if (!success) console.log(
"Error:",
error)
}
}
Button {
text: downloader.running ? "Cancel" : "Download"
onClicked: downloader.running ? downloader.cancel()
: downloader.start(urlField.text)
}
Definition at line 62 of file QGCFileDownload.h.