Hi maxx, On 03/17/2015 11:37 PM, emmexx wrote: > Il 03/13/2015 10:50 AM, Matthias Kuhn scrisse: >> Create a python plugin that registers a custom widget like the one in >> the referenced blog post. > > Following your tips I created a plugin that registers a tree widget. > And following the tutorial that you linked I was able to add a > parameter to set the layer that the treewidget should use as a model > (sort of) for data. > > There's only one glitch. I expected that that parameter would be saved > when saving the project and loaded when opening it. But that is not > the case. > > class TreeWidgetWrapperFactory( QgsEditorWidgetFactory ): > ... > def readConfig( self, elem, layer, idx ): > """ Read a config object from an XML element """ > pdb.set_trace() > > config = dict() > config['MyTreeWidget'] = elem.attribute( 'MyTreeWidget' ) > return config > > The readConfig function never runs. I don't understand what could be > wrong because I copied and pasted the tutorial code for that class and > changed only the name of the parameter where to save the configuration > ("MyTreeWidget" instead of "rule".)
I tested and it is not your fault. It's about the python bindings that seem not to support certain C++ constructs (in particular private virtual methods). I have just pushed a fix to master, so if you are working with that your code should run fine now (or with the next nightly). This can also be backported to 2.8.2. I would appreciate a short feedback if it also workd for you. Matthias _______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user