QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
HTTP network content fetcher. A simple method for fetching remote HTTP content and converting the content to standard formats. Url redirects are automatically handled. More...
#include <qgsnetworkcontentfetcher.h>
Signals | |
void | downloadProgress (qint64 bytesReceived, qint64 bytesTotal) |
Emitted when data is received. More... | |
void | errorOccurred (QNetworkReply::NetworkError code, const QString &errorMsg) |
Emitted when an error with code error occurred while processing the request errorMsg is a textual description of the error. More... | |
void | finished () |
Emitted when content has loaded. More... | |
Public Member Functions | |
QgsNetworkContentFetcher ()=default | |
Constructor for QgsNetworkContentFetcher. More... | |
~QgsNetworkContentFetcher () override | |
void | cancel () |
Cancels any ongoing request. More... | |
QString | contentAsString () const |
Returns the fetched content as a string. More... | |
void | fetchContent (const QNetworkRequest &request, const QString &authcfg=QString()) |
Fetches content using a network request and handles redirects. More... | |
void | fetchContent (const QUrl &url, const QString &authcfg=QString()) |
Fetches content from a remote URL and handles redirects. More... | |
QNetworkReply * | reply () |
Returns a reference to the network reply. More... | |
bool | wasCanceled () const |
Returns true if the fetching was canceled. More... | |
HTTP network content fetcher. A simple method for fetching remote HTTP content and converting the content to standard formats. Url redirects are automatically handled.
Definition at line 39 of file qgsnetworkcontentfetcher.h.
|
default |
Constructor for QgsNetworkContentFetcher.
|
override |
Definition at line 27 of file qgsnetworkcontentfetcher.cpp.
void QgsNetworkContentFetcher::cancel | ( | ) |
Cancels any ongoing request.
Definition at line 113 of file qgsnetworkcontentfetcher.cpp.
QString QgsNetworkContentFetcher::contentAsString | ( | ) | const |
Returns the fetched content as a string.
Definition at line 99 of file qgsnetworkcontentfetcher.cpp.
|
signal |
Emitted when data is received.
|
signal |
Emitted when an error with code error occurred while processing the request errorMsg is a textual description of the error.
void QgsNetworkContentFetcher::fetchContent | ( | const QNetworkRequest & | request, |
const QString & | authcfg = QString() |
||
) |
Fetches content using a network request and handles redirects.
The finished() signal will be emitted when content has been fetched.
Optionally, authentication configuration can be set via the authcfg argument.
Definition at line 45 of file qgsnetworkcontentfetcher.cpp.
void QgsNetworkContentFetcher::fetchContent | ( | const QUrl & | url, |
const QString & | authcfg = QString() |
||
) |
Fetches content from a remote URL and handles redirects.
The finished() signal will be emitted when content has been fetched.
url | URL to fetch |
authcfg | optional authentication configuration |
Definition at line 37 of file qgsnetworkcontentfetcher.cpp.
|
signal |
Emitted when content has loaded.
QNetworkReply * QgsNetworkContentFetcher::reply | ( | ) |
Returns a reference to the network reply.
Definition at line 89 of file qgsnetworkcontentfetcher.cpp.
bool QgsNetworkContentFetcher::wasCanceled | ( | ) | const |
Returns true
if the fetching was canceled.
Definition at line 126 of file qgsnetworkcontentfetcher.cpp.