I was using Excel the other day and used the conditional formatting rules to style some cells based on a condition. If you have never seen or used them they look like this:
They are pretty handy for a quick idea on the state of your data. Looking at QGIS I thought to myself “Wait!? Why not do that in QGIS too. That would be pretty neat”. And with that here it is, finally!. Conditional formatting rules for QGIS attribute table.
You can control the font style, color, background color, even custom icons based on QGIS symbols. The buttons at the top give you access to quick styles which you can tweak more with the other options.
The conditions are just normal QGIS expressions. Use the special variable @value to refer to the current cell value. As they are normal QGIS expressions you can reference the other fields in the expressions.
(Click the GIF for a better view)
So go nuts. I would love to hear any feedback if you use it. Try it out in the next nightly dev build.
Nice feature . You can highlight data directly into Qgis without exporting to Excel. Thank you for the tip.
I wish I could wake up some morning saying : “Hey, I’ll code myself some nice feature today…”. I suppose we only need to wait a bit to get it in our “normal” QGIS distribution, now you’ve done it so nicely ?
Great stuff!
I once created a plugin for personal use that coloured the layer attributes in a Qt tablewidget according to the layer style (e.g a gradient).
Maybe you can add that as a feature to “mirror” the layer style in the attributes table?
Yeah I did try that. In fact it was a core feature for a few minutes until the performance was an issue
[…] http://nathanw.net/2015/08/20/mixing-a-bit-of-excel-into-qgis-conditional-formatted-table-cells/ […]
Great functionality! Can I re-arrange the Rules order if I have several?
No yet.
Great Feature, I use Excel every day
Thanks, but how do I open up the Conditional Format Rules window pane that is shown in your example?
You will have to be running the latest dev version to have this feautre
Ok, thanks. I look forward to seeing it.