QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsactionscope.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsactionscope.cpp - QgsActionScope
3 
4  ---------------------
5  begin : 1.11.2016
6  copyright : (C) 2016 by Matthias Kuhn
7  email : [email protected]
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #include "qgsactionscope.h"
17 #include "qgsexpressioncontext.h"
18 
20  : mExpressionContextScope( nullptr )
21 {
22 }
23 
24 QgsActionScope::QgsActionScope( const QString &id, const QString &title, const QString &description, const QgsExpressionContextScope &expressionContextScope )
25  : mId( id )
26  , mTitle( title )
27  , mDescription( description )
28  , mExpressionContextScope( expressionContextScope )
29 {
30 }
31 
32 bool QgsActionScope::operator==( const QgsActionScope &other ) const
33 {
34  return other.mId == mId;
35 }
36 
38 {
39  return mExpressionContextScope;
40 }
41 
43 {
44  mExpressionContextScope = expressionContextScope;
45 }
46 
47 QString QgsActionScope::id() const
48 {
49  return mId;
50 }
51 
52 void QgsActionScope::setId( const QString &name )
53 {
54  mId = name;
55 }
56 
58 {
59  return !mId.isNull();
60 }
61 
62 QString QgsActionScope::title() const
63 {
64  return mTitle;
65 }
66 
67 void QgsActionScope::setTitle( const QString &title )
68 {
69  mTitle = title;
70 }
71 
73 {
74  return mDescription;
75 }
76 
77 void QgsActionScope::setDescription( const QString &description )
78 {
79  mDescription = description;
80 }
81 
82 uint qHash( const QgsActionScope &key, uint seed )
83 {
84  uint hash = seed;
85 
86  hash |= qHash( key.expressionContextScope().variableNames().join( ',' ), seed );
87  hash |= qHash( key.id(), seed );
88 
89  return hash;
90 }
QgsActionScope::QgsActionScope
QgsActionScope()
Creates a new invalid action scope.
Definition: qgsactionscope.cpp:19
QgsActionScope::title
QString title() const
The title is a human readable and translated string that will be presented to the user in the propert...
Definition: qgsactionscope.cpp:62
QgsActionScope::id
QString id() const
A unique identifier for this action scope.
Definition: qgsactionscope.cpp:47
QgsActionScope::setExpressionContextScope
void setExpressionContextScope(const QgsExpressionContextScope &expressionContextScope)
An expression scope may offer additional variables for an action scope.
Definition: qgsactionscope.cpp:42
QgsExpressionContextScope::variableNames
QStringList variableNames() const
Returns a list of variable names contained within the scope.
Definition: qgsexpressioncontext.cpp:113
qgsactionscope.h
QgsActionScope::setDescription
void setDescription(const QString &description)
The description should be a longer description of where actions in this scope are available.
Definition: qgsactionscope.cpp:77
qgsexpressioncontext.h
QgsActionScope::isValid
bool isValid() const
Returns if this scope is valid.
Definition: qgsactionscope.cpp:57
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext....
Definition: qgsexpressioncontext.h:111
QgsActionScope
Definition: qgsactionscope.h:46
QgsActionScope::description
QString description() const
The description should be a longer description of where actions in this scope are available.
Definition: qgsactionscope.cpp:72
QgsActionScope::operator==
bool operator==(const QgsActionScope &other) const
Compares two action scopes.
Definition: qgsactionscope.cpp:32
QgsActionScope::expressionContextScope
QgsExpressionContextScope expressionContextScope() const
An expression scope may offer additional variables for an action scope.
Definition: qgsactionscope.cpp:37
QgsActionScope::setTitle
void setTitle(const QString &title)
The title is a human readable and translated string that will be presented to the user in the propert...
Definition: qgsactionscope.cpp:67
qHash
uint qHash(const QgsActionScope &key, uint seed)
Definition: qgsactionscope.cpp:82
QgsActionScope::setId
void setId(const QString &id)
A unique identifier for this action scope.
Definition: qgsactionscope.cpp:52