Skip to content

Class ExpressionVariableModel

ClassList > ExpressionVariableModel

Inherits the following classes: QStandardItemModel

Public Types

Type Name
enum Roles
enum VariableScope

Public Properties

Type Name
property QgsProject * currentProject

Public Signals

Type Name
signal void currentProjectChanged

Public Functions

Type Name
ExpressionVariableModel (QObject * parent=nullptr)
Q_INVOKABLE int addVariable (VariableScope scope, const QString & name, const QString & value)
QgsProject * currentProject () const
Q_INVOKABLE void reloadVariables ()
Q_INVOKABLE void removeVariable (VariableScope scope, const QString & name)
QHash< int, QByteArray > roleNames () override const
Q_INVOKABLE void save ()
void setCurrentProject (QgsProject * project)
bool setData (const QModelIndex & index, const QVariant & value, int role) override

Public Types Documentation

enum Roles

enum ExpressionVariableModel::Roles {
    VariableEditableRole = Qt::EditRole,
    VariableNameRole = Qt::UserRole,
    VariableValueRole = Qt::UserRole + 1,
    VariableScopeRole = Qt::UserRole + 2,
    VariableOriginalNameRole = Qt::UserRole + 3
};

enum VariableScope

enum ExpressionVariableModel::VariableScope {
    GlobalScope,
    ProjectScope
};

Public Properties Documentation

property currentProject [1/2]

QgsProject * ExpressionVariableModel::currentProject;

Public Signals Documentation

signal currentProjectChanged

void ExpressionVariableModel::currentProjectChanged;

Public Functions Documentation

function ExpressionVariableModel

explicit ExpressionVariableModel::ExpressionVariableModel (
    QObject * parent=nullptr
) 

function addVariable

Q_INVOKABLE int ExpressionVariableModel::addVariable (
    VariableScope scope,
    const QString & name,
    const QString & value
) 

function currentProject [2/2]

QgsProject * ExpressionVariableModel::currentProject () const

Returns the current project used to retrieve variables from.


function reloadVariables

Q_INVOKABLE void ExpressionVariableModel::reloadVariables () 

function removeVariable

Q_INVOKABLE void ExpressionVariableModel::removeVariable (
    VariableScope scope,
    const QString & name
) 

function roleNames

QHash< int, QByteArray > ExpressionVariableModel::roleNames () override const

function save

Q_INVOKABLE void ExpressionVariableModel::save () 

function setCurrentProject

void ExpressionVariableModel::setCurrentProject (
    QgsProject * project
) 

Sets the project used to retrieve variables from.


function setData

bool ExpressionVariableModel::setData (
    const QModelIndex & index,
    const QVariant & value,
    int role
) override


The documentation for this class was generated from the following file src/core/expressionvariablemodel.h