1
+ typedef QList<QgsConditionalStyle> QgsConditionalStyles;
2
+
3
+ /**
4
+ * @brief The QgsConditionalLayerStyles class holds conditional style information
5
+ * for a layer. This includes field styles and full row styles.
6
+ */
7
+ class QgsConditionalLayerStyles
8
+ {
9
+ %TypeHeaderCode
10
+ #include <qgsconditionalstyle.h>
11
+ %End
12
+ public:
13
+ QgsConditionalLayerStyles();
14
+
15
+ QList<QgsConditionalStyle> rowStyles();
16
+
17
+ /**
18
+ * @brief Set the conditional styles that apply to full rows of data in the attribute table.
19
+ * Each row will check be checked against each rule.
20
+ * @param styles The styles to assign to all the rows
21
+ * @note added in QGIS 2.12
22
+ */
23
+ void setRowStyles( QList<QgsConditionalStyle> styles );
24
+
25
+ /**
26
+ * @brief Set the conditional styles for the field UI properties.
27
+ * @param styles
28
+ */
29
+ void setFieldStyles( QString fieldName, QList<QgsConditionalStyle> styles );
30
+
31
+ /**
32
+ * @brief Returns the conditional styles set for the field UI properties
33
+ * @return A list of conditional styles that have been set.
34
+ */
35
+ QList<QgsConditionalStyle> fieldStyles( QString fieldName );
36
+
37
+ /** Reads field ui properties specific state from Dom node.
38
+ */
39
+ virtual bool readXml( const QDomNode& node );
40
+
41
+ /** Write field ui properties specific state from Dom node.
42
+ */
43
+ virtual bool writeXml( QDomNode & node, QDomDocument & doc ) const;
44
+ };
45
+
1
46
/** \class QgsConditionalStyle
2
47
* \ingroup core
3
48
* Conditional styling for a rule.
@@ -9,7 +54,9 @@ class QgsConditionalStyle
9
54
%End
10
55
public:
11
56
QgsConditionalStyle();
57
+ QgsConditionalStyle( const QgsConditionalStyle& other );
12
58
QgsConditionalStyle( QString rule );
59
+ ~QgsConditionalStyle();
13
60
14
61
/**
15
62
* @brief Check if the rule matches using the given value and feature
@@ -74,29 +121,43 @@ class QgsConditionalStyle
74
121
*/
75
122
QString name() const;
76
123
77
- /**
78
- * @brief The symbol used to generate the icon for the style
79
- * @return The QgsSymbolV2 used for the icon
80
- */
81
- QgsSymbolV2* symbol() const;
82
-
83
124
/**
84
125
* @brief The icon set for style generated from the set symbol
85
126
* @return A QPixmap that was set for the icon using the symbol
86
127
*/
87
128
QPixmap icon() const;
88
129
130
+ /**
131
+ * @brief The symbol used to generate the icon for the style
132
+ * @return The QgsSymbolV2 used for the icon
133
+ */
134
+ QgsSymbolV2* symbol() const;
135
+
89
136
/**
90
137
* @brief The text color set for style
91
138
* @return QColor for text color
92
139
*/
93
140
QColor textColor() const;
94
141
142
+ /**
143
+ * @brief Check if the text color is valid for render.
144
+ * Valid colors are non invalid QColors and a color with a > 0 alpha
145
+ * @return True of the color set for text is valid.
146
+ */
147
+ bool validTextColor() const;
148
+
95
149
/**
96
150
* @brief The background color for style
97
151
* @return QColor for background color
98
152
*/
99
153
QColor backgroundColor() const;
154
+
155
+ /**
156
+ * @brief Check if the background color is valid for render.
157
+ * Valid colors are non invalid QColors and a color with a > 0 alpha
158
+ * @return True of the color set for background is valid.
159
+ */
160
+ bool validBackgroundColor() const;
100
161
/**
101
162
* @brief The font for the style
102
163
* @return QFont for the style
@@ -124,7 +185,7 @@ class QgsConditionalStyle
124
185
* @return A condtional style that matches the value and feature.
125
186
* Check with QgsCondtionalStyle::isValid()
126
187
*/
127
- static QList<QgsConditionalStyle> matchingConditionalStyles( QList<QgsConditionalStyle> styles, QVariant value, QgsFeature* feature );
188
+ static QList<QgsConditionalStyle> matchingConditionalStyles( QList<QgsConditionalStyle> styles, QVariant value, QgsExpressionContext& context );
128
189
129
190
/**
130
191
* @brief Find and return the matching style for the value and feature.
@@ -133,7 +194,7 @@ class QgsConditionalStyle
133
194
* @return A condtional style that matches the value and feature.
134
195
* Check with QgsCondtionalStyle::isValid()
135
196
*/
136
- static QgsConditionalStyle matchingConditionalStyle( QList<QgsConditionalStyle> styles, QVariant value, QgsFeature* feature );
197
+ static QgsConditionalStyle matchingConditionalStyle( QList<QgsConditionalStyle> styles, QVariant value, QgsExpressionContext& context );
137
198
138
199
/**
139
200
* @brief Compress a list of styles into a single style. This can be used to stack the elements of the
0 commit comments