QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
A tree based widget for editing expression context scope variables. More...
#include <qgsvariableeditorwidget.h>
Public Slots | |
void | reloadContext () |
Reloads all scopes from the editor's current context. | |
Signals | |
void | scopeChanged () |
Emitted when the user has modified a scope using the widget. | |
Public Member Functions | |
QgsVariableEditorWidget (QWidget *parent=nullptr) | |
Constructor for QgsVariableEditorWidget. | |
~QgsVariableEditorWidget () override | |
QgsExpressionContext * | context () const |
Returns the current expression context for the widget. | |
QgsExpressionContextScope * | editableScope () const |
Returns the current editable scope for the widget. | |
void | setContext (QgsExpressionContext *context) |
Overwrites the QgsExpressionContext for the widget. | |
void | setEditableScopeIndex (int scopeIndex) |
Sets the editable scope for the widget. | |
void | setSettingGroup (const QString &group) |
Sets the setting group for the widget. | |
QString | settingGroup () const |
Returns the setting group for the widget. | |
QVariantMap | variablesInActiveScope () const |
Returns a map variables set within the editable scope. | |
Protected Member Functions | |
void | showEvent (QShowEvent *event) override |
Properties | |
QString | settingGroup |
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.
Definition at line 41 of file qgsvariableeditorwidget.h.
QgsVariableEditorWidget::QgsVariableEditorWidget | ( | QWidget * | parent = nullptr | ) |
Constructor for QgsVariableEditorWidget.
parent | parent widget |
Definition at line 39 of file qgsvariableeditorwidget.cpp.
|
override |
Definition at line 74 of file qgsvariableeditorwidget.cpp.
|
inline |
Returns the current expression context for the widget.
QgsVariableEditorWidget widgets are created with an empty context by default.
Definition at line 71 of file qgsvariableeditorwidget.h.
QgsExpressionContextScope * QgsVariableEditorWidget::editableScope | ( | ) | const |
Returns the current editable scope for the widget.
nullptr
if no editable scope is set Definition at line 128 of file qgsvariableeditorwidget.cpp.
|
slot |
Reloads all scopes from the editor's current context.
This method should be called after adding or removing scopes from the attached context.
Definition at line 110 of file qgsvariableeditorwidget.cpp.
|
signal |
Emitted when the user has modified a scope using the widget.
void QgsVariableEditorWidget::setContext | ( | QgsExpressionContext * | context | ) |
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.
context | expression context |
Definition at line 104 of file qgsvariableeditorwidget.cpp.
void QgsVariableEditorWidget::setEditableScopeIndex | ( | int | scopeIndex | ) |
Sets the editable scope for the widget.
Only variables from the editable scope can be modified by users.
scopeIndex | index of current editable scope. Set to -1 to disable editing and make the widget read-only. |
Definition at line 117 of file qgsvariableeditorwidget.cpp.
|
inline |
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.
group | setting group |
Definition at line 96 of file qgsvariableeditorwidget.h.
|
inline |
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.
Definition at line 105 of file qgsvariableeditorwidget.h.
|
overrideprotected |
Definition at line 80 of file qgsvariableeditorwidget.cpp.
QVariantMap QgsVariableEditorWidget::variablesInActiveScope | ( | ) | const |
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.
Definition at line 137 of file qgsvariableeditorwidget.cpp.
|
readwrite |
Definition at line 45 of file qgsvariableeditorwidget.h.