Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unavailable style-categories listed in qml-file #59605

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

signedav
Copy link
Contributor

Short: On loading a stylecategorymodel the last used category selection is passed to it. Since categories from vector layers can divert to categories from raster layers, this leaded to weird info in the qml-files. This change only passes the categories that the target layer allows (crops them).

When changing a layer, the previously stored or loaded category-selection is taken over.

image

This is nice and makes sense on layer with the same type. On other types it don't mind that much, but are neither useful.

Anyway, the problem was, that with this in the styleCategories in the qml-file style categories where listed, that did not even exist for that layer type.

<qgis version="3.40.0-Bratislava" styleCategories="Symbology|Symbology3D|Labeling|Fields|Forms|Actions|Diagrams|GeometryOptions|Relations|Legend">

Not that bad, because there was no more content of them (since the writeSymbology methods are all layer-type-specific overrides) but still it's confusing.

So I decide that on taking over the lastStyleCategories in the model they are "cropped" to the possible style categories according to the Categories-List of the layer type.

This leads to the situation that when storing styles of raster and then open the dialog for a vector, the categories that are available in the vector layers but not in the rasters are disabled. IMO a behavior that is acceptable.

@github-actions github-actions bot added this to the 3.42.0 milestone Nov 27, 2024
@signedav signedav changed the title avoid having unallowed categories for the current layer in the stylec… Fix unavailable categories listed in qml-file Nov 27, 2024
@signedav signedav changed the title Fix unavailable categories listed in qml-file Fix unavailable style-categories listed in qml-file Nov 27, 2024
Copy link

github-actions bot commented Nov 27, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 70b1274)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 70b1274)

Co-authored-by: Matthias Kuhn <matthias@opengis.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants