0

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?

Spacedman
  • 63,755
  • 5
  • 81
  • 115
  • Do you need style or labels also? Style is all in gui but labels are not yet. – Nathan W Jun 24 '16 at 10:30
  • Style would be good for a start! I should probably add I'm using 2.14 Essen at the moment. – Spacedman Jun 24 '16 at 10:37
  • You can take a look at http://webgeodatavore.github.io/pyqgis-samples/ (disclaimer: I'm the author or this content) to find out most Python QGIS gui API components visually with sample code. – ThomasG77 Jun 24 '16 at 14:17

1 Answers1

0

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_()
Nathan W
  • 34,706
  • 5
  • 97
  • 148
  • Yes! Needs a canvas.refresh() to reflect changes unless I can add an "apply" button with my Qt skillz... – Spacedman Jun 24 '16 at 10:51