QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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.
 
 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 QgsExpressionoperator-> () 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.
 

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.

Definition at line 38 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.

Definition at line 38 of file qgsoptionalexpression.cpp.

◆ writeXml()

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.


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