Class: QgsAbstractContentCacheBase

A QObject derived base class for QgsAbstractContentCache.

Required because template based class (such as QgsAbstractContentCache) cannot use the Q_OBJECT macro.

Added in version 3.6.

Class Hierarchy

Inheritance diagram of qgis.core.QgsAbstractContentCacheBase

Base classes

QObject

Subclasses

QgsImageCache

A cache for images derived from raster files.

QgsSourceCache

A cache for source strings that returns a local file path containing the source content.

QgsSvgCache

A cache for images / pictures derived from SVG files.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsAbstractContentCacheBase. See the FAQ for more details.

checkReply

Runs additional checks on a network reply to ensure that the reply content is consistent with that required by the cache.

invalidateCacheEntry

Invalidates a cache entry for the specified path.

onRemoteContentFetched

Triggered after remote content (i.e. HTTP linked content at the given url) has been fetched.

Static Methods

isBase64Data

Returns True if path represents base64 encoded data.

parseBase64DataUrl

Parses a path to determine if it represents a base 64 encoded HTML data URL, and if so, extracts the components of the URL.

parseEmbeddedStringData

Parses a path to determine if it represents a embedded string data, and if so, extracts the components of the URL.

Signals

remoteContentFetched

Emitted when the cache has finished retrieving content from a remote url.

class qgis.core.QgsAbstractContentCacheBase[source]

Bases: QObject

__init__(parent: QObject | None)

Constructor for QgsAbstractContentCacheBase, with the specified parent object.

Parameters:

parent (Optional[QObject])

virtual checkReply(self, reply: QNetworkReply | None, path: str | None) bool[source]

Runs additional checks on a network reply to ensure that the reply content is consistent with that required by the cache.

Parameters:
  • reply (Optional[QNetworkReply])

  • path (Optional[str])

Return type:

bool

virtual invalidateCacheEntry(self, path: str | None) bool[source]

Invalidates a cache entry for the specified path.

If an entry exists for the given path, it will be removed from the cache.

Parameters:

path (Optional[str]) – The path of the cache entry to invalidate.

Return type:

bool

Returns:

True if an entry was invalidated, False otherwise.

Added in version 3.44.

static isBase64Data(path: str | None) bool[source]

Returns True if path represents base64 encoded data.

Added in version 3.40.

Parameters:

path (Optional[str])

Return type:

bool

virtual onRemoteContentFetched(self, url: str | None, success: bool)[source]

Triggered after remote content (i.e. HTTP linked content at the given url) has been fetched.

The success argument will be True if the content was successfully fetched, or False if it was not fetched successfully.

Parameters:
  • url (Optional[str])

  • success (bool)

static parseBase64DataUrl(path: str | None)[source]

Parses a path to determine if it represents a base 64 encoded HTML data URL, and if so, extracts the components of the URL.

Data URLs are of the form data:[<mediatype>;]base64,<data>.

Parameters:

path (Optional[str]) -> (bool) – path to test

Returns:

  • True if path is a base 64 encoded data URL

  • mimeType: the extracted mime type if the path is a data URL

  • data: the extracted base64 data if the path is a data URL

Added in version 3.40.

static parseEmbeddedStringData(path: str | None)[source]

Parses a path to determine if it represents a embedded string data, and if so, extracts the components of the URL.

Data URLs are of the form data:[<mediatype>;]utf8,<data>.

Parameters:

path (Optional[str]) -> (bool) – path to test

Returns:

  • True if path is an embedded string data URL

  • mimeType: the extracted mime type if the path is a data URL

  • data: the extracted string data if the path is a data URL

Added in version 3.42.

signal remoteContentFetched(url: str)[source]

Emitted when the cache has finished retrieving content from a remote url.

Parameters:

url (str)