Probably you would like to have a look at BUG 629:

http://bugs.pyside.org/show_bug.cgi?id=629


On Thu, Sep 29, 2011 at 7:32 PM, Thomas Liennard
<[email protected]>wrote:

> Hi,
> I have a QObject derived class with a list property that I want to expose
> to qml. I tried to use ListProperty with code like this:
>
> def property_at(self,index):
>         if index>=len(self.alliance.members):
>             return None
>         return self.mylist[index]
> def property_count(self):
>         return len(self.mylist)
> def property_append(self,item):
>         self.mylist.append(item)
> liste=ListProperty(unicode,append=property_append,count=property_count,at=property_at)
>
>
> then I put my object in the QDeclarative context and load a qml file that
> tries to use myobject.liste as a model. When load the qml file python
> crashes. Has anybody succeeded in exposing a list to qml using ListProperty?
> I may get away with using a QAbstractItemModel but this looks like an ugly
> kludge.
>
> _______________________________________________
> PySide mailing list
> [email protected]
> http://lists.pyside.org/listinfo/pyside
>
>

-- 
Luca Donaggio
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to