QgsNetworkContentFetcher class
HTTP network content fetcher.
Contents
A simple method for fetching remote HTTP content and converting the content to standard formats. Url redirects are automatically handled.
Constructors, destructors, conversion operators
- QgsNetworkContentFetcher() defaulted
- Constructor for QgsNetworkContentFetcher.
Public functions
- void cancel()
- Cancels any ongoing request.
- auto contentAsString() const -> QString
- Returns the fetched content as a string.
- void fetchContent(const QUrl& url)
- Fetches content from a remote URL and handles redirects.
- void fetchContent(const QNetworkRequest& request)
- Fetches content using a network request and handles redirects.
- auto reply() -> QNetworkReply*
- Returns a reference to the network reply.
Signals
- void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
- Emitted when data is received.
- void finished()
- Emitted when content has loaded.
Function documentation
void QgsNetworkContentFetcher:: cancel()
Cancels any ongoing request.
QString QgsNetworkContentFetcher:: contentAsString() const
Returns the fetched content as a string.
| Returns | string containing network content |
|---|
void QgsNetworkContentFetcher:: fetchContent(const QUrl& url)
Fetches content from a remote URL and handles redirects.
| Parameters | |
|---|---|
| url | URL to fetch |
The finished() signal will be emitted when content has been fetched.
void QgsNetworkContentFetcher:: fetchContent(const QNetworkRequest& request)
Fetches content using a network request and handles redirects.
The finished() signal will be emitted when content has been fetched.
QNetworkReply* QgsNetworkContentFetcher:: reply()
Returns a reference to the network reply.
| Returns | QNetworkReply for fetched URL content |
|---|
void QgsNetworkContentFetcher:: downloadProgress(qint64 bytesReceived,
qint64 bytesTotal) signal
Emitted when data is received.