1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsconditionalstyle.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
typedef QList<QgsConditionalStyle> QgsConditionalStyles;
class QgsConditionalLayerStyles : QObject
{
%Docstring(signature="appended")
The :py:class:`QgsConditionalLayerStyles` class holds conditional style
information for a layer. This includes field styles and full row styles.
%End
%TypeHeaderCode
#include "qgsconditionalstyle.h"
%End
public:
QgsConditionalLayerStyles( QObject *parent = 0 );
%Docstring
Constructor for QgsConditionalLayerStyles, with the specified ``parent``
object.
%End
QgsConditionalStyles rowStyles() const;
%Docstring
Returns a list of row styles associated with the layer.
.. seealso:: :py:func:`setRowStyles`
%End
void setRowStyles( const QgsConditionalStyles &styles );
%Docstring
Sets the conditional ``styles`` that apply to full rows of data in the
attribute table. Each row will check be checked against each rule.
.. seealso:: :py:func:`rowStyles`
%End
QgsConditionalStyle constraintFailureStyles( QgsFieldConstraints::ConstraintStrength strength );
%Docstring
Returns a style associated to a constraint failure.
:param strength: the type of constraint
.. versionadded:: 3.30
%End
void setFieldStyles( const QString &fieldName, const QList<QgsConditionalStyle> &styles );
%Docstring
Set the conditional ``styles`` for a field, with the specified
``fieldName``.
The field value is inserted into a 'value' variable to conduct
expression checks.
.. seealso:: :py:func:`fieldStyles`
%End
QList<QgsConditionalStyle> fieldStyles( const QString &fieldName ) const;
%Docstring
Returns the conditional styles set for the field with matching
``fieldName``.
.. seealso:: :py:func:`setFieldStyles`
%End
bool readXml( const QDomNode &node, const QgsReadWriteContext &context );
%Docstring
Reads the condition styles state from a DOM node.
.. seealso:: :py:func:`writeXml`
%End
bool writeXml( QDomNode &node, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Writes the condition styles state to a DOM node.
.. seealso:: :py:func:`readXml`
%End
bool rulesNeedGeometry() const;
%Docstring
Returns ``True`` if at least one rule needs geometry.
.. versionadded:: 3.26.3
%End
signals:
void changed();
%Docstring
Emitted when the conditional styles are changed.
.. versionadded:: 3.10
%End
};
class QgsConditionalStyle
{
%Docstring(signature="appended")
Conditional styling for a rule.
%End
%TypeHeaderCode
#include "qgsconditionalstyle.h"
%End
public:
QgsConditionalStyle();
QgsConditionalStyle( const QgsConditionalStyle &other );
QgsConditionalStyle( const QString &rule );
~QgsConditionalStyle();
bool matches( const QVariant &value, QgsExpressionContext &context ) const;
%Docstring
Check if the rule matches using the given value and feature
:param value: The current value being checked. The "value" variable from
the context is replaced with this value.
:param context: Expression context for evaluating rule expression
:return: ``True`` of the rule matches against the given feature
%End
QPixmap renderPreview( const QSize &size = QSize() ) const;
%Docstring
Render a preview icon of the rule, at the specified ``size``.
If ``size`` is not specified, a default size will be used.
:return: QPixmap preview of the style
%End
void setName( const QString &value );
%Docstring
Set the name of the style. Names are optional but handy for display
:param value: The name given to the style
%End
void setRule( const QString &value );
%Docstring
Set the rule for the style. Rules should be of :py:class:`QgsExpression`
syntax. Special value of \@value is replaced at run time with the check
value
:param value: The :py:class:`QgsExpression` style rule to use for this
style
%End
void setBackgroundColor( const QColor &value );
%Docstring
Set the background color for the style
:param value: QColor for background color
%End
void setTextColor( const QColor &value );
%Docstring
Set the text color for the style
:param value: QColor for text color
%End
void setFont( const QFont &value );
%Docstring
Set the font for the style
:param value: QFont to be used for text
%End
void setSymbol( QgsSymbol *value );
%Docstring
Set the icon for the style. Icons are generated from symbols
:param value: :py:class:`QgsSymbol` to be used when generating the icon
%End
QString displayText() const;
%Docstring
The name of the style.
:return: The name of the style. Names are optional so might be empty.
%End
QString name() const;
%Docstring
The name of the style.
:return: The name of the style. Names are optional so might be empty.
%End
QPixmap icon() const;
%Docstring
The icon set for style generated from the set symbol
:return: A QPixmap that was set for the icon using the symbol
%End
QgsSymbol *symbol() const;
%Docstring
The symbol used to generate the icon for the style
:return: The :py:class:`QgsSymbol` used for the icon
%End
QColor textColor() const;
%Docstring
The text color set for style
:return: QColor for text color
%End
bool validTextColor() const;
%Docstring
Check if the text color is valid for render. Valid colors are non
invalid QColors and a color with a > 0 alpha
:return: ``True`` of the color set for text is valid.
%End
QColor backgroundColor() const;
%Docstring
The background color for style
:return: QColor for background color
%End
bool validBackgroundColor() const;
%Docstring
Check if the background color is valid for render. Valid colors are non
invalid QColors and a color with a > 0 alpha
:return: ``True`` of the color set for background is valid.
%End
QFont font() const;
%Docstring
The font for the style
:return: QFont for the style
%End
QString rule() const;
%Docstring
The condition rule set for the style. Rule may contain variable \@value
to represent the current value
:return: QString of the current set rule
%End
bool isValid() const;
%Docstring
isValid Check if this rule is valid. A valid rule has one or more
properties set.
:return: ``True`` if the rule is valid.
%End
static QList<QgsConditionalStyle> matchingConditionalStyles( const QList<QgsConditionalStyle> &styles, const QVariant &value, QgsExpressionContext &context );
%Docstring
Find and return the matching styles for the value and feature. If no
match is found a invalid QgsConditionalStyle is return.
:return: A conditional style that matches the value and feature. Check
with :py:func:`QgsConditionalStyle.isValid()`
%End
static QgsConditionalStyle matchingConditionalStyle( const QList<QgsConditionalStyle> &styles, const QVariant &value, QgsExpressionContext &context );
%Docstring
Find and return the matching style for the value and feature. If no
match is found a invalid QgsConditionalStyle is return.
:return: A conditional style that matches the value and feature. Check
with :py:func:`QgsConditionalStyle.isValid()`
%End
static QgsConditionalStyle compressStyles( const QList<QgsConditionalStyle> &styles );
%Docstring
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.
:param styles: The list of styles to compress down
:return: A single style generated from joining each style property.
%End
bool readXml( const QDomNode &node, const QgsReadWriteContext &context );
%Docstring
Reads vector conditional style specific state from layer Dom node.
%End
bool writeXml( QDomNode &node, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Write vector conditional style specific state from layer Dom node.
%End
bool operator==( const QgsConditionalStyle &other ) const;
bool operator!=( const QgsConditionalStyle &other ) const;
SIP_PYOBJECT __repr__();
%MethodCode
QString str;
if ( !sipCpp->name().isEmpty() )
str = QStringLiteral( "<QgsConditionalStyle: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->rule() );
else
str = QStringLiteral( "<QgsConditionalStyle: %2>" ).arg( sipCpp->rule() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsconditionalstyle.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|