Skip to content

Commit

Permalink
Merge pull request #365 from tecoholic/improved_symbols
Browse files Browse the repository at this point in the history
fix for #6901.  Fix crash when Changing symbols to > 1 symbology classes
  • Loading branch information
NathanW2 committed Dec 27, 2012
2 parents 7344368 + 0ff4324 commit c419888
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,9 @@ QgsFeatureRendererV2* QgsCategorizedSymbolRendererV2Widget::renderer()

void QgsCategorizedSymbolRendererV2Widget::changeSelectedSymbols()
{
QItemSelectionModel* m = viewCategories->selectionModel();
QModelIndexList selectedIndexes = m->selectedRows( 1 );
QList<int> selectedCats = selectedCategories();

if ( m && selectedIndexes.size() > 0 )
if ( selectedCats.size() > 0 )
{
QgsSymbolV2* newSymbol = mCategorizedSymbol->clone();
QgsSymbolV2SelectorDialog dlg( newSymbol, mStyle, mLayer, this );
Expand All @@ -458,15 +457,13 @@ void QgsCategorizedSymbolRendererV2Widget::changeSelectedSymbols()
return;
}

foreach ( QModelIndex idx, selectedIndexes )
foreach ( const int idx, selectedCats )
{
if ( idx.isValid() )
{
int catIdx = mRenderer->categoryIndexForValue( idx.data( Qt::UserRole + 1 ) );
QgsSymbolV2* newCatSymbol = newSymbol->clone();
newCatSymbol->setColor( mRenderer->categories()[catIdx].symbol()->color() );
mRenderer->updateCategorySymbol( catIdx, newCatSymbol );
}
QgsRendererCategoryV2 category = mRenderer->categories().value( idx );

QgsSymbolV2* newCatSymbol = newSymbol->clone();
newCatSymbol->setColor( mRenderer->categories()[idx].symbol()->color() );
mRenderer->updateCategorySymbol( idx, newCatSymbol );
}
}
}
Expand Down

0 comments on commit c419888

Please sign in to comment.