I need my property to be typed (Vec2 in my example) so pythonproperty would not help<br><br>in PyQt there is no way to define <br><br><div class="gmail_quote">2009/5/20 Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Wed, 20 May 2009 11:35:04 +0200, cabieces julien <<a href="mailto:jcabieces@free.fr">jcabieces@free.fr</a>><br>
wrote:<br>
<div><div></div><div class="h5">> Hi,<br>
><br>
> I would like to use pyqtProperty with a python class that I have defined.<br>
> example<br>
><br>
> class Vec2(QObject):<br>
> pass<br>
><br>
> ....<br>
><br>
> class Toto(QObject)<br>
><br>
> def getPos(self):<br>
> return self.__x<br>
><br>
> def setPos(self, x)<br>
> self.__x = x<br>
><br>
> pyqtProperty('Vec2', fget=getPos, fset=setPos)<br>
><br>
><br>
> and i get the following error message :<br>
> type 'Vec2' is not supported as a property type<br>
><br>
> I think I have to register a QMetaType but it seems impossible in PyQt.<br>
><br>
> Have you an idea on how I could achieve this.<br>
<br>
</div></div>You only need to use pyqtProperty() to define a new Qt property. As Qt<br>
doesn't know anything about Python classes then pyqtProperty() wouldn't<br>
help.<br>
<br>
Just use the standard Python property().<br>
<font color="#888888"><br>
Phil<br>
<br>
</font></blockquote></div><br>