[Qgis-developer] Adding symbols through API needs QGIS restarts to show up
Akbar Gumbira
akbargumbira at gmail.com
Tue Jul 12 11:06:52 PDT 2016
Hi Martin,
Thanks, seems to work. I read a bit the cpp code in Style Manager DIalog
that it will load the default style when showing up the dialog. So I
thought once it's written correctly to the database, it will not have this
problem. Thanks for the explanation, it's clear now what the API's are
meant to do.
On Tue, Jul 12, 2016 at 7:57 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
> Hi Akbar
>
> On Tue, Jul 12, 2016 at 7:49 PM, Akbar Gumbira <akbargumbira at gmail.com>
> wrote:
> > Hi,
> >
> > I am trying to add symbols/colorramps through Python API and I have a
> > problem that after adding symbol/colorramps, the added symbols/colorramps
> > don't show up in Style Manager right away. The symbols are added in the
> > symbology-ng-style.db, but the added symbols show up once I restart QGIS
>
> Try this instead:
>
> style = QgsStyleV2.defaultStyle()
> style.addSymbol("ABC", my_symbol)
>
> The default style is the one loaded on start and used throughout QGIS
> application, so if you modify it, the changes will be immediately
> visible in the GUI and will be saved automatically.
>
> Cheers
> Martin
>
--
*-------------------*
*Akbar Gumbira *
*www.akbargumbira.com <http://www.akbargumbira.com>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160712/30e7e127/attachment.html>
More information about the Qgis-developer
mailing list