QgsFetchedContent class

FetchedContent holds useful information about a network content being fetched.

Public types

enum ContentStatus { NotStarted, Downloading, Finished, Failed }
Status of fetched content.

Constructors, destructors, conversion operators

QgsFetchedContent(const QString& url, QTemporaryFile* file = nullptr, ContentStatus status = NotStarted) explicit
Constructs a FetchedContent with pointer to the downloaded file and status of the download.

Public functions

auto error() const -> QNetworkReply::NetworkError
Returns the potential error of the download.
auto file() const -> QFile*
Returns a pointer to the local file, a null pointer if the file is not accessible yet.
auto filePath() const -> const QString
Returns the path to the local file, an empty string if the file is not accessible yet.
auto status() const -> ContentStatus
Returns the status of the download.

Signals

void fetched()
Emitted when the file is fetched and accessible.

Public slots

void cancel()
Cancel the download operation.
void download(bool redownload = false)
Start the download.

Enum documentation

enum QgsFetchedContent::ContentStatus

Status of fetched content.

Enumerators
NotStarted

No download started for such URL.

Downloading

Currently downloading.

Finished

Download finished and successful.

Failed

Download failed.

Function documentation

void QgsFetchedContent::download(bool redownload = false) public slot

Start the download.

Parameters
redownload if set to true, it will restart any achieved or pending download.