[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Exposing complex Qt objects as javascript objects
From: Ori Avtalion <ori () avtalion ! name>
Date: 2009-04-24 11:49:30
Message-ID: 49F1A74A.7000505 () avtalion ! name
[Download RAW message or body]
On 04/23/2009 03:31 AM, Henning Schröder wrote:
> On Tue, Apr 21, 2009 at 2:15 AM, Ori Avtalion <ori@avtalion.name> wrote:
>> 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")
> Dynamic properties via setProperty use variants but I think it does
> not work correctly for objects and widgets. It seems that the type is
> not set to QMetaType::QObjectStar or QMetaType::QWidgetStar in the
> constructor. At least QtScript does not recognize the variant as a
> object or widget (see app property in attached example - the C++
> equivalent would work this way).
>
Thanks Henning!
setProperty() seems to work fine when I give it a QVariant("{'foo':'bar'}")
However, it means I have both a raw pythonic copy of it, and a QVariant
copy that I can't modify. If I have a large object, I want to avoid
copying it just for that. (I guess I won't use it for large objects)
Any idea why pyqtProperty doesn't accept "QVariant"?
-Ori
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic