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¶
Base classes¶
Subclasses¶
A cache for images derived from raster files. |
|
A cache for source strings that returns a local file path containing the source content. |
|
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.
Runs additional checks on a network reply to ensure that the reply content is consistent with that required by the cache. |
|
Invalidates a cache entry for the specified path. |
|
Triggered after remote content (i.e. HTTP linked content at the given url) has been fetched. |
Static Methods
Returns |
|
Parses a path to determine if it represents a base 64 encoded HTML data URL, and if so, extracts the components of the URL. |
|
Parses a path to determine if it represents a embedded string data, and if so, extracts the components of the URL. |
Signals
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
ifpath
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 beTrue
if the content was successfully fetched, orFalse
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
ifpath
is a base 64 encoded data URLmimeType: the extracted mime type if the
path
is a data URLdata: 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
ifpath
is an embedded string data URLmimeType: the extracted mime type if the
path
is a data URLdata: the extracted string data if the
path
is a data URL
Added in version 3.42.