Skip to content

Commit

Permalink
Rebase and incorporate suggestions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
benwirf committed Feb 19, 2025
1 parent a0abeaf commit 3c94b36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,8 @@ void QgsCategorizedSymbolRendererWidget::changeCategorySymbol()

void QgsCategorizedSymbolRendererWidget::addCategories()
{
QString attrName = mExpressionWidget->currentField();
QList<QVariant> uniqueValues = layerUniqueValues( attrName );
const QString attrName = mExpressionWidget->currentField();
const QList<QVariant> uniqueValues = layerUniqueValues( attrName );

// ask to abort if too many classes
if ( uniqueValues.size() >= 1000 )
Expand Down Expand Up @@ -1071,16 +1071,16 @@ void QgsCategorizedSymbolRendererWidget::deleteUnusedCategories()
{
if ( !mRenderer )
return;
QString attrName = mExpressionWidget->currentField();
QList<QVariant> uniqueValues = layerUniqueValues( attrName );
const QString attrName = mExpressionWidget->currentField();
const QList<QVariant> uniqueValues = layerUniqueValues( attrName );

const QgsCategoryList catList = mRenderer->categories();

QList<int> unusedIndexes;

for ( int i = 0; i < catList.size(); ++i )
{
QgsRendererCategory cat = catList.at( i );
const QgsRendererCategory cat = catList.at( i );
if ( !uniqueValues.contains( cat.value() ) )
{
unusedIndexes.append( i );
Expand All @@ -1090,7 +1090,7 @@ void QgsCategorizedSymbolRendererWidget::deleteUnusedCategories()
emit widgetChanged();
}

QList<QVariant> QgsCategorizedSymbolRendererWidget::layerUniqueValues( QString attrName )
QList<QVariant> QgsCategorizedSymbolRendererWidget::layerUniqueValues( const QString attrName )
{
const int idx = mLayer->fields().lookupField( attrName );
QList<QVariant> uniqueValues;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology/qgscategorizedsymbolrendererwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ class GUI_EXPORT QgsCategorizedSymbolRendererWidget : public QgsRendererWidget,
void applyChangeToSymbol();

/**
* Returns the list of unique values in the widget's layer.
* Returns the list of unique values in the current widget's layer for attribute name \a attrName.
*
* Called by addCategories() and deleteUnusedCategories()
*/
QList<QVariant> layerUniqueValues( QString attrName );
QList<QVariant> layerUniqueValues( const QString attrName );

QList<QgsSymbol *> selectedSymbols() override;
QgsCategoryList selectedCategoryList();
Expand Down

0 comments on commit 3c94b36

Please sign in to comment.