I recently tried to make creating QDeclarativeItem types with properties and 
such easier to write by using a metaclass. However, even though my metaclass 
inherited from Shiboken.ObjectType and called Shiboken.ObjectType.__new__ to do 
the real work registering the type with QtDeclarative.qmlRegisterType failed 
with 'A shiboken-based python type expected, got Meta' where Meta is the name 
of my metaclass.

I can see why you would do this, but metaclasses allow for the nicest syntax 
for autogenerating properties and the restriction seems a little, well, 
restrictive. Would it be possible to relax this slightly and allow classes 
whose metaclasses inherit from Shiboken.ObjectType to be registered? This would 
greatly improve the metaprogramming possiblities for PySide.

Here's what my end goal was:

class MyType(AutoQItem):
    property1 = AutoProp(str)
    property2 = AutoProp(int, default=10)

    etc...

The resulting class would have fully function properties similar to those in 
the AutoQObject example in the wiki, but with a much nicer syntax for declaring 
them.

Ken Allen
Software Engineer
Scytale, Inc.

________________________________
This e-mail from Scytale Inc and any attachments to it are confidential to the 
intended recipient and may also be privileged or controlled by U.S. export 
control laws and regulations. No technical data, information or other items 
provided by Scytale Inc in connection with this email shall be shared or 
provided to any foreign persons, entities, or subsidiaries without the 
expressed written authorization of Scytale Inc. If you have received it in 
error please notify the sender and delete it from your system. If you are not 
the intended recipient you must not copy it or use it for any purpose nor 
disclose or distribute its contents to any other person.

All communications may be subject to interception or monitoring for operational 
and/or security purposes. Please rely on your own virus checking as the sender 
cannot accept any liability for any damage arising from any bug or virus 
infection.
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to