[Qgis-developer] Adding symbols through API needs QGIS restarts to show up

Martin Dobias wonder.sk at gmail.com
Tue Jul 12 10:57:41 PDT 2016


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


More information about the Qgis-developer mailing list