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 dialog 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 Answer
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)
layer
is the reference to QgsVectorLayer
. Please, take a look at the documentation!
-
1@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... Jun 26, 2017 at 20:36
-
1