[QGIS-Developer] refresh conditional formatting full row after feature attribut update

Häfliger Guido guido.haefliger at vogelwarte.ch
Thu Oct 15 23:44:19 PDT 2020


Hello

If I start the edit session manually and edit the attribute, the conditional formatting full row rule are applied immediately, even before saving.

It seems like the refresh of the conditional formatting full row rule ignore the first or last feature-id of the modified features if the attributes are modified by python code.

I tried to find an API-method which forces the refresh of the conditional formatting row rules but I didn't find anything which works

Best regards
Guido


-----Ursprüngliche Nachricht-----
Von: Nyall Dawson [mailto:nyall.dawson at gmail.com] 
Gesendet: Freitag, 16. Oktober 2020 02:21
An: Häfliger Guido
Cc: qgis-developer at lists.osgeo.org
Betreff: Re: [QGIS-Developer] refresh conditional formatting full row after feature attribut update

On Thu, 15 Oct 2020 at 19:41, Häfliger Guido
<guido.haefliger at vogelwarte.ch> wrote:
>
> Hi
>
>
>
> I execute the following code:
>
>
>
>                         selected_feature = layer.selectedFeatures()
>
>                         layer.startEditing()
>
>                         for feature in selected_feature:
>
>                             feature["focus"] = 1
>
>                             layer.updateFeature(feature)
>
>
>
>                         layer.commitChanges()
>
>
>
> The update of the values works  fine, the opened attribute table shows the new attribute values but the conditional formatting in the attribute table (full row) is not applied to the updated features if only one feature is selected. If selected_features contains several features, the conditional formatting works except for the first selected feature, so it is not correct.
>
>
>
> The refresh of conditional formatting works perfectly if the conditional formatting is field based (rule un field focus). The full row conditional formatting is only applied correctly if I close and reopen the attribute table. Is this a bug in full row based conditional formatting

Sounds like a bug to me -- can you reproduce if you make changes from
the QGIS interface itself and without the python code?

Nyall



or do I have to use another method to update the attributes? Exist a
workaround to force the refresh of conditional formatting full row
rules on a opened attribute table?
>
>
>
> Thanks for your help in advance
>
> Guido
>
> ____________________________________________________
>
>
> Dipl. Ing. ETH Guido Häfliger
> EDV/GIS-Spezialist
> Tel. ++41 41 462 97 60
> guido.haefliger at vogelwarte.ch
> www.vogelwarte.ch
>
> Schweizerische Vogelwarte | Seerose 1 | CH-6204 Sempach | Schweiz
>
> Station ornithologique suisse | Seerose 1 | CH-6204 Sempach | Suisse
> Stazione ornitologica svizzera | Seerose 1 | CH-6204 Sempach | Svizzera
> Swiss Ornithological Institute | Seerose 1 | CH-6204 Sempach | Switzerland
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list