1

In pyqgis 2 standalone application, the following code will trigger the display of vertex as red cross mark, but in pyqgis 3.0.3 standalone application, it doesn't:

layer.startEditing()
mapCanvas.refresh()

why is that? Do we have to somehow manually trigger the vertex markers to be displayed?

2

Your code works fine, the likely issue is that there is a default setting which only shows vertices when editing selected features. You can check this by going to:

Settings > Options > Digitizing > Vertex markers

Digitizing settings

Uncheck this and run your code again, the vertices should now show up for all features.

  • this looks promising, just that this is a standalone pyqgis 3 application, how to unset this setting through a function call? – For Comment Aug 23 '18 at 14:37
  • 1
    @ForComment - Maybe try something like: from PyQt5.QtCore import QSettings; QSettings().setValue("/Qgis/digitizing/marker_only_for_selected", False). This works from the console but can't confirm for a standalone application. – Joseph Aug 23 '18 at 14:43
  • 1
    Yes, the QSetting code worked. Just need to do this at the top of the module, then it displays all vertices' markers – For Comment Aug 23 '18 at 15:36
  • @ForComment - Nice one! Glad it helped :) – Joseph Aug 24 '18 at 9:22

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.