QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsdefaultvalue.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdefaultvalue.cpp
3
4
---------------------
5
begin : 19.9.2017
6
copyright : (C) 2017 by Matthias Kuhn
7
email : matthias@opengis.ch
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 "
qgsdefaultvalue.h
"
17
18
#include "moc_qgsdefaultvalue.cpp"
19
20
QgsDefaultValue::QgsDefaultValue
(
const
QString &
expression
,
bool
applyOnUpdate
)
21
: mExpression(
expression
)
22
, mApplyOnUpdate(
applyOnUpdate
)
23
{}
24
25
bool
QgsDefaultValue::operator==
(
const
QgsDefaultValue
&other )
const
26
{
27
return
mExpression == other.mExpression && mApplyOnUpdate == other.mApplyOnUpdate;
28
}
29
30
QString
QgsDefaultValue::expression
()
const
31
{
32
return
mExpression;
33
}
34
35
void
QgsDefaultValue::setExpression
(
const
QString &
expression
)
36
{
37
mExpression =
expression
;
38
}
39
40
bool
QgsDefaultValue::applyOnUpdate
()
const
41
{
42
return
mApplyOnUpdate;
43
}
44
45
void
QgsDefaultValue::setApplyOnUpdate
(
bool
applyOnUpdate
)
46
{
47
mApplyOnUpdate =
applyOnUpdate
;
48
}
49
50
bool
QgsDefaultValue::isValid
()
const
51
{
52
return
!mExpression.isEmpty();
53
}
54
55
QgsDefaultValue::operator bool()
const
56
{
57
return
!mExpression.isEmpty();
58
}
QgsDefaultValue::QgsDefaultValue
QgsDefaultValue(const QString &expression=QString(), bool applyOnUpdate=false)
Create a new default value with the given expression and applyOnUpdate flag.
Definition
qgsdefaultvalue.cpp:20
QgsDefaultValue::expression
QString expression
Definition
qgsdefaultvalue.h:52
QgsDefaultValue::setApplyOnUpdate
void setApplyOnUpdate(bool applyOnUpdate)
The applyOnUpdate flag determines if this expression should also be applied when a feature is updated...
Definition
qgsdefaultvalue.cpp:45
QgsDefaultValue::isValid
bool isValid() const
Returns if this default value should be applied.
Definition
qgsdefaultvalue.cpp:50
QgsDefaultValue::applyOnUpdate
bool applyOnUpdate
Definition
qgsdefaultvalue.h:53
QgsDefaultValue::operator==
bool operator==(const QgsDefaultValue &other) const
Definition
qgsdefaultvalue.cpp:25
QgsDefaultValue::setExpression
void setExpression(const QString &expression)
The expression will be evaluated whenever a default value needs to be calculated for a field.
Definition
qgsdefaultvalue.cpp:35
qgsdefaultvalue.h
Generated on
for QGIS API Documentation by
1.17.0