Subgroup: other

Class: QgsVariableEditorWidget

class qgis.gui.QgsVariableEditorWidget(parent: QWidget = None)

Bases: PyQt5.QtWidgets.QWidget

Constructor for QgsVariableEditorWidget.

Parameters:parent – parent widget

A tree based widget for editing expression context scope variables. The widget allows editing variables from a QgsExpressionContextScope, and can optionally also show inherited variables from a QgsExpressionContext.

New in version 2.12: Methods

actionEvent
changeEvent
childEvent
closeEvent
connectNotify
context Returns the current expression context for the widget.
contextMenuEvent
create
customEvent
destroy
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
editableScope Returns the current editable scope for the widget.
enterEvent
event
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPreviousChild
hideEvent
initPainter
inputMethodEvent
isSignalConnected
keyPressEvent
keyReleaseEvent
leaveEvent
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveEvent
nativeEvent
paintEvent
receivers
reloadContext Reloads all scopes from the editor’s current context.
resizeEvent
sender
senderSignalIndex
setContext Overwrites the QgsExpressionContext for the widget.
setEditableScopeIndex Sets the editable scope for the widget.
setSettingGroup Sets the setting group for the widget.
settingGroup Returns the setting group for the widget.
sharedPainter
showEvent
tabletEvent
timerEvent
updateMicroFocus
variablesInActiveScope Returns a map variables set within the editable scope.
wheelEvent

Signals

scopeChanged Emitted when the user has modified a scope using the widget.

Attributes

actionEvent()
changeEvent()
childEvent()
closeEvent()
connectNotify()
context(self) → QgsExpressionContext

Returns the current expression context for the widget. QgsVariableEditorWidget widgets are created with an empty context by default.

See also

setContext()

contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
editableScope(self) → QgsExpressionContextScope

Returns the current editable scope for the widget.

Returns:editable scope, or 0 if no editable scope is set
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
receivers()
reloadContext(self)

Reloads all scopes from the editor’s current context. This method should be called after adding or removing scopes from the attached context.

See also

context()

resizeEvent()
scopeChanged

Emitted when the user has modified a scope using the widget. [signal]

sender()
senderSignalIndex()
setContext(self, context: QgsExpressionContext)

Overwrites the QgsExpressionContext for the widget. Setting a context allows the widget to show all inherited variables for the context, and highlight any overridden variables within scopes.

Parameters:context – expression context

See also

context()

setEditableScopeIndex(self, scopeIndex: int)

Sets the editable scope for the widget. Only variables from the editable scope can be modified by users.

Parameters:scopeIndex – index of current editable scope. Set to -1 to disable editing and make the widget read-only.

See also

editableScope()

setSettingGroup(self, group: str)

Sets the setting group for the widget. QgsVariableEditorWidget widgets with the same setting group will synchronise their settings, e.g., the size of columns in the tree widget.

Parameters:group – setting group

See also

settingGroup()

settingGroup(self) → str

Returns the setting group for the widget. QgsVariableEditorWidget widgets with the same setting group will synchronise their settings, e.g., the size of columns in the tree widget.

Returns:setting group name
sharedPainter()
showEvent(self, event: QShowEvent)
tabletEvent()
timerEvent()
updateMicroFocus()
variablesInActiveScope(self) → Dict[str, Any]

Returns a map variables set within the editable scope. Read only variables are not returned. This method can be used to retrieve the variables edited an added by users via the widget.

wheelEvent()