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¶
- 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.
QgsVariableEditorWidgetwidgets 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
Noneif 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
- signal scopeChanged[source]¶
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.
- setContext(self, context: QgsExpressionContext | None)[source]¶
Overwrites the
QgsExpressionContextfor 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.
QgsVariableEditorWidgetwidgets 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