QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
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. More... | |
void | startDownload () |
Called to start the download. More... | |
Signals | |
void | downloadCanceled () |
Emitted when the download was canceled by the user. More... | |
void | downloadCompleted (const QUrl &url) |
Emitted when the download has completed successfully. More... | |
void | downloadError (QStringList errorMessages) |
Emitted when an error makes the download fail. More... | |
void | downloadExited () |
Emitted always when the downloader exits. More... | |
void | downloadProgress (qint64 bytesReceived, qint64 bytesTotal) |
Emitted when data are ready to be processed. More... | |
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. More... | |
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 46 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 29 of file qgsfiledownloader.cpp.
|
overrideprotected |
Definition at line 42 of file qgsfiledownloader.cpp.
|
slot |
Call to abort the download and delete this object after the cancellation has been processed.
Definition at line 99 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 51 of file qgsfiledownloader.cpp.