On 2016-11-21 03:02, Martin Dobias wrote:

Ah, thanks Martin for your anwers.

Q3: looking at the possibility to add a 'Transparency slider' in the
layertree (see layer props bottom item): how difficult is it to add a
'refresh data' button (with custom refresh data code) in the layer tree

See the original pull request for some example code:

https://github.com/qgis/QGIS/pull/3170

I tried this, and indeed can create such a widget (QToolButton or QPushBtuuon) with a handle to a layer to do things with it. But I can only add it to a layer in the legend via the properties dialog?

If I try to add the widget via the addLegendLayerActionForLayer

btn = self.refresh_button_provider.createWidget(self.measurements_layer, 0) self.iface.legendInterface().addLegendLayerActionForLayer(btn.defaultAction(), self.action_layer)

it does not show up in the legend. (the same button DOES show up (and works) if I do via Layer Properties/Legend dialog).

Should I be able to add such a button/action to just that layer via addLegendLayerActionForLayer?

Or do I miss something here?

Regards,

Richard Duivenvoorde

_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to