[PyQt] Exposing complex Qt objects as javascript objects
Ori Avtalion
ori at avtalion.name
Tue Apr 21 01:15:20 BST 2009
Hi,
I'm trying to create a Qt object that will be exposed to javascript.
I want that javascript object to be complex: It has nested objects
inside it, and has arrays with other objects in them.
I'm not sure how to define the properties for the top object that I
expose. pyqtProperty doesn't accept "QVariant". (It returns the error
"TypeError: type 'QVariant' is not supported as a property type")
I managed to go around it by defining a function that returns a QVariant:
@pyqtSignature("fun()", result="QVariant")
def fun(self):
return QVariant({"one":1,
"arr":[1,2,{"three":3}],
"obj":{"foo":"bar"}
})
but I'd really like to have "fun" as a property instead of a function.
What's the correct way to define such properties?
Thanks,
Ori
More information about the PyQt
mailing list