QGIS API Documentation
3.6.0-Noosa (5873452)
|
An expression with an additional enabled flag. More...
#include <qgsoptionalexpression.h>
Public Member Functions | |
QgsOptionalExpression ()=default | |
Construct a default optional expression. More... | |
QgsOptionalExpression (const QgsExpression &expression) | |
Construct an optional expression with the provided expression. More... | |
QgsOptionalExpression (const QgsExpression &expression, bool enabled) | |
Construct an optional expression with the provided expression and enabled state. More... | |
void | readXml (const QDomElement &element) |
Read the optional expression from the provided QDomElement. More... | |
void | writeXml (QDomElement &element) |
Save the optional expression to the provided QDomElement. More... | |
Public Member Functions inherited from QgsOptional< QgsExpression > | |
QgsOptional ()=default | |
A QgsOptional is disabled by default if default constructed. More... | |
QgsOptional (const QgsExpression &data) | |
A QgsOptional is enabled by default if constructed with payload. More... | |
QgsOptional (const QgsExpression &data, bool enabled) | |
A QgsOptional constructed with enabled status and data. More... | |
QgsExpression | data () const |
Access the payload data. More... | |
bool | enabled () const |
Check if this optional is enabled. More... | |
operator bool () const | |
Boolean operator. More... | |
const QgsExpression * | operator-> () const |
Access the payload data. More... | |
bool | operator== (const QgsOptional< QgsExpression > &other) const |
Compare this QgsOptional to another one. More... | |
void | setData (const QgsExpression &data) |
Set the payload data. More... | |
void | setEnabled (bool enabled) |
Set if this optional is enabled. More... | |
An expression with an additional enabled flag.
This can be used for configuration options where an expression can be enabled or disabled but when disabled it shouldn't lose it's information for the case it gets re-enabled later on and a user shouldn't be force to redo the configuration.
Definition at line 39 of file qgsoptionalexpression.h.
|
default |
Construct a default optional expression.
It will be disabled and with an empty expression.
QgsOptionalExpression::QgsOptionalExpression | ( | const QgsExpression & | expression | ) |
Construct an optional expression with the provided expression.
It will be enabled.
Definition at line 19 of file qgsoptionalexpression.cpp.
QgsOptionalExpression::QgsOptionalExpression | ( | const QgsExpression & | expression, |
bool | enabled | ||
) |
Construct an optional expression with the provided expression and enabled state.
Definition at line 25 of file qgsoptionalexpression.cpp.
void QgsOptionalExpression::readXml | ( | const QDomElement & | element | ) |
Read the optional expression from the provided QDomElement.
Definition at line 38 of file qgsoptionalexpression.cpp.
void QgsOptionalExpression::writeXml | ( | QDomElement & | element | ) |
Save the optional expression to the provided QDomElement.
The caller is responsible to pass an empty QDomElement and to append it to a parent element.
Definition at line 31 of file qgsoptionalexpression.cpp.