[Qgis-developer] Changing the Renderer Type in PyQGis Application

Matthias Kuhn matthias.kuhn at gmx.ch
Thu Nov 1 04:12:26 PDT 2012


On Thu, 2012-11-01 at 12:19 +0200, Justin Hubbard wrote:
> In line with this, Is there any way to open a QGIS dialog (To edit
> layer properties for example) from a PyQGis application?
> Has anyone been able to do this?
Try:
iface.showLayerProperties( mapLayer )

Cheers,
Matthias

> 
> 
> Thanks
> Justin
> 
> On Thu, Nov 1, 2012 at 9:32 AM, Matthias Kuhn <matthias.kuhn at gmx.ch>
> wrote:
>         Hi Justin,
>         
>         What you want to do is probably create a new renderer of
>         different type
>         and replace the current renderer with the new one. You have to
>         create it
>         yourself.
>         
>         In the API [1] click on "Inheritance diagram" (just on the top
>         of the
>         page) to see, what subclasses are available.
>         The you set the new renderer on the vector layer, I think that
>         should do
>         the trick.
>         
>         Regards,
>         Matthias
>         
>         [1]: http://www.qgis.org/api/classQgsFeatureRendererV2.html
>         
>         
>         On Thu, 2012-11-01 at 08:58 +0200, Justin Hubbard wrote:
>         > Hi
>         >
>         >
>         > I would like to know how to change the renderer type in a
>         PyQGis
>         > application.
>         > The vector layer (Spatialite) is a singleSymbol type
>         currently. (Point
>         > geometries) and I need to change the symbols depending on
>         the value of
>         > an attribute in the layer.
>         > I am new to Python and QGis so have no idea how to do this.
>         (I notice
>         > that there is no setType method on the QgsFeatureRendererV2,
>         which i
>         > would have assumed would do the trick)
>         >
>         >
>         > Any help appreciated
>         
>         > _______________________________________________
>         > Qgis-developer mailing list
>         > Qgis-developer at lists.osgeo.org
>         > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>         
>         
>         _______________________________________________
>         Qgis-developer mailing list
>         Qgis-developer at lists.osgeo.org
>         http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 
> 




More information about the Qgis-developer mailing list