QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
An expression with an additional enabled flag. More...
#include <qgsoptionalexpression.h>
Public Member Functions | |
QgsOptionalExpression ()=default | |
Construct a default optional expression. | |
QgsOptionalExpression (const QgsExpression &expression) | |
Construct an optional expression with the provided expression. | |
QgsOptionalExpression (const QgsExpression &expression, bool enabled) | |
Construct an optional expression with the provided expression and enabled state. | |
void | readXml (const QDomElement &element) |
Read the optional expression from the provided QDomElement. | |
void | writeXml (QDomElement &element) const |
Save the optional expression to the provided QDomElement. | |
Public Member Functions inherited from QgsOptional< QgsExpression > | |
QgsOptional ()=default | |
A QgsOptional is disabled by default if default constructed. | |
QgsOptional (const QgsExpression &data) | |
A QgsOptional is enabled by default if constructed with payload. | |
QgsOptional (const QgsExpression &data, bool enabled) | |
A QgsOptional constructed with enabled status and data. | |
QgsExpression | data () const |
Access the payload data. | |
bool | enabled () const |
Check if this optional is enabled. | |
operator bool () const | |
Boolean operator. | |
const QgsExpression * | operator-> () const |
Access the payload data. | |
bool | operator== (const QgsOptional< QgsExpression > &other) const |
Compare this QgsOptional to another one. | |
void | setData (const QgsExpression &data) |
Set the payload data. | |
void | setEnabled (bool enabled) |
Set if this optional is enabled. | |
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 38 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 | ) | const |
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.