Class: QgsSourceCache

class qgis.core.QgsSourceCache

Bases: QgsAbstractContentCacheBase

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

QgsSourceCache is not usually directly created, but rather accessed through QgsApplication.sourceCache().

New in version 3.16.

QgsSourceCache(parent: QObject = None) Constructor for QgsSourceCache, with the specified parent object.

Methods

checkReply

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

childEvent

connectNotify

customEvent

disconnectNotify

isSignalConnected

localFilePath

Returns a local file path reflecting the content of a specified source path

onRemoteContentFetched

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

receivers

sender

senderSignalIndex

timerEvent

Signals

remoteSourceFetched

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

checkReply(self, reply: QNetworkReply, path: str) bool

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

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
isSignalConnected(self, QMetaMethod) bool
localFilePath(self, path: str, blocking: bool = False) str

Returns a local file path reflecting the content of a specified source path

path may be a local file, remote (HTTP) url, or a base 64 encoded string (with a “base64:” prefix).

Parameters:
  • path (str) –

  • blocking (bool = False) –

Return type:

str

onRemoteContentFetched(self, url: str, success: bool)

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.

receivers(self, PYQT_SIGNAL) int
remoteSourceFetched

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)