I have a problem with QGIS 2.4 when introducing layers with a custom UI. More precisely, widgets such as CheckBoxes are not recognised as such (appear as Text Edit in Attributes) and the corresponding Checked value appears as NULL (although checked by default in the UI file).
When I am manually changing the specific field:
instudy_id = layer.fieldNameIndex("instudy")
layer.setEditorWidgetV2(instudy_id, 'CheckBox')
Everything is normal. The corresponding part of the UI file is:
Sorry if my explanation is poor, I am quite new to QGIS. Hope the screenshots help.
To conclude:
some options of my Widgets (defined in my .ui file) are overwritten by QGIS (e.g. "Checked" or "Unchecked" state of a QCheckBox)
others, which are introduced in the corresponding .py file (like QgsEditorWidgetWrapper.fromWidget( in study ).setEnabled(False) ) are not respected by QGIS.
What is the proper way to introduce a custom / customise an .ui file ? Is there anywhere detailed information/examples on the use of newer methods like QgsVectorLayer.setEditorWidgetV2, setEditorWidgetV2Config, QgsEditorWidgetWrapper ?
No comments:
Post a Comment