Skip to content

Commit

Permalink
Merge pull request #59605 from signedav/fixcategories
Browse files Browse the repository at this point in the history
Fix unavailable style-categories listed in qml-file
  • Loading branch information
signedav authored Dec 5, 2024
2 parents 6ac6203 + e73eecc commit 9f6f941
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gui/qgsmaplayerstylecategoriesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ void QgsMapLayerStyleCategoriesModel::setCategories( QgsMapLayer::StyleCategorie
if ( mCategories == categories )
return;

// filter the categories and only preserve the categories supported by the current layer type
QgsMapLayer::StyleCategories allowedCategories;
for ( QgsMapLayer::StyleCategory category : std::as_const( mCategoryList ) )
{
if ( category == QgsMapLayer::AllStyleCategories )
continue;
allowedCategories |= category;
}
categories &= allowedCategories;

beginResetModel();
mCategories = categories;
endResetModel();
Expand Down

0 comments on commit 9f6f941

Please sign in to comment.