[Qgis-developer] Use the style tab widget in a Python plugin

kimaidou kimaidou at gmail.com
Tue Jun 23 08:09:46 PDT 2015


Ok, it seems python bindings are missing here. Here is the console output

>>> from qgis.gui import *
>>> from qgis.core import *
>>> rw = QgsRendererV2Widget( iface.activeLayer(),
QgsStyleV2.defaultStyle() )
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: qgis._gui.QgsRendererV2Widget represents a C++ abstract class
and cannot be instantiated

Too bad ;)



2015-06-23 16:38 GMT+02:00 kimaidou <kimaidou at gmail.com>:

> Hum...
> After digging a little deeper, I found something interesting in the Python
> Cookbook [1]
> It seems I need to use the class QgsRendererV2Widget
>
> [1]
> http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/vector.html#creating-custom-renderers
>
> 2015-06-23 16:29 GMT+02:00 kimaidou <kimaidou at gmail.com>:
>
>> Hi all,
>>
>> The LayerBoard plugin I made during the HF in "Nooooooooodebo" shows a
>> table of all vector (and raster) layers and allows to edit some properties
>> directly by editing the table cells, such as max and min scale, layer name,
>> title and abstract, assign SRS, etc.
>>
>> I would like to display the content of the Style tab of the layer
>> properties dialog in a panel right to the table. This tab will show the
>> style interface refreshed whenever the user clicks on a layer in the tab,
>> and let her/him change the style for this layer the same way we do via the
>> layer properties dialog.
>>
>> I have searched a bit in the api and in the source code, but cannot find
>> the right way to do so. I have not found a custom Widget which I can
>> instantiate with the layer and wich will provide me all the logic
>> underneath.
>>
>> Is this even possible ? Has anyone an idea of how to to this without
>> rewriting all the code ( connection between ui elements and slots)
>>
>> Thanks in advance
>>
>> Michaël
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150623/ba7fe493/attachment-0001.html>


More information about the Qgis-developer mailing list