QGIS API Documentation  3.6.0-Noosa (5873452)
Signals | Public Member Functions | List of all members
QgsNetworkContentFetcher Class Reference

HTTP network content fetcher. More...

#include <qgsnetworkcontentfetcher.h>

Inheritance diagram for QgsNetworkContentFetcher:
Inheritance graph
[legend]

Signals

void downloadProgress (qint64 bytesReceived, qint64 bytesTotal)
 Emitted when data is received. 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 QUrl &url)
 Fetches content from a remote URL and handles redirects. More...
 
void fetchContent (const QNetworkRequest &request)
 Fetches content using a network request and handles redirects. More...
 
QNetworkReply * reply ()
 Returns a reference to the network reply. More...
 

Detailed Description

HTTP network content fetcher.

A simple method for fetching remote HTTP content and converting the content to standard formats. Url redirects are automatically handled.

See also
QgsNetworkContentFetcherTask
Since
QGIS 2.5

Definition at line 37 of file qgsnetworkcontentfetcher.h.

Constructor & Destructor Documentation

◆ QgsNetworkContentFetcher()

QgsNetworkContentFetcher::QgsNetworkContentFetcher ( )
default

Constructor for QgsNetworkContentFetcher.

◆ ~QgsNetworkContentFetcher()

QgsNetworkContentFetcher::~QgsNetworkContentFetcher ( )
override

Definition at line 26 of file qgsnetworkcontentfetcher.cpp.

Member Function Documentation

◆ cancel()

void QgsNetworkContentFetcher::cancel ( )

Cancels any ongoing request.

Since
QGIS 3.2

Definition at line 87 of file qgsnetworkcontentfetcher.cpp.

◆ contentAsString()

QString QgsNetworkContentFetcher::contentAsString ( ) const

Returns the fetched content as a string.

Returns
string containing network content

Definition at line 73 of file qgsnetworkcontentfetcher.cpp.

◆ downloadProgress

void QgsNetworkContentFetcher::downloadProgress ( qint64  bytesReceived,
qint64  bytesTotal 
)
signal

Emitted when data is received.

Since
QGIS 3.2

◆ fetchContent() [1/2]

void QgsNetworkContentFetcher::fetchContent ( const QUrl &  url)

Fetches content from a remote URL and handles redirects.

The finished() signal will be emitted when content has been fetched.

Parameters
urlURL to fetch

Definition at line 39 of file qgsnetworkcontentfetcher.cpp.

◆ fetchContent() [2/2]

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.

Since
QGIS 3.2

Definition at line 44 of file qgsnetworkcontentfetcher.cpp.

◆ finished

void QgsNetworkContentFetcher::finished ( )
signal

Emitted when content has loaded.

◆ reply()

QNetworkReply * QgsNetworkContentFetcher::reply ( )

Returns a reference to the network reply.

Returns
QNetworkReply for fetched URL content

Definition at line 63 of file qgsnetworkcontentfetcher.cpp.


The documentation for this class was generated from the following files: