QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
QgsFileDownloader is a utility class for downloading files. More...
#include <qgsfiledownloader.h>
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 | |
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.
Definition at line 45 of file qgsfiledownloader.h.
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() |
||
) |
url | the download URL |
outputFileName | file name where the downloaded content will be stored |
authcfg | optionally apply this authentication configuration |
delayStart | if 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. |
httpMethod | Method for the HTTP request : GET or POST, since QGIS 3.22 |
data | If the request is POST, some data can be added, since QGIS 3.22 |
Definition at line 31 of file qgsfiledownloader.cpp.
|
overrideprotected |
Definition at line 45 of file qgsfiledownloader.cpp.
|
slot |
Call to abort the download and delete this object after the cancellation has been processed.
Definition at line 103 of file qgsfiledownloader.cpp.
|
signal |
Emitted when the download was canceled by the user.
|
signal |
Emitted when the download has completed successfully.
|
signal |
Emitted when an error makes the download fail.
|
signal |
Emitted always when the downloader exits.
|
signal |
Emitted when data are ready to be processed.
|
slot |
Called to start the download.
Definition at line 54 of file qgsfiledownloader.cpp.