Skip to content

Commit

Permalink
Fix cannot change color of class symbols (fix #15142)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 27, 2016
1 parent 5b166a9 commit 45b8783
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -1029,7 +1029,11 @@ void QgsCategorizedSymbolRendererV2Widget::updateSymbolsFromWidget()
Q_FOREACH ( int idx, selectedCats )
{
QgsSymbolV2* newCatSymbol = mCategorizedSymbol->clone();
newCatSymbol->setColor( mRenderer->categories().at( idx ).symbol()->color() );
if ( selectedCats.count() > 1 )
{
//if updating multiple categories, retain the existing category colors
newCatSymbol->setColor( mRenderer->categories().at( idx ).symbol()->color() );
}
mRenderer->updateCategorySymbol( idx, newCatSymbol );
}
emit widgetChanged();
Expand Down
6 changes: 5 additions & 1 deletion src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Expand Up @@ -717,7 +717,11 @@ void QgsGraduatedSymbolRendererV2Widget::updateSymbolsFromWidget()
{
int rangeIdx = idx.row();
QgsSymbolV2* newRangeSymbol = mGraduatedSymbol->clone();
newRangeSymbol->setColor( mRenderer->ranges()[rangeIdx].symbol()->color() );
if ( selectedIndexes.count() > 1 )
{
//if updating multiple ranges, retain the existing range colors
newRangeSymbol->setColor( mRenderer->ranges().at( rangeIdx ).symbol()->color() );
}
mRenderer->updateRangeSymbol( rangeIdx, newRangeSymbol );
}
}
Expand Down

1 comment on commit 45b8783

@nirvn
Copy link
Contributor

@nirvn nirvn commented on 45b8783 Jun 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson , great! I'm wondering whether a similar trick would be needed for size-method graduated symbology.

Please sign in to comment.