opengisch / QgisModelBaker

Create QGIS projects from database schemas or Interlis models
https://opengisch.github.io/QgisModelBaker/
GNU Lesser General Public License v3.0
55 stars 17 forks source link

[ux] Layer items don't match their expected colors in the Usability Hub Topping Maker Wizard for non-default QGIS themes #939

Open gacarrillor opened 5 months ago

gacarrillor commented 5 months ago

This is how LayerModel items look like in non-default QGIS themes:

image

image

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):

QTreeView::item, QTreeView::branch {
    background: transparent;
    color: @textlight;
}

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 the QTreeView, replace color symbols by something like *: Non-INTERLIS layer.