6

I am trying to temporarily enable the option in QGIS using PyQt4 to suppress the attribute dialog popup after a feature is added. I found an example in the cookbook but it doesn't indicate how to get to existing settings.

11

The procedure is exactly the same. The settings are not documented, so you have to look them up in the code. For your purpose this is /qgis/digitizing/disable_enter_attribute_values_dialog

from qgis.PyQt.QtCore import QSettings

# get user defined current setting
disableDialog = QSettings().value( '/qgis/digitizing/disable_enter_attribute_values_dialog')
# override setting
QSettings().setValue( '/qgis/digitizing/disable_enter_attribute_values_dialog', True )

# do your processing here...

# restore setting
QSettings().setValue( '/qgis/digitizing/disable_enter_attribute_values_dialog', disableDialog )
  • 3
    The API documentation for QSettings at qt-project.org/doc/qt-4.8/qsettings.html mentions a function allKeys() which can be used to get a list of all settings keys. This could potentially be used to create something like the about:config view in Firefox, to get an easy overview of all settings. – til_b Dec 10 '13 at 14:32
  • Matthias, I feel like you are following me! Should the last line have 'True' as the last parameter or 'disableDialog'? – James N Dec 10 '13 at 14:34
  • I follow the qgis tag and answer questions if it doesn't take me a lot of time or if they sound interesting. The last line restores the original user setting retrieved above. – Matthias Kuhn Dec 10 '13 at 14:37
  • From now on I will make sure I make all my questions short and easy then... I just played with the code and see now, thanks. – James N Dec 10 '13 at 14:40
  • I prefer the other way: make them interesting :) you are welcome. – Matthias Kuhn Dec 10 '13 at 14:42

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.