1

I have a working stand-alone pyqgis application that can display vector and raster layers, the question is how to access the layer style manager as in QGIS's layer property, where users can change the symbology of a layer? I am hoping there is a class already defined in the QGIS core library that I can just call from my application.

1

Yes, that is possible! You can use the QgsSymbolV2SelectorDialog class to do that. Here a minimal example form PyQGIS APIs on how the main class constructor works:

SymbolSelectorDialog = QgsSymbolV2SelectorDialog(
    layer.rendererV2().symbol(), QgsStyleV2.defaultStyle(),
    layer, None, False)

layeris the reference to QgsVectorLayer. Please, take a look at the documentation!

  • @Irssvt, this is exactly what I am looking for! Thank a lot!! and it works! But when I ran it, a whole bunch svg symbols used on that dialog cannot open, e.g. :/images/themes/default/symbologyAdd.svg', do you know how to get those button icons to show up? I looked inside the full qgis installation directory, but couldn't find these svg icon files... – For Comment Jun 26 '17 at 20:36
  • 1
    Could this be your problem? gis.stackexchange.com/a/203821/9022 – lrssvt Jun 27 '17 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.