QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsFileDownloader Class Reference

QgsFileDownloader is a utility class for downloading files. More...

#include <qgsfiledownloader.h>

Inheritance diagram for QgsFileDownloader:
Inheritance graph
[legend]

Public Slots

void cancelDownload ()
 Call to abort the download and delete this object after the cancellation has been processed.
 
void startDownload ()
 Called to start the download.
 

Signals

void downloadCanceled ()
 Emitted when the download was canceled by the user.
 
void downloadCompleted (const QUrl &url)
 Emitted when the download has completed successfully.
 
void downloadError (QStringList errorMessages)
 Emitted when an error makes the download fail.
 
void downloadExited ()
 Emitted always when the downloader exits.
 
void downloadProgress (qint64 bytesReceived, qint64 bytesTotal)
 Emitted when data are ready to be processed.
 

Public Member Functions

 QgsFileDownloader (const QUrl &url, const QString &outputFileName, const QString &authcfg=QString(), bool delayStart=false, Qgis::HttpMethod httpMethod=Qgis::HttpMethod::Get, const QByteArray &data=QByteArray())
 QgsFileDownloader.
 

Protected Member Functions

 ~QgsFileDownloader () override
 

Detailed Description

QgsFileDownloader is a utility class for downloading files.

To use this class, it is necessary to pass the URL and an output file name as arguments to the constructor, the download will start immediately.

The download is asynchronous.

The object will destroy itself when the request completes, errors or is canceled. An optional authentication configuration can be specified.

Note
This class was part of the GUI library from QGIS 2.18.1 until QGIS 3.0

Definition at line 45 of file qgsfiledownloader.h.

Constructor & Destructor Documentation

◆ QgsFileDownloader()

QgsFileDownloader::QgsFileDownloader ( const QUrl &  url,
const QString &  outputFileName,
const QString &  authcfg = QString(),
bool  delayStart = false,
Qgis::HttpMethod  httpMethod = Qgis::HttpMethod::Get,
const QByteArray &  data = QByteArray() 
)

QgsFileDownloader.

Parameters
urlthe download URL
outputFileNamefile name where the downloaded content will be stored
authcfgoptionally apply this authentication configuration
delayStartif true, the download will not be commenced immediately and must be triggered by a later call to startDownload(). This can be useful if connections need to be made to the downloader and there's a chance the download will emit signals before these connections have been made.
httpMethodMethod for the HTTP request : GET or POST, since QGIS 3.22
dataIf the request is POST, some data can be added, since QGIS 3.22

Definition at line 31 of file qgsfiledownloader.cpp.

◆ ~QgsFileDownloader()

QgsFileDownloader::~QgsFileDownloader ( )
overrideprotected

Definition at line 45 of file qgsfiledownloader.cpp.

Member Function Documentation

◆ cancelDownload

void QgsFileDownloader::cancelDownload ( )
slot

Call to abort the download and delete this object after the cancellation has been processed.

See also
downloadCanceled()

Definition at line 103 of file qgsfiledownloader.cpp.

◆ downloadCanceled

void QgsFileDownloader::downloadCanceled ( )
signal

Emitted when the download was canceled by the user.

See also
cancelDownload()

◆ downloadCompleted

void QgsFileDownloader::downloadCompleted ( const QUrl &  url)
signal

Emitted when the download has completed successfully.

◆ downloadError

void QgsFileDownloader::downloadError ( QStringList  errorMessages)
signal

Emitted when an error makes the download fail.

◆ downloadExited

void QgsFileDownloader::downloadExited ( )
signal

Emitted always when the downloader exits.

◆ downloadProgress

void QgsFileDownloader::downloadProgress ( qint64  bytesReceived,
qint64  bytesTotal 
)
signal

Emitted when data are ready to be processed.

◆ startDownload

void QgsFileDownloader::startDownload ( )
slot

Called to start the download.

Definition at line 54 of file qgsfiledownloader.cpp.


The documentation for this class was generated from the following files: