This is how LayerModel items look like in non-default QGIS themes:
The issue
The LayerModel.data()'s returned value for the Qt.BackgroundRole role is being overridden by a global stylesheet set by the non-default QGIS themes (like Night Mapping theme):
One might expect that even having a global stylesheet, one could set the item background via Qt.BackgroundRole, but the current behavior is well known in Qt and considered as a feature, rather than a bug. For reference, some related links:
Instead of using colors, add a text clue for non-INTERLIS layers (e.g., My Layer*) and in the legend below the QTreeView, replace color symbols by something like *: Non-INTERLIS layer.
This is how
LayerModel
items look like in non-default QGIS themes:The issue
The
LayerModel.data()
's returned value for theQt.BackgroundRole
role is being overridden by a global stylesheet set by the non-default QGIS themes (likeNight Mapping
theme):One might expect that even having a global stylesheet, one could set the item background via Qt.BackgroundRole, but the current behavior is well known in Qt and considered as a feature, rather than a bug. For reference, some related links:
https://forum.qt.io/topic/95940/model-backgroundrole-overridden-by-style-sheet https://bugreports.qt.io/browse/QTBUG-70100
Suggestion
Instead of using colors, add a text clue for non-INTERLIS layers (e.g.,
My Layer*
) and in the legend below theQTreeView
, replace color symbols by something like*: Non-INTERLIS layer
.