QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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. More...
 

Signals

void scopeChanged ()
 Emitted when the user has modified a scope using the widget. More...
 

Public Member Functions

 QgsVariableEditorWidget (QWidget *parent=nullptr)
 Constructor for QgsVariableEditorWidget. More...
 
 ~QgsVariableEditorWidget () override
 
QgsExpressionContextcontext () const
 Returns the current expression context for the widget. More...
 
QgsExpressionContextScopeeditableScope () const
 Returns the current editable scope for the widget. More...
 
void setContext (QgsExpressionContext *context)
 Overwrites the QgsExpressionContext for the widget. More...
 
void setEditableScopeIndex (int scopeIndex)
 Sets the editable scope for the widget. More...
 
void setSettingGroup (const QString &group)
 Sets the setting group for the widget. More...
 
QString settingGroup () const
 Returns the setting group for the widget. More...
 
QVariantMap variablesInActiveScope () const
 Returns a map variables set within the editable scope. More...
 

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.

Since
QGIS 2.12

Definition at line 42 of file qgsvariableeditorwidget.h.

Constructor & Destructor Documentation

QgsVariableEditorWidget::QgsVariableEditorWidget ( QWidget *  parent = nullptr)

Constructor for QgsVariableEditorWidget.

Parameters
parentparent widget

Definition at line 36 of file qgsvariableeditorwidget.cpp.

QgsVariableEditorWidget::~QgsVariableEditorWidget ( )
override

Definition at line 71 of file qgsvariableeditorwidget.cpp.

Member Function Documentation

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 72 of file qgsvariableeditorwidget.h.

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 125 of file qgsvariableeditorwidget.cpp.

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 107 of file qgsvariableeditorwidget.cpp.

void QgsVariableEditorWidget::scopeChanged ( )
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.

Parameters
contextexpression context
See also
context()

Definition at line 101 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.

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

Definition at line 114 of file qgsvariableeditorwidget.cpp.

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 97 of file qgsvariableeditorwidget.h.

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 106 of file qgsvariableeditorwidget.h.

void QgsVariableEditorWidget::showEvent ( QShowEvent *  event)
overrideprotected

Definition at line 77 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 134 of file qgsvariableeditorwidget.cpp.

Property Documentation

QString QgsVariableEditorWidget::settingGroup
readwrite

Definition at line 46 of file qgsvariableeditorwidget.h.


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