QgsNetworkContentFetcherRegistry class

Registry for temporary fetched files.

This provides a simple way of downloading and accessing remote files during QGIS application running.

Public types

enum FetchingMode { DownloadLater, DownloadImmediately }
Enum to determine when the download should start.

Constructors, destructors, conversion operators

QgsNetworkContentFetcherRegistry() defaulted explicit
Create the registry for temporary downloaded files.

Public functions

auto fetch(const QString& url, FetchingMode fetchingMode = DownloadLater) -> const QgsFetchedContent*
Initialize a download for the given URL.
auto localFile(const QString& filePathOrUrl) -> QFile*
Returns a QFile from a local file or to a temporary file previously fetched by the registry.
auto localPath(const QString& filePathOrUrl) -> QString
Returns the path to a local file or to a temporary file previously fetched by the registry.

Enum documentation

enum QgsNetworkContentFetcherRegistry::FetchingMode

Enum to determine when the download should start.

Enumerators
DownloadLater

Do not start immediately the download to properly connect the fetched signal.

DownloadImmediately

The download will start immediately, not need to run QgsFecthedContent::download()

Function documentation

const QgsFetchedContent* QgsNetworkContentFetcherRegistry::fetch(const QString& url, FetchingMode fetchingMode = DownloadLater)

Initialize a download for the given URL.

Parameters
url the URL to be fetched
fetchingMode defines if the download will start immediately or shall be manually triggered

QFile* QgsNetworkContentFetcherRegistry::localFile(const QString& filePathOrUrl)

Returns a QFile from a local file or to a temporary file previously fetched by the registry.

Parameters
filePathOrUrl can either be a local file path or a remote content which has previously been fetched

QString QgsNetworkContentFetcherRegistry::localPath(const QString& filePathOrUrl)

Returns the path to a local file or to a temporary file previously fetched by the registry.

Parameters
filePathOrUrl can either be a local file path or a remote content which has previously been fetched