I can load a layer, open a canvas, and draw the layer in the canvas using the Qgis python API.
Can I bring up the properties dialog, or even just the "Style" tab of the properties dialog, from such a standalone application? I have a bad feeling I can't because all the code is in the main Qgis Application rather than present in qgis.core and qgis.gui, and doesn't have a python interface.
Unless I've missed something, the solution might be to rebuild the dialog and its behaviour in Python, re-using the relevant .ui file?
1 Answer 1
You can use the following dialog if you need only style:
QgsRendererV2PropertiesDialog
Usage:
dlg = QgsRendererV2PropertiesDialog(layer, QgsStyleV2.defaultStyle(), embedded=False)
dlg.setMapCanvas(canvas)
dlg.exec_()
-
Yes! Needs a
canvas.refresh()
to reflect changes unless I can add an "apply" button with my Qt skillz...Spacedman– Spacedman2016年06月24日 10:51:35 +00:00Commented Jun 24, 2016 at 10:51
gui
but labels are not yet.