Skip to content

Commit

Permalink
Some const-correctness for rules
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Apr 18, 2018
1 parent 7123803 commit 7e9aeda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/core/symbology/qgsrulebasedrenderer.sip.in
Expand Up @@ -351,7 +351,7 @@ Create a rule from an XML definition
:return: A new rule
%End

QgsRuleBasedRenderer::RuleList &children();
const QgsRuleBasedRenderer::RuleList &children();
%Docstring
Return all children rules of this rule

Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgsrulebasedrenderer.h
Expand Up @@ -374,7 +374,7 @@ class CORE_EXPORT QgsRuleBasedRenderer : public QgsFeatureRenderer
*
* \returns A list of rules
*/
QgsRuleBasedRenderer::RuleList &children() { return mChildren; }
const QgsRuleBasedRenderer::RuleList &children() { return mChildren; }

/**
* Returns all children, grand-children, grand-grand-children, grand-gra... you get it
Expand Down
8 changes: 4 additions & 4 deletions src/gui/symbology/qgsrulebasedrendererwidget.cpp
Expand Up @@ -342,10 +342,10 @@ QList<QgsSymbol *> QgsRuleBasedRendererWidget::selectedSymbols()
{
QModelIndex parent = range.parent();
QgsRuleBasedRenderer::Rule *parentRule = mModel->ruleForIndex( parent );
QgsRuleBasedRenderer::RuleList &children = parentRule->children();
const QgsRuleBasedRenderer::RuleList &children = parentRule->children();
for ( int row = range.top(); row <= range.bottom(); row++ )
{
symbolList.append( children[row]->symbol() );
symbolList.append( children.at( row )->symbol() );
}
}

Expand All @@ -360,10 +360,10 @@ QgsRuleBasedRenderer::RuleList QgsRuleBasedRendererWidget::selectedRules()
{
QModelIndex parent = range.parent();
QgsRuleBasedRenderer::Rule *parentRule = mModel->ruleForIndex( parent );
QgsRuleBasedRenderer::RuleList &children = parentRule->children();
const QgsRuleBasedRenderer::RuleList &children = parentRule->children();
for ( int row = range.top(); row <= range.bottom(); row++ )
{
rl.append( children[row]->clone() );
rl.append( children.at( row )->clone() );
}
}
return rl;
Expand Down

0 comments on commit 7e9aeda

Please sign in to comment.