QGIS API Documentation  3.6.0-Noosa (5873452)
Public Member Functions | List of all members
QgsOptionalExpression Class Reference

An expression with an additional enabled flag. More...

#include <qgsoptionalexpression.h>

Inheritance diagram for QgsOptionalExpression:
Inheritance graph
[legend]

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 QgsExpressionoperator-> () 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...
 

Detailed Description

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.

Since
QGIS 2.18

Definition at line 39 of file qgsoptionalexpression.h.

Constructor & Destructor Documentation

◆ QgsOptionalExpression() [1/3]

QgsOptionalExpression::QgsOptionalExpression ( )
default

Construct a default optional expression.

It will be disabled and with an empty expression.

◆ QgsOptionalExpression() [2/3]

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() [3/3]

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.

Member Function Documentation

◆ readXml()

void QgsOptionalExpression::readXml ( const QDomElement &  element)

Read the optional expression from the provided QDomElement.

Since
QGIS 2.18

Definition at line 38 of file qgsoptionalexpression.cpp.

◆ writeXml()

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.

Since
QGIS 2.18

Definition at line 31 of file qgsoptionalexpression.cpp.


The documentation for this class was generated from the following files: