On Wed, Feb 16, 2011 at 4:43 PM, Thomas Perl <[email protected]> wrote:
> Hi Luca, > > 2011/2/16 Luca Donaggio <[email protected]>: > > [...] > > From QML I can access all other "basic types" properties, but when I try > to > > do anything with the python list, It doesn't work. > > Let's say my QObject is exposed as "myObj" to QML and "myList" is the > > property which holds the python list, neither looping through its > elements: > > > > for (var i = 0;i<myObj.myList.length;i++) {} > > > > nor accessing a random element directly: > > > > Text {text: myObj.myList[1]} > > > > are working (the latter causing the error "Unable to assign [undefined] > to > > QString text"). > > > > How am I supposed to do this? > > Which version of PySide are you using? Also, for me it works when > setting a Python list as context property directly; I haven't tried > with properties on QObjects, though. > > Thomas > Sorry, I should have mentioned it in my first post! I'm using PySide 1.0.0~beta5 for Maemo. Unfortunately I can't set the list as a context property, as I need it from within a ListModel. Actually I'm setting it with something like this inside the QObject subclass: myList = Property(list, _myList, notify = changed) Maybe the "list" type is not the correct one? -- Luca Donaggio
_______________________________________________ PySide mailing list [email protected] http://lists.openbossa.org/listinfo/pyside
