QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgsvectorlayertoolscontext.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayertoolscontext.cpp
3 ------------------------
4 begin : May 2024
5 copyright : (C) 2024 by Mathieu Pellerin
6 email : mathieu at opengis dot ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
18
20 : mParentWidget( other.mParentWidget )
21 , mShowModal( other.mShowModal )
22 , mHideParent( other.mHideParent )
23{
24 if ( other.mAdditionalExpressionContextScope )
25 {
26 mAdditionalExpressionContextScope.reset( new QgsExpressionContextScope( *other.mAdditionalExpressionContextScope ) );
27 }
28 if ( other.mExpressionContext )
29 {
30 mExpressionContext.reset( new QgsExpressionContext( *other.mExpressionContext ) );
31 }
32}
33
35{
36 mParentWidget = other.mParentWidget;
37 mShowModal = other.mShowModal;
38 mHideParent = other.mHideParent;
39 if ( other.mAdditionalExpressionContextScope )
40 {
41 mAdditionalExpressionContextScope.reset( new QgsExpressionContextScope( *other.mAdditionalExpressionContextScope ) );
42 }
43 if ( other.mExpressionContext )
44 {
45 mExpressionContext.reset( new QgsExpressionContext( *other.mExpressionContext ) );
46 }
47 else
48 {
49 mExpressionContext.reset();
50 }
51 return *this;
52}
53
55{
56 if ( context )
57 mExpressionContext.reset( new QgsExpressionContext( *context ) );
58 else
59 mExpressionContext.reset();
60}
61
63{
64 return mExpressionContext.get();
65}
66
68{
69 if ( scope )
70 mAdditionalExpressionContextScope.reset( new QgsExpressionContextScope( *scope ) );
71 else
72 mAdditionalExpressionContextScope.reset();
73}
74
76{
77 return mAdditionalExpressionContextScope.get();
78}
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Contains settings which reflect the context in which vector layer tool operations should consider.
QgsVectorLayerToolsContext()=default
const QgsExpressionContextScope * additionalExpressionContextScope() const
Returns an additional expression context scope to be made available when calculating expressions.
void setExpressionContext(const QgsExpressionContext *context)
Sets the optional expression context used by the vector layer tools.
QgsVectorLayerToolsContext & operator=(const QgsVectorLayerToolsContext &other)
QgsExpressionContext * expressionContext() const
Returns the optional expression context used by the vector layer tools.
void setAdditionalExpressionContextScope(const QgsExpressionContextScope *scope)
Sets an additional expression context scope to be made available when calculating expressions.