I get the segfault if I try returning a python list as a QObject, but
the AbstractList does work for me:

http://pastebin.com/VMeg4isb

That's some test code that should work.

Good news is also, you can return python lists as a 'role' from one of
your AbstractList, and it does work, you can also return another
AbstractList as a role and that works too. (there's an example of that
in the test code)


On Fri, Feb 18, 2011 at 10:50 AM, Luca Donaggio <donag...@gmail.com> wrote:
> On Thu, Feb 17, 2011 at 7:52 PM, Aidan O'Kelly <aida...@gmail.com> wrote:
>>
>> 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.
>>
>>
>
> Thanks Aidan to point me in the right direction: so it's a bug in the end,
> and, unfortunaltely, it's not planned for a pre-1.0 release fix :(
> Anyway, your workaround doesn't work for me: specifying the property as a
> QObject lead to a segmentation fault (I tried with a simple python list of
> strings and with the same python list wrapped by a QAbstractListModel
> subclass - same result).
>
> --
> Luca Donaggio
>
_______________________________________________
PySide mailing list
PySide@lists.openbossa.org
http://lists.openbossa.org/listinfo/pyside

Reply via email to