QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
Conditional styling for a rule. More...
#include <qgsconditionalstyle.h>
Public Member Functions | |
QgsConditionalStyle () | |
QgsConditionalStyle (const QgsConditionalStyle &other) | |
QgsConditionalStyle (const QString &rule) | |
~QgsConditionalStyle () | |
QColor | backgroundColor () const |
The background color for style. | |
QString | displayText () const |
The name of the style. | |
QFont | font () const |
The font for the style. | |
QPixmap | icon () const |
The icon set for style generated from the set symbol. | |
bool | isValid () const |
isValid Check if this rule is valid. | |
bool | matches (const QVariant &value, QgsExpressionContext &context) const |
Check if the rule matches using the given value and feature. | |
QString | name () const |
The name of the style. | |
bool | operator!= (const QgsConditionalStyle &other) const |
QgsConditionalStyle & | operator= (const QgsConditionalStyle &other) |
bool | operator== (const QgsConditionalStyle &other) const |
bool | readXml (const QDomNode &node, const QgsReadWriteContext &context) |
Reads vector conditional style specific state from layer Dom node. | |
QPixmap | renderPreview (const QSize &size=QSize()) const |
Render a preview icon of the rule, at the specified size. | |
QString | rule () const |
The condition rule set for the style. | |
void | setBackgroundColor (const QColor &value) |
Set the background color for the style. | |
void | setFont (const QFont &value) |
Set the font for the style. | |
void | setName (const QString &value) |
Set the name of the style. | |
void | setRule (const QString &value) |
Set the rule for the style. | |
void | setSymbol (QgsSymbol *value) |
Set the icon for the style. | |
void | setTextColor (const QColor &value) |
Set the text color for the style. | |
QgsSymbol * | symbol () const |
The symbol used to generate the icon for the style. | |
QColor | textColor () const |
The text color set for style. | |
bool | validBackgroundColor () const |
Check if the background color is valid for render. | |
bool | validTextColor () const |
Check if the text color is valid for render. | |
bool | writeXml (QDomNode &node, QDomDocument &doc, const QgsReadWriteContext &context) const |
Write vector conditional style specific state from layer Dom node. | |
Static Public Member Functions | |
static QgsConditionalStyle | compressStyles (const QList< QgsConditionalStyle > &styles) |
Compress a list of styles into a single style. | |
static QgsConditionalStyle | matchingConditionalStyle (const QList< QgsConditionalStyle > &styles, const QVariant &value, QgsExpressionContext &context) |
Find and return the matching style for the value and feature. | |
static QList< QgsConditionalStyle > | matchingConditionalStyles (const QList< QgsConditionalStyle > &styles, const QVariant &value, QgsExpressionContext &context) |
Find and return the matching styles for the value and feature. | |
Conditional styling for a rule.
Definition at line 131 of file qgsconditionalstyle.h.
QgsConditionalStyle::QgsConditionalStyle | ( | ) |
Definition at line 169 of file qgsconditionalstyle.cpp.
QgsConditionalStyle::QgsConditionalStyle | ( | const QgsConditionalStyle & | other | ) |
Definition at line 179 of file qgsconditionalstyle.cpp.
QgsConditionalStyle::QgsConditionalStyle | ( | const QString & | rule | ) |
Definition at line 172 of file qgsconditionalstyle.cpp.
|
default |
|
inline |
The background color for style.
Definition at line 236 of file qgsconditionalstyle.h.
|
static |
Compress a list of styles into a single style.
This can be used to stack the elements of the styles. The font of the last style is used in the output.
styles | The list of styles to compress down |
Definition at line 306 of file qgsconditionalstyle.cpp.
QString QgsConditionalStyle::displayText | ( | ) | const |
The name of the style.
Definition at line 212 of file qgsconditionalstyle.cpp.
|
inline |
The font for the style.
Definition at line 249 of file qgsconditionalstyle.h.
|
inline |
The icon set for style generated from the set symbol.
Definition at line 211 of file qgsconditionalstyle.h.
|
inline |
isValid Check if this rule is valid.
A valid rule has one or more properties set.
true
if the rule is valid. Definition at line 263 of file qgsconditionalstyle.h.
bool QgsConditionalStyle::matches | ( | const QVariant & | value, |
QgsExpressionContext & | context | ||
) | const |
Check if the rule matches using the given value and feature.
value | The current value being checked. The "value" variable from the context is replaced with this value. |
context | Expression context for evaluating rule expression |
true
of the rule matches against the given feature Definition at line 234 of file qgsconditionalstyle.cpp.
|
static |
Find and return the matching style for the value and feature.
If no match is found a invalid QgsConditionalStyle is return.
Definition at line 295 of file qgsconditionalstyle.cpp.
|
static |
Find and return the matching styles for the value and feature.
If no match is found a invalid QgsConditionalStyle is return.
Definition at line 283 of file qgsconditionalstyle.cpp.
|
inline |
The name of the style.
Definition at line 205 of file qgsconditionalstyle.h.
bool QgsConditionalStyle::operator!= | ( | const QgsConditionalStyle & | other | ) | const |
Definition at line 363 of file qgsconditionalstyle.cpp.
QgsConditionalStyle & QgsConditionalStyle::operator= | ( | const QgsConditionalStyle & | other | ) |
Definition at line 192 of file qgsconditionalstyle.cpp.
bool QgsConditionalStyle::operator== | ( | const QgsConditionalStyle & | other | ) | const |
Definition at line 351 of file qgsconditionalstyle.cpp.
bool QgsConditionalStyle::readXml | ( | const QDomNode & | node, |
const QgsReadWriteContext & | context | ||
) |
Reads vector conditional style specific state from layer Dom node.
Definition at line 368 of file qgsconditionalstyle.cpp.
QPixmap QgsConditionalStyle::renderPreview | ( | const QSize & | size = QSize() | ) | const |
Render a preview icon of the rule, at the specified size.
If size is not specified, a default size will be used.
Definition at line 241 of file qgsconditionalstyle.cpp.
|
inline |
The condition rule set for the style.
Rule may contain variable @value to represent the current value
Definition at line 256 of file qgsconditionalstyle.h.
|
inline |
Set the background color for the style.
value | QColor for background color |
Definition at line 175 of file qgsconditionalstyle.h.
|
inline |
Set the font for the style.
value | QFont to be used for text |
Definition at line 187 of file qgsconditionalstyle.h.
|
inline |
Set the name of the style.
Names are optional but handy for display
value | The name given to the style |
Definition at line 162 of file qgsconditionalstyle.h.
|
inline |
Set the rule for the style.
Rules should be of QgsExpression syntax. Special value of @value is replaced at run time with the check value
value | The QgsExpression style rule to use for this style |
Definition at line 169 of file qgsconditionalstyle.h.
void QgsConditionalStyle::setSymbol | ( | QgsSymbol * | value | ) |
Set the icon for the style.
Icons are generated from symbols
value | QgsSymbol to be used when generating the icon |
Definition at line 220 of file qgsconditionalstyle.cpp.
|
inline |
Set the text color for the style.
value | QColor for text color |
Definition at line 181 of file qgsconditionalstyle.h.
|
inline |
The symbol used to generate the icon for the style.
Definition at line 217 of file qgsconditionalstyle.h.
|
inline |
The text color set for style.
Definition at line 223 of file qgsconditionalstyle.h.
bool QgsConditionalStyle::validBackgroundColor | ( | ) | const |
Check if the background color is valid for render.
Valid colors are non invalid QColors and a color with a > 0 alpha
true
of the color set for background is valid. Definition at line 273 of file qgsconditionalstyle.cpp.
bool QgsConditionalStyle::validTextColor | ( | ) | const |
Check if the text color is valid for render.
Valid colors are non invalid QColors and a color with a > 0 alpha
true
of the color set for text is valid. Definition at line 278 of file qgsconditionalstyle.cpp.
bool QgsConditionalStyle::writeXml | ( | QDomNode & | node, |
QDomDocument & | doc, | ||
const QgsReadWriteContext & | context | ||
) | const |
Write vector conditional style specific state from layer Dom node.
Definition at line 325 of file qgsconditionalstyle.cpp.