Class: QgsVariableEditorWidget¶
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
.
Class Hierarchy¶
Base classes¶
Methods
Returns the current expression context for the widget. |
|
Returns the current editable scope for the widget. |
|
Reloads all scopes from the editor's current context. |
|
Overwrites the |
|
Sets the editable scope for the widget. |
|
Sets the setting group for the widget. |
|
Returns the setting group for the widget. |
|
Returns a map variables set within the editable scope. |
Signals
Emitted when the user has modified a scope using the widget. |
- class qgis.gui.QgsVariableEditorWidget[source]¶
Bases:
QWidget
- __init__(parent: QWidget | None = None)
Constructor for QgsVariableEditorWidget.
- Parameters:
parent (Optional[QWidget] = None) – parent widget
- context(self) QgsExpressionContext | None [source]¶
Returns the current expression context for the widget.
QgsVariableEditorWidget
widgets are created with an empty context by default.See also
- Return type:
Optional[QgsExpressionContext]
- editableScope(self) QgsExpressionContextScope | None [source]¶
Returns the current editable scope for the widget.
- Return type:
Optional[QgsExpressionContextScope]
- Returns:
editable scope, or
None
if no editable scope is set
See also
- reloadContext(self)[source]¶
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
- setContext(self, context: QgsExpressionContext | None)[source]¶
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 (Optional[QgsExpressionContext]) – expression context
See also
- setEditableScopeIndex(self, scopeIndex: int)[source]¶
Sets the editable scope for the widget. Only variables from the editable scope can be modified by users.
- Parameters:
scopeIndex (int) – index of current editable scope. Set to -1 to disable editing and make the widget read-only.
See also
- setSettingGroup(self, group: str | None)[source]¶
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 (Optional[str]) – setting group
See also