39 mFieldStyles.insert( fieldName, styles );
44 if ( mFieldStyles.contains( fieldName ) )
46 return mFieldStyles[fieldName];
64 for ( ; it != mFieldStyles.constEnd(); ++it )
89 for (
int i = 0;i < nodelist.
count(); i++ )
94 mRowStyles.
append( style );
100 for (
int i = 0;i < nodelist.
count(); i++ )
107 for (
int i = 0;i < stylenodelist.
count(); i++ )
114 mFieldStyles.insert( fieldName, styles );
123 , mBackColor(
QColor( 0, 0, 0, 0 ) )
124 , mTextColor(
QColor( 0, 0, 0, 0 ) )
130 , mBackColor(
QColor( 0, 0, 0, 0 ) )
131 , mTextColor(
QColor( 0, 0, 0, 0 ) )
137 : mValid( other.mValid )
138 , mName( other.mName )
139 , mRule( other.mRule )
140 , mFont( other.mFont )
141 , mBackColor( other.mBackColor )
142 , mTextColor( other.mTextColor )
143 , mIcon( other.mIcon )
145 if ( other.mSymbol.
data() )
146 mSymbol.
reset( other.mSymbol->clone() );
151 mValid = other.mValid;
154 mBackColor = other.mBackColor;
155 mTextColor = other.mTextColor;
158 if ( other.mSymbol.
data() )
160 mSymbol.
reset( other.mSymbol->clone() );
175 if (
name().isEmpty() )
205 pixmap.
fill( Qt::transparent );
213 painter.
setPen( Qt::NoPen );
218 painter.
setPen( mTextColor );
220 painter.
setPen( Qt::black );
225 rect =
QRect( 32, 0, 32, 32 );
226 painter.
drawText( rect, Qt::AlignCenter,
"abc\n123" );
246 if ( style.
matches( value, context ) )
247 matchingstyles.
append( style );
249 return matchingstyles;
256 if ( style.
matches( value, context ) )
305 if ( !symbolElm.
isNull() )
307 QgsSymbolV2*
symbol = QgsSymbolLayerV2Utils::loadSymbol<QgsMarkerSymbolV2>( symbolElm );
Class for parsing and evaluation of expressions (formerly called "search strings").
QDomNodeList elementsByTagName(const QString &tagname) const
void setName(const QString &value)
Set the name of the style.
Q_DECL_DEPRECATED QVariant evaluate(const QgsFeature *f)
Evaluate the feature and return the result.
bool validTextColor() const
Check if the text color is valid for render.
void setRenderHint(RenderHint hint, bool on)
QDomNode appendChild(const QDomNode &newChild)
void fill(const QColor &color)
QColor textColor() const
The text color set for style.
bool validBackgroundColor() const
Check if the background color is valid for render.
QString attribute(const QString &name, const QString &defValue) const
void setRule(const QString &value)
Set the rule for the style.
QFont font() const
The font for the style.
virtual QgsSymbolV2 * clone() const =0
QList< QgsConditionalStyle > fieldStyles(const QString &fieldName)
Returns the conditional styles set for the field UI properties.
static QDomElement saveSymbol(const QString &symbolName, QgsSymbolV2 *symbol, QDomDocument &doc)
bool writeXml(QDomNode &node, QDomDocument &doc) const
Write field ui properties specific state from Dom node.
QgsConditionalLayerStyles()
void setVariable(const QString &name, const QVariant &value)
Convenience method for setting a variable in the context scope by name and value. ...
QgsConditionalStyle & operator=(const QgsConditionalStyle &other)
QDomElement toElement() const
void drawRect(const QRectF &rectangle)
QList< QgsConditionalStyle > rowStyles()
void setFont(const QFont &font)
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
void append(const T &value)
QPixmap icon() const
The icon set for style generated from the set symbol.
Conditional styling for a rule.
bool matches(const QVariant &value, QgsExpressionContext &context) const
Check if the rule matches using the given value and feature.
void setPen(const QColor &color)
void setAttribute(const QString &name, const QString &value)
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static QList< QgsConditionalStyle > matchingConditionalStyles(const QList< QgsConditionalStyle > &styles, const QVariant &value, QgsExpressionContext &context)
Find and return the matching styles for the value and feature.
void setBrush(const QBrush &brush)
void drawText(const QPointF &position, const QString &text)
QColor backgroundColor() const
The background color for style.
static bool setFromXmlChildNode(QFont &font, const QDomElement &element, const QString &childNode)
Sets the properties of a font to match the properties stored in an XML child node.
static QgsConditionalStyle compressStyles(const QList< QgsConditionalStyle > &styles)
Compress a list of styles into a single style.
QString name() const
The name of the style.
void setBackgroundColor(const QColor &value)
Set the background color for the style.
QPixmap renderPreview() const
Render a preview icon of the rule.
bool writeXml(QDomNode &node, QDomDocument &doc) const
Write vector conditional style specific state from layer Dom node.
void setFont(const QFont &value)
Set the font for the the style.
void setRowStyles(const QList< QgsConditionalStyle > &styles)
Set the conditional styles that apply to full rows of data in the attribute table.
void setSymbol(QgsSymbolV2 *value)
Set the icon for the 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 QPixmap symbolPreviewPixmap(QgsSymbolV2 *symbol, QSize size, QgsRenderContext *customContext=nullptr)
bool readXml(const QDomNode &node)
Reads vector conditional style specific state from layer Dom node.
bool readXml(const QDomNode &node)
Reads field ui properties specific state from Dom node.
QDomElement firstChildElement(const QString &tagName) const
QString rule() const
The condition rule set for the style.
bool isValid() const
isValid Check if this rule is valid.
static QDomElement toXmlElement(const QFont &font, QDomDocument &document, const QString &elementName)
Returns a DOM element containing the properties of the font.
QDomElement createElement(const QString &tagName)
void setFieldStyles(const QString &fieldName, const QList< QgsConditionalStyle > &styles)
Set the conditional styles for the field UI properties.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString displayText() const
The name of the style.
QgsSymbolV2 * symbol() const
The symbol used to generate the icon for the style.
QDomNode at(int index) const
void setTextColor(const QColor &value)
Set the text color for the style.