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?

asked Jun 24, 2016 at 10:13
3
  • Do you need style or labels also? Style is all in gui but labels are not yet. Commented Jun 24, 2016 at 10:30
  • Style would be good for a start! I should probably add I'm using 2.14 Essen at the moment. Commented Jun 24, 2016 at 10:37
  • You can take a look at 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. Commented Jun 24, 2016 at 14:17

1 Answer 1

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_()
answered Jun 24, 2016 at 10:43
1
  • Yes! Needs a canvas.refresh() to reflect changes unless I can add an "apply" button with my Qt skillz... Commented Jun 24, 2016 at 10:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.