Mixing a bit of Excel into QGIS – conditional formatted table cells


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.

cells

icons

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)

table

So go nuts. I would love to hear any feedback if you use it. Try it out in the next nightly dev build.

Advertisements

11 thoughts on “Mixing a bit of Excel into QGIS – conditional formatted table cells

  1. 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 ?

  2. 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?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s