15 #ifndef QGSCONDITIONALSTYLE_H
16 #define QGSCONDITIONALSTYLE_H
18 #include "qgis_core.h"
23 #include <QDomDocument>
70 void setFieldStyles(
const QString &fieldName,
const QList<QgsConditionalStyle> &styles );
77 QList<QgsConditionalStyle> fieldStyles(
const QString &fieldName )
const;
91 bool writeXml( QDomNode &node, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
103 QHash<QString, QgsConditionalStyles> mFieldStyles;
136 QPixmap renderPreview(
const QSize &size = QSize() )
const;
142 void setName(
const QString &value ) { mName = value; mValid =
true; }
149 void setRule(
const QString &value ) { mRule = value; mValid =
true; }
161 void setTextColor(
const QColor &value ) { mTextColor = value; mValid =
true; }
167 void setFont(
const QFont &value ) { mFont = value; mValid =
true; }
179 QString displayText()
const;
185 QString
name()
const {
return mName; }
191 QPixmap
icon()
const {
return mIcon; }
210 bool validTextColor()
const;
223 bool validBackgroundColor()
const;
229 QFont
font()
const {
return mFont; }
236 QString
rule()
const {
return mRule; }
252 static QList<QgsConditionalStyle> matchingConditionalStyles(
const QList<QgsConditionalStyle> &styles,
const QVariant &value,
QgsExpressionContext &context );
279 bool writeXml( QDomNode &node, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
285 SIP_PYOBJECT __repr__();
288 if ( !sipCpp->name().isEmpty() )
289 str = QStringLiteral(
"<QgsConditionalStyle: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->rule() );
291 str = QStringLiteral(
"<QgsConditionalStyle: %2>" ).arg( sipCpp->rule() );
292 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
301 std::unique_ptr<QgsSymbol> mSymbol;
308 #endif // QGSCONDITIONALSTYLE_H