28 :
QgsTask( tr(
"Fetching %1" ).arg( request.url().toString() ) )
37 mFetcher->deleteLater();
49 int progress = ( bytesReceived * 100 ) / bytesTotal;
74 return mFetcher ? mFetcher->
reply() :
nullptr;
~QgsNetworkContentFetcherTask() override
void setProgress(double progress)
Sets the task's current progress.
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
Emitted when data is received.
void fetched()
Emitted when the network content has been fetched, regardless of whether the fetch was successful or ...
QNetworkReply * reply()
Returns a reference to the network reply.
bool isCanceled() const
Will return true if task should terminate ASAP.
QNetworkReply * reply()
Returns the network reply.
QString contentAsString() const
Returns the fetched content as a string.
Handles HTTP network content fetching in a background task.
HTTP network content fetcher.
Abstract base class for long running background tasks.
void finished()
Emitted when content has loaded.
QgsNetworkContentFetcherTask(const QUrl &url, const QString &authcfg=QString())
Constructor for a QgsNetworkContentFetcherTask which fetches the specified url.
void fetchContent(const QUrl &url, const QString &authcfg=QString())
Fetches content from a remote URL and handles redirects.
void cancel()
Cancels any ongoing request.
virtual void cancel()
Notifies the task that it should terminate.
QString contentAsString() const
Returns the fetched content as a string.
double progress() const
Returns the task's progress (between 0.0 and 100.0)
bool run() override
Performs the task's operation.
void cancel() override
Notifies the task that it should terminate.