Class: QgsVirtualLayerTask¶
-
class
qgis.core.
QgsVirtualLayerTask
(definition: QgsVirtualLayerDefinition)¶ Bases:
QgsTask
Constructor.
- Parameters
definition (QgsVirtualLayerDefinition) – The definition to use for initializing the virtual layer
Initializes a virtual layer with postpone mode activated and reloads the data in a separated thread.
Methods
Cancels the pending query and the parent task.
Returns the virtual layer definition.
Returns the exception text or an empty string if no exceptions were raised
If the task is managed by a
QgsTaskManager
, this will be called after the task has finished (whether through successful completion or via early termination).Will return
True
if task should terminate ASAP.Returns the underlying virtual layer.
Reloads the data.
Sets the
exceptionText
Sets the task’s current progress.
Returns the underlying virtual layer and ownership.
-
cancel
(self)¶ Cancels the pending query and the parent task.
-
childEvent
(self, QChildEvent)¶
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
definition
(self) → QgsVirtualLayerDefinition¶ Returns the virtual layer definition.
- Return type
-
disconnectNotify
(self, QMetaMethod)¶
-
exceptionText
(self) → str¶ Returns the exception text or an empty string if no exceptions were raised
New in version 3.4.
- Return type
str
-
finished
(self, result: bool)¶ If the task is managed by a
QgsTaskManager
, this will be called after the task has finished (whether through successful completion or via early termination). The result argument reflects whether the task was successfully completed or not. This method is always called from the main thread, so it is safe to create widgets and perform other operations which require the main thread. However, the GUI will be blocked for the duration of this method so tasks should avoid performing any lengthy operations here.
-
isCanceled
(self) → bool¶ Will return
True
if task should terminate ASAP. If the task reports the CanCancel flag, then derived classes’ run() methods should periodically check this and terminate in a safe manner.
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
layer
(self) → QgsVectorLayer¶ Returns the underlying virtual layer.
- Return type
-
receivers
(self, PYQT_SIGNAL) → int¶
-
run
(self) → bool¶ Reloads the data.
- Return type
bool
- Returns
True
if the virtual layer is valid,False
otherwise.
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setExceptionText
(self, exceptionText: str)¶ Sets the
exceptionText
New in version 3.4.
- Parameters
exceptionText (str) –
-
setProgress
(self, progress: float)¶ Sets the task’s current progress. The derived class should call this method whenever the task wants to update its progress. Calling will automatically emit the progressChanged signal.
- Parameters
progress – percent of progress, from 0.0 - 100.0
-
takeLayer
(self) → QgsVectorLayer¶ Returns the underlying virtual layer and ownership.
- Return type
-
timerEvent
(self, QTimerEvent)¶