QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
QgsVariableEditorWidget Class Reference

A tree based widget for editing expression context scope variables. More...

#include <qgsvariableeditorwidget.h>

Inheritance diagram for QgsVariableEditorWidget:
Inheritance graph
[legend]

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
 
QgsExpressionContextcontext () const
 Returns the current expression context for the widget.
 
QgsExpressionContextScopeeditableScope () 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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QgsVariableEditorWidget()

QgsVariableEditorWidget::QgsVariableEditorWidget ( QWidget *  parent = nullptr)

Constructor for QgsVariableEditorWidget.

Parameters
parentparent widget

Definition at line 39 of file qgsvariableeditorwidget.cpp.

◆ ~QgsVariableEditorWidget()

QgsVariableEditorWidget::~QgsVariableEditorWidget ( )
override

Definition at line 74 of file qgsvariableeditorwidget.cpp.

Member Function Documentation

◆ context()

QgsExpressionContext * QgsVariableEditorWidget::context ( ) const
inline

Returns the current expression context for the widget.

QgsVariableEditorWidget widgets are created with an empty context by default.

See also
setContext()

Definition at line 71 of file qgsvariableeditorwidget.h.

◆ editableScope()

QgsExpressionContextScope * QgsVariableEditorWidget::editableScope ( ) const

Returns the current editable scope for the widget.

Returns
editable scope, or nullptr if no editable scope is set
See also
setEditableScopeIndex()

Definition at line 128 of file qgsvariableeditorwidget.cpp.

◆ reloadContext

void QgsVariableEditorWidget::reloadContext ( )
slot

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()

Definition at line 110 of file qgsvariableeditorwidget.cpp.

◆ scopeChanged

void QgsVariableEditorWidget::scopeChanged ( )
signal

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

◆ setContext()

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.

Parameters
contextexpression context
See also
context()

Definition at line 104 of file qgsvariableeditorwidget.cpp.

◆ setEditableScopeIndex()

void QgsVariableEditorWidget::setEditableScopeIndex ( int  scopeIndex)

Sets the editable scope for the widget.

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

Parameters
scopeIndexindex of current editable scope. Set to -1 to disable editing and make the widget read-only.
See also
editableScope()

Definition at line 117 of file qgsvariableeditorwidget.cpp.

◆ setSettingGroup()

void QgsVariableEditorWidget::setSettingGroup ( const QString &  group)
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.

Parameters
groupsetting group
See also
settingGroup()

Definition at line 96 of file qgsvariableeditorwidget.h.

◆ settingGroup()

QString QgsVariableEditorWidget::settingGroup ( ) const
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.

Returns
setting group name
See also
setSettingGroup()

Definition at line 105 of file qgsvariableeditorwidget.h.

◆ showEvent()

void QgsVariableEditorWidget::showEvent ( QShowEvent *  event)
overrideprotected

Definition at line 80 of file qgsvariableeditorwidget.cpp.

◆ variablesInActiveScope()

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.

Property Documentation

◆ settingGroup

QString QgsVariableEditorWidget::settingGroup
readwrite

Definition at line 45 of file qgsvariableeditorwidget.h.


The documentation for this class was generated from the following files: