Class: QgsVariableEditorWidget¶
- class qgis.gui.QgsVariableEditorWidget¶
Bases:
PyQt5.QtWidgets.QWidget
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 aQgsExpressionContext
.QgsVariableEditorWidget(parent: QWidget = None) Constructor for QgsVariableEditorWidget.
- Parameters:
parent –
parent widget
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
QgsExpressionContext
for the widget.Sets the editable scope for the widget.
Sets the setting group for the widget.
Returns the setting group for the widget.
- param event:
Returns a map variables set within the editable scope.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- actionEvent(self, QActionEvent)¶
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- closeEvent(self, QCloseEvent)¶
- connectNotify(self, QMetaMethod)¶
- context(self) QgsExpressionContext ¶
Returns the current expression context for the widget.
QgsVariableEditorWidget
widgets are created with an empty context by default.See also
- Return type:
- contextMenuEvent(self, QContextMenuEvent)¶
- create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- customEvent(self, QEvent)¶
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QDragEnterEvent)¶
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- dropEvent(self, QDropEvent)¶
- editableScope(self) QgsExpressionContextScope ¶
Returns the current editable scope for the widget.
- Return type:
- Returns:
editable scope, or
None
if no editable scope is set
See also
- enterEvent(self, QEvent)¶
- event(self, QEvent) bool ¶
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPreviousChild(self) bool ¶
- hideEvent(self, QHideEvent)¶
- initPainter(self, QPainter)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseMoveEvent(self, QMouseEvent)¶
- mousePressEvent(self, QMouseEvent)¶
- mouseReleaseEvent(self, QMouseEvent)¶
- moveEvent(self, QMoveEvent)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, QPaintEvent)¶
- receivers(self, PYQT_SIGNAL) int ¶
- 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
- resizeEvent(self, QResizeEvent)¶
- scopeChanged¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- 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 (QgsExpressionContext) – expression context
See also
- setEditableScopeIndex(self, scopeIndex: int)¶
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)¶
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 (str) – setting group
See also
- 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.- Return type:
str
- Returns:
setting group name
See also
- showEvent(self, event: QShowEvent)¶
- Parameters:
event (QShowEvent) –
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- 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.
- Return type:
Dict[str, Any]
- wheelEvent(self, QWheelEvent)¶