QGIS API Documentation  3.0.2-Girona (307d082)
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::QgsVariableEditorWidget ( QWidget *  parent = nullptr)

Constructor for QgsVariableEditorWidget.

Parameters
parentparent widget

Definition at line 37 of file qgsvariableeditorwidget.cpp.

◆ ~QgsVariableEditorWidget()

QgsVariableEditorWidget::~QgsVariableEditorWidget ( )
override

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

◆ editableScope()

QgsExpressionContextScope * QgsVariableEditorWidget::editableScope ( ) const

Returns the current editable scope for the widget.

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

Definition at line 126 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 108 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 102 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 115 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 97 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 106 of file qgsvariableeditorwidget.h.

◆ showEvent()

void QgsVariableEditorWidget::showEvent ( QShowEvent *  event)
overrideprotected

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

Property Documentation

◆ settingGroup

QString QgsVariableEditorWidget::settingGroup
readwrite

Definition at line 46 of file qgsvariableeditorwidget.h.


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