Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[bugfix]Changing a range or category symbol should not update the [Ch…
…ange] button's (Fixes #17902)

Also avoid modification of the *Change* button if the dialog is not accepted
  • Loading branch information
DelazJ committed Apr 30, 2018
1 parent ee417aa commit 89c2b4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
Expand Up @@ -550,11 +550,15 @@ void QgsCategorizedSymbolRendererWidget::changeCategorizedSymbol()

connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsCategorizedSymbolRendererWidget::updateSymbolsFromWidget );
connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsCategorizedSymbolRendererWidget::cleanUpSymbolSelector );
connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsCategorizedSymbolRendererWidget::updateCategorizedSymbolIcon );
openPanel( dlg );
}

void QgsCategorizedSymbolRendererWidget::updateCategorizedSymbolIcon()
{
if ( !mCategorizedSymbol )
return;

QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( mCategorizedSymbol.get(), btnChangeCategorizedSymbol->iconSize() );
btnChangeCategorizedSymbol->setIcon( icon );
}
Expand Down Expand Up @@ -950,7 +954,6 @@ void QgsCategorizedSymbolRendererWidget::updateSymbolsFromWidget()
QgsSymbolSelectorWidget *dlg = qobject_cast<QgsSymbolSelectorWidget *>( sender() );
mCategorizedSymbol.reset( dlg->symbol()->clone() );

updateCategorizedSymbolIcon();
// When there is a selection, change the selected symbols only
QItemSelectionModel *m = viewCategories->selectionModel();
QModelIndexList i = m->selectedRows();
Expand All @@ -973,10 +976,12 @@ void QgsCategorizedSymbolRendererWidget::updateSymbolsFromWidget()
}
emit widgetChanged();
}
return;
}
else
{
mRenderer->updateSymbols( mCategorizedSymbol.get() );
}

mRenderer->updateSymbols( mCategorizedSymbol.get() );
emit widgetChanged();
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
Expand Up @@ -780,7 +780,6 @@ void QgsGraduatedSymbolRendererWidget::updateSymbolsFromWidget()
}
else
{
updateGraduatedSymbolIcon();
mRenderer->updateSymbols( mGraduatedSymbol.get() );
}

Expand Down Expand Up @@ -880,6 +879,7 @@ void QgsGraduatedSymbolRendererWidget::changeGraduatedSymbol()

connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsGraduatedSymbolRendererWidget::updateSymbolsFromWidget );
connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsGraduatedSymbolRendererWidget::cleanUpSymbolSelector );
connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsGraduatedSymbolRendererWidget::updateGraduatedSymbolIcon );
openPanel( dlg );
}

Expand Down

0 comments on commit 89c2b4b

Please sign in to comment.