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

Häfliger Guido guido.haefliger at vogelwarte.ch
Thu Oct 15 02:41:33 PDT 2020


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 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<mailto:guido.haefliger at vogelwarte.ch>
www.vogelwarte.ch<http://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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201015/073e23b7/attachment.html>


More information about the QGIS-Developer mailing list