Fix cannot change color of class symbols (fix #15142)

This commit is contained in:
Nyall Dawson 2016-06-27 15:11:43 +10:00
parent 5b166a9d6b
commit 45b878331c
2 changed files with 10 additions and 2 deletions

View File

@ -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();

View File

@ -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 );
}
}