1

Inside my Python plugin (qgis2.18) I use some Processing algorithms.

I'm trying to override the Processing setting that allows using only the selected features.
I' want to set it to False and following this answer I use that code inside my plugin before running Processing algs:

QSettings().setValue('/processing/configuration/use_selected', False)

Unfortunately after running my plugin Processing algorithms still working only with selected features.
But if I check Qgis settings I correctly see that :
enter image description here

Some hints about where I'm wrong?

Edit:
I noticed that inside Processing own properties the checkbox is still checked (sorry for Italian menu) and I need to restart Qgis for applying changes.
enter image description here

  • 1
    Does it work if you restart QGIS? – Joseph Sep 12 '18 at 10:08
  • Oh yes. Very disappointing. I can't ask to my users to restart Qgis... I even noticed that inside Processing own properties the checkbox is still checked after running my plugin. I've edited the question. – Oscar Campo Sep 12 '18 at 10:13
1

Try using the following which should change the settings directly within the processing framework (which can be seen in the properties window):

import processing
processing.ProcessingConfig.setSettingValue('USE_SELECTED', False)
  • 1
    Oh man, it works. You've saved my day again. – Oscar Campo Sep 12 '18 at 11:05
  • @OscarCampo - Most welcome, glad it helped :) – Joseph Sep 13 '18 at 9:37

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.