Subgroup: other

Class: QgsFeedback

class qgis.core.QgsFeedback

Bases: PyQt5.QtCore.QObject

Base class for feedback objects to be used for cancelation of something running in a worker thread. The class may be used as is or it may be subclassed for extended functionality for a particular operation (e.g. report progress or pass some data for preview).

When cancel() is called, the internal code has two options to check for cancelation state: - if the worker thread uses an event loop (e.g. for network communication), the code can make a queued connection to canceled() signal and handle the cancelation in its slot. - if the worker thread does not use an event loop, it can poll isCanceled() method regularly to see if the operation should be canceled.

The class is meant to be created and destroyed in the main thread.

For map rendering, the object may be created in constructor of a QgsMapLayerRenderer subclass and available with QgsMapLayerRenderer.feedback() method. When a map rendering job gets canceled, the cancel() method is called on the feedback object of all layers.

New in version 3.0: Methods

blockSignals
cancel Tells the internal routines that the current operation should be canceled.
childEvent
children
connectNotify
customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
inherits
installEventFilter
isCanceled Tells whether the operation has been canceled already
isSignalConnected
isWidgetType
isWindowType
killTimer
metaObject
moveToThread
objectName
parent
progress Returns the current progress reported by the feedback object.
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
removeEventFilter
sender
senderSignalIndex
setObjectName
setParent
setProgress Sets the current progress for the feedback object.
setProperty
signalsBlocked
startTimer
thread
timerEvent
tr

Attributes

canceled Internal routines can connect to this signal if they use event loop [signal]
destroyed destroyed(self, QObject = None) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
progressChanged Emitted when the feedback object reports a progress change.
staticMetaObject
cancel(self)

Tells the internal routines that the current operation should be canceled. This should be run by the main thread

canceled

Internal routines can connect to this signal if they use event loop [signal]

childEvent()
connectNotify()
customEvent()
disconnectNotify()
isCanceled(self) → bool

Tells whether the operation has been canceled already

isSignalConnected()
progress(self) → float

Returns the current progress reported by the feedback object. Depending on how the feedback object is used progress reporting may not be supported. The returned value is in percentage and ranges from 0-100.

See also

setProgress()

New in version 3.0.

progressChanged

Emitted when the feedback object reports a progress change. Depending on how the feedback object is used progress reporting may not be supported. The progress argument is in percentage and ranges from 0-100.

New in version 3.0.

See also

setProgress()

See also

progress() [signal]

receivers()
sender()
senderSignalIndex()
setProgress(self, progress: float)

Sets the current progress for the feedback object. The progress argument is in percentage and valid values range from 0-100.

See also

progress()

New in version 3.0.

timerEvent()