This is a bug guys, http://bugs.openbossa.org/show_bug.cgi?id=629
That bug entry is a bit messy, but that's the bug its describing (python list's cannot be used a QObject properties ) If you print out a list object, from QML, that has been set using setContextProperty, you get something like this: list is:[object Object],[object Object],[object Object] However if you use that list object as a property on a QObject, and print that out, you get: thing.list is:QVariant(PySide::PyObjectWrapper) Now I found this while trying to use QAbstractListModel as a property, which suffers the same problem, however there is a workaround for that, you simply specify the property as 'QObject' type and it all works fine. Aidan. On Thu, Feb 17, 2011 at 9:45 AM, Luca Donaggio <donag...@gmail.com> wrote: > On Wed, Feb 16, 2011 at 5:57 PM, Hugo Parente Lima <hugo.l...@openbossa.org> > wrote: >> >> On Wednesday 16 February 2011 14:09:24 Thomas Perl wrote: >> > Hi Luca, >> > >> > 2011/2/16 Luca Donaggio <donag...@gmail.com>: >> > > On Wed, Feb 16, 2011 at 4:43 PM, Thomas Perl <th.p...@gmail.com> >> > > wrote: >> > >> 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. >> > > >> > > 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? >> >> Maybe this would help: >> >> http://lists.openbossa.org/pipermail/pyside/2010-December/001585.html >> >> -- >> Hugo Parente Lima >> INdT - Instituto Nokia de Tecnologia > > Thanks Hugo, it definetly helps! > > But... I can't find any documentation about QtDeclarative.ListProperty, are > there any example? The PieChart one is nice, but it doesn't really answer > one question: I have a python list and its getter method (it would be a > read-only property, so I don't need to append anything from QML), how do I > use ListProperty to just let QML *read* my property? > > -- > Luca Donaggio > > _______________________________________________ > PySide mailing list > PySide@lists.openbossa.org > http://lists.openbossa.org/listinfo/pyside > > _______________________________________________ PySide mailing list PySide@lists.openbossa.org http://lists.openbossa.org/listinfo/pyside