mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
397 lines
13 KiB
Plaintext
397 lines
13 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/expression/qgsexpressioncontextutils.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsExpressionContextUtils
|
|
{
|
|
%Docstring(signature="appended")
|
|
Contains utilities for working with :py:class:`QgsExpressionContext`
|
|
objects, including methods for creating scopes for specific uses (e.g.,
|
|
project scopes, layer scopes).
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsexpressioncontextutils.h"
|
|
%End
|
|
public:
|
|
|
|
static QgsExpressionContextScope *globalScope() /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to
|
|
the global QGIS context. For instance, QGIS version numbers and
|
|
variables specified through QGIS options.
|
|
|
|
.. seealso:: :py:func:`setGlobalVariable`
|
|
%End
|
|
|
|
static QgsExpressionContextScope *formScope( const QgsFeature &formFeature = QgsFeature( ), const QString &formMode = QString() ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains functions and variables from the
|
|
current attribute form/table ``formFeature``. The variables and values
|
|
in this scope will reflect the current state of the form/row being
|
|
edited. The ``formMode`` (SingleEditMode etc.) is passed as text
|
|
|
|
.. versionadded:: 3.2
|
|
%End
|
|
|
|
static QgsExpressionContextScope *parentFormScope( const QgsFeature &formFeature = QgsFeature( ), const QString &formMode = QString() ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains functions and variables from the
|
|
current parent attribute form/table ``formFeature``. The variables and
|
|
values in this scope will reflect the current state of the parent
|
|
form/row being edited. The ``formMode`` (SingleEditMode etc.) is passed
|
|
as text
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
static void setGlobalVariable( const QString &name, const QVariant &value );
|
|
%Docstring
|
|
Sets a global context variable. This variable will be contained within
|
|
scopes retrieved via :py:func:`~QgsExpressionContextUtils.globalScope`.
|
|
|
|
:param name: variable name
|
|
:param value: variable value
|
|
|
|
.. seealso:: :py:func:`setGlobalVariable`
|
|
|
|
.. seealso:: :py:func:`globalScope`
|
|
|
|
.. seealso:: :py:func:`removeGlobalVariable`
|
|
%End
|
|
|
|
static void setGlobalVariables( const QVariantMap &variables );
|
|
%Docstring
|
|
Sets all global context variables. Existing global variables will be
|
|
removed and replaced with the variables specified.
|
|
|
|
:param variables: new set of global variables
|
|
|
|
.. seealso:: :py:func:`setGlobalVariable`
|
|
|
|
.. seealso:: :py:func:`globalScope`
|
|
|
|
.. seealso:: :py:func:`removeGlobalVariable`
|
|
%End
|
|
|
|
static void removeGlobalVariable( const QString &name );
|
|
%Docstring
|
|
Remove a global context variable.
|
|
|
|
:param name: variable name
|
|
|
|
.. seealso:: :py:func:`setGlobalVariable`
|
|
|
|
.. seealso:: :py:func:`setGlobalVariables`
|
|
|
|
.. seealso:: :py:func:`globalScope`
|
|
%End
|
|
|
|
static QgsExpressionContextScope *projectScope( const QgsProject *project ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
QGIS project. For instance, project path and title, and variables
|
|
specified through the project properties.
|
|
|
|
:param project: What project to use
|
|
|
|
.. seealso:: :py:func:`setProjectVariable`
|
|
%End
|
|
|
|
static void setProjectVariable( QgsProject *project, const QString &name, const QVariant &value );
|
|
%Docstring
|
|
Sets a project context variable. This variable will be contained within
|
|
scopes retrieved via :py:func:`~QgsExpressionContextUtils.projectScope`.
|
|
|
|
:param project: Project to apply changes to
|
|
:param name: variable name
|
|
:param value: variable value
|
|
|
|
.. seealso:: :py:func:`setProjectVariables`
|
|
|
|
.. seealso:: :py:func:`removeProjectVariable`
|
|
|
|
.. seealso:: :py:func:`projectScope`
|
|
%End
|
|
|
|
static void setProjectVariables( QgsProject *project, const QVariantMap &variables );
|
|
%Docstring
|
|
Sets all project context variables. Existing project variables will be
|
|
removed and replaced with the variables specified.
|
|
|
|
:param project: Project to apply changes to
|
|
:param variables: new set of project variables
|
|
|
|
.. seealso:: :py:func:`setProjectVariable`
|
|
|
|
.. seealso:: :py:func:`removeProjectVariable`
|
|
|
|
.. seealso:: :py:func:`projectScope`
|
|
%End
|
|
|
|
static void removeProjectVariable( QgsProject *project, const QString &name );
|
|
%Docstring
|
|
Remove project context variable.
|
|
|
|
:param project: Project to apply changes to
|
|
:param name: variable name
|
|
|
|
.. seealso:: :py:func:`setProjectVariable`
|
|
|
|
.. seealso:: :py:func:`setProjectVariables`
|
|
|
|
.. seealso:: :py:func:`projectScope`
|
|
%End
|
|
|
|
static QgsExpressionContextScope *layerScope( const QgsMapLayer *layer ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
:py:class:`QgsMapLayer`. For instance, layer name, id and fields.
|
|
%End
|
|
|
|
static QList<QgsExpressionContextScope *> globalProjectLayerScopes( const QgsMapLayer *layer ) /Factory/;
|
|
%Docstring
|
|
Creates a list of three scopes: global, layer's project and layer.
|
|
%End
|
|
|
|
static void setLayerVariable( QgsMapLayer *layer, const QString &name, const QVariant &value );
|
|
%Docstring
|
|
Sets a layer context variable. This variable will be contained within
|
|
scopes retrieved via :py:func:`~QgsExpressionContextUtils.layerScope`.
|
|
|
|
:param layer: map layer
|
|
:param name: variable name
|
|
:param value: variable value
|
|
|
|
.. seealso:: :py:func:`setLayerVariables`
|
|
|
|
.. seealso:: :py:func:`layerScope`
|
|
%End
|
|
|
|
static void setLayerVariables( QgsMapLayer *layer, const QVariantMap &variables );
|
|
%Docstring
|
|
Sets all layer context variables. Existing layer variables will be
|
|
removed and replaced with the variables specified.
|
|
|
|
:param layer: map layer
|
|
:param variables: new set of layer variables
|
|
|
|
.. seealso:: :py:func:`setLayerVariable`
|
|
|
|
.. seealso:: :py:func:`layerScope`
|
|
%End
|
|
|
|
static QgsExpressionContextScope *mapSettingsScope( const QgsMapSettings &mapSettings ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
:py:class:`QgsMapSettings` object. For instance, map scale and rotation.
|
|
%End
|
|
|
|
static QgsExpressionContextScope *mapToolCaptureScope( const QList<QgsPointLocator::Match> &matches ) /Factory/;
|
|
%Docstring
|
|
Sets the expression context variables which are available for
|
|
expressions triggered by a map tool capture like add feature.
|
|
%End
|
|
|
|
static QgsExpressionContextScope *mapLayerPositionScope( const QgsPointXY &position ) /Factory/;
|
|
%Docstring
|
|
Sets the expression context variables which are available for
|
|
expressions triggered by moving the mouse over a feature of the
|
|
currently selected layer.
|
|
|
|
:param position: map coordinates of the current pointer position in the
|
|
CRS of the layer which triggered the action.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
static QgsExpressionContextScope *updateSymbolScope( const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope = 0 );
|
|
%Docstring
|
|
Updates a symbol scope related to a :py:class:`QgsSymbol` to an
|
|
expression context.
|
|
|
|
:param symbol: symbol to extract properties from
|
|
:param symbolScope: pointer to an existing scope to update
|
|
%End
|
|
|
|
static QgsExpressionContextScope *layoutScope( const QgsLayout *layout ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
:py:class:`QgsLayout` ``layout``. For instance, number of pages and page
|
|
sizes.
|
|
%End
|
|
|
|
static void setLayoutVariable( QgsLayout *layout, const QString &name, const QVariant &value );
|
|
%Docstring
|
|
Sets a layout context variable. This variable will be contained within
|
|
scopes retrieved via :py:func:`~QgsExpressionContextUtils.layoutScope`.
|
|
|
|
:param layout: target layout
|
|
:param name: variable name
|
|
:param value: variable value
|
|
|
|
.. seealso:: :py:func:`setLayoutVariables`
|
|
|
|
.. seealso:: :py:func:`layoutScope`
|
|
%End
|
|
|
|
static void setLayoutVariables( QgsLayout *layout, const QVariantMap &variables );
|
|
%Docstring
|
|
Sets all layout context variables. Existing layout variables will be
|
|
removed and replaced with the variables specified.
|
|
|
|
:param layout: target layout
|
|
:param variables: new set of layer variables
|
|
|
|
.. seealso:: :py:func:`setLayoutVariable`
|
|
|
|
.. seealso:: :py:func:`layoutScope`
|
|
%End
|
|
|
|
static QgsExpressionContextScope *atlasScope( const QgsLayoutAtlas *atlas ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
:py:class:`QgsLayoutAtlas`. For instance, current page name and number.
|
|
|
|
:param atlas: source atlas. If ``None``, a set of default atlas
|
|
variables will be added to the scope.
|
|
%End
|
|
|
|
static QgsExpressionContextScope *layoutItemScope( const QgsLayoutItem *item ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
:py:class:`QgsLayoutItem`. For instance, item size and position.
|
|
|
|
.. seealso:: :py:func:`setLayoutItemVariable`
|
|
|
|
.. seealso:: :py:func:`setLayoutItemVariables`
|
|
%End
|
|
|
|
static void setLayoutItemVariable( QgsLayoutItem *item, const QString &name, const QVariant &value );
|
|
%Docstring
|
|
Sets a layout ``item`` context variable, with the given ``name`` and
|
|
``value``. This variable will be contained within scopes retrieved via
|
|
:py:func:`~QgsExpressionContextUtils.layoutItemScope`.
|
|
|
|
.. seealso:: :py:func:`setLayoutItemVariables`
|
|
|
|
.. seealso:: :py:func:`layoutItemScope`
|
|
%End
|
|
|
|
static void setLayoutItemVariables( QgsLayoutItem *item, const QVariantMap &variables );
|
|
%Docstring
|
|
Sets all layout item context variables for an ``item``. Existing
|
|
variables will be removed and replaced with the ``variables`` specified.
|
|
|
|
.. seealso:: :py:func:`setLayoutItemVariable`
|
|
|
|
.. seealso:: :py:func:`layoutItemScope`
|
|
%End
|
|
|
|
static QgsExpressionContextScope *multiFrameScope( const QgsLayoutMultiFrame *frame ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
:py:class:`QgsLayoutMultiFrame`.
|
|
|
|
.. seealso:: :py:func:`setLayoutMultiFrameVariable`
|
|
|
|
.. seealso:: :py:func:`setLayoutMultiFrameVariables`
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
static void setLayoutMultiFrameVariable( QgsLayoutMultiFrame *frame, const QString &name, const QVariant &value );
|
|
%Docstring
|
|
Sets a layout multi ``frame`` context variable, with the given ``name``
|
|
and ``value``. This variable will be contained within scopes retrieved
|
|
via :py:func:`~QgsExpressionContextUtils.multiFrameScope`.
|
|
|
|
.. seealso:: :py:func:`setLayoutItemVariables`
|
|
|
|
.. seealso:: :py:func:`multiFrameScope`
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
static void setLayoutMultiFrameVariables( QgsLayoutMultiFrame *frame, const QVariantMap &variables );
|
|
%Docstring
|
|
Sets all layout multiframe context variables for an ``frame``. Existing
|
|
variables will be removed and replaced with the ``variables`` specified.
|
|
|
|
.. seealso:: :py:func:`setLayoutMultiFrameVariable`
|
|
|
|
.. seealso:: :py:func:`multiFrameScope`
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
static QgsExpressionContext createFeatureBasedContext( const QgsFeature &feature, const QgsFields &fields );
|
|
%Docstring
|
|
Helper function for creating an expression context which contains just a
|
|
feature and fields collection. Generally this method should not be used
|
|
as the created context does not include standard scopes such as the
|
|
global and project scopes.
|
|
%End
|
|
|
|
static QgsExpressionContextScope *processingAlgorithmScope( const QgsProcessingAlgorithm *algorithm, const QVariantMap ¶meters, QgsProcessingContext &context ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
processing ``algorithm``, when used with the specified ``parameters``
|
|
and ``context``. For instance, algorithm name and parameter functions.
|
|
|
|
.. seealso:: :py:func:`processingModelAlgorithmScope`
|
|
%End
|
|
|
|
static QgsExpressionContextScope *processingModelAlgorithmScope( const QgsProcessingModelAlgorithm *model, const QVariantMap ¶meters, QgsProcessingContext &context ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to a
|
|
processing ``model`` algorithm, when used with the specified
|
|
``parameters`` and ``context``. For instance, model name and path
|
|
variables.
|
|
|
|
.. versionadded:: 3.6
|
|
%End
|
|
|
|
static QgsExpressionContextScope *notificationScope( const QString &message = QString() ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains variables and functions relating to
|
|
provider notifications
|
|
|
|
:param message: the notification message
|
|
%End
|
|
|
|
static void registerContextFunctions();
|
|
%Docstring
|
|
Registers all known core functions provided by
|
|
:py:class:`QgsExpressionContextScope` objects.
|
|
%End
|
|
|
|
static QgsExpressionContextScope *meshExpressionScope( QgsMesh::ElementType elementType ) /Factory/;
|
|
%Docstring
|
|
Creates a new scope which contains functions relating to mesh layer
|
|
element ``elementType``
|
|
|
|
.. versionadded:: 3.22
|
|
%End
|
|
|
|
public:
|
|
};
|
|
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/expression/qgsexpressioncontextutils.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|