|
QGIS API Documentation 4.3.0-Master (9b5c6454e64)
|
HTTP network content fetcher. More...
#include <qgsnetworkcontentfetcher.h>

Signals | |
| void | downloadProgress (qint64 bytesReceived, qint64 bytesTotal) |
| Emitted when data is received. | |
| 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. | |
| void | finished () |
| Emitted when content has loaded. | |
Public Member Functions | |
| QgsNetworkContentFetcher (QObject *parent=nullptr) | |
| Constructor for QgsNetworkContentFetcher, with the specified parent object. | |
| ~QgsNetworkContentFetcher () override | |
| void | cancel () |
| Cancels any ongoing request. | |
| QString | contentAsString () const |
| Returns the fetched content as a string. | |
| QString | contentDispositionFilename () const |
| Returns the associated filename from the reply's content disposition header, if present. | |
| void | fetchContent (const QNetworkRequest &request, const QString &authcfg=QString()) |
| Fetches content using a network request and handles redirects. | |
| void | fetchContent (const QUrl &url, const QString &authcfg=QString(), const QgsHttpHeaders &headers=QgsHttpHeaders()) |
| Fetches content from a remote URL and handles redirects. | |
| QNetworkReply * | reply () |
| Returns a reference to the network reply. | |
| bool | wasCanceled () const |
Returns true if the fetching was canceled. | |
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 42 of file qgsnetworkcontentfetcher.h.
| QgsNetworkContentFetcher::QgsNetworkContentFetcher | ( | QObject * | parent = nullptr | ) |
Constructor for QgsNetworkContentFetcher, with the specified parent object.
The parent argument was added in QGIS 4.4
Definition at line 36 of file qgsnetworkcontentfetcher.cpp.
|
override |
Definition at line 40 of file qgsnetworkcontentfetcher.cpp.
| void QgsNetworkContentFetcher::cancel | ( | ) |
Cancels any ongoing request.
Definition at line 129 of file qgsnetworkcontentfetcher.cpp.
| QString QgsNetworkContentFetcher::contentAsString | ( | ) | const |
Returns the fetched content as a string.
Definition at line 115 of file qgsnetworkcontentfetcher.cpp.
| QString QgsNetworkContentFetcher::contentDispositionFilename | ( | ) | const |
Returns the associated filename from the reply's content disposition header, if present.
Definition at line 110 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 60 of file qgsnetworkcontentfetcher.cpp.
| void QgsNetworkContentFetcher::fetchContent | ( | const QUrl & | url, |
| const QString & | authcfg = QString(), | ||
| const QgsHttpHeaders & | headers = QgsHttpHeaders() ) |
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 |
| headers | optional HTTP headers to add to the request (since QGIS 3.44.8) |
Definition at line 49 of file qgsnetworkcontentfetcher.cpp.
|
signal |
Emitted when content has loaded.
| QNetworkReply * QgsNetworkContentFetcher::reply | ( | ) |
Returns a reference to the network reply.
Definition at line 100 of file qgsnetworkcontentfetcher.cpp.
| bool QgsNetworkContentFetcher::wasCanceled | ( | ) | const |
Returns true if the fetching was canceled.
Definition at line 142 of file qgsnetworkcontentfetcher.cpp.