Is it possible to set a tooltip for a layer?

I don't know if it is possible removing the layer's source (I will try to investigate), but you may add a title and an abstract in this way:

layer=iface.activeLayer()

layer.setTitle('TITLE')
layer.setAbstract('Abstract')

You will obtain:

enter image description here


This has been bugging me, I'd like to tweak that myself - I'd love to be able to hover the mouse over and see the CRS as well as the source.

I managed to hunt down the code that does this. GitHub has a really good full text search, by searching for abstract setToolTip I was able to find the code. I'm not a C++ developer, but I can get the gist of C++ code and it seems to tie in with the answer from @mgri

It's in a class called qgsMapLayerModel, in a method called data in particular this block

There seems to be a SIP wrapper for this, so it's probably doable with pyqgis by subclassing this and overriding this method... it's a bit late so I won't attempt to tackle this just now, but hopefully point us both in the right direction :)