[PyQt] PyQt support for Qt 4.7

Phil Thompson phil at riverbankcomputing.com
Thu Oct 7 16:34:41 BST 2010


On Thu, 7 Oct 2010 00:35:16 +0200, David Boddie <david at boddie.org.uk>
wrote:
> On Tue Oct 5 09:36:49 BST 2010, Phil Thompson wrote:
> 
>> The minehunt example only seems to need support for lists of QObjects.
>> Are
>> there any other examples anywhere that have different use cases?
> 
> I guess that's more or less what it is, though it needs something extra
to
> make the QML engine aware of the new TileData type, used as a property
type
> in the MinehuntGame class, and used as the model that holds the tile
data
> in
> the game. If you can figure out a way to expose homogeneous Python lists
as
> QDeclarativeListProperty containers then that would be cool.

Done that.

> Looking through the examples, there are places where qmlRegisterType is
> used
> to add C++ classes to QML as new item types. The "Writing QML extensions
> with
> C++" tutorial in examples/declarative/tutorials/extending is one of
these.

...and there we hit the showstopper.

It looks like it is not possible to publish Python types to QML (and use
the QML import statement) because QML uses a QObject's staticMetaObject
instead of calling metaObject(). That automatically limits it to types
known at compile time and no way to inject dynamic meta-objects created at
run time.

Phil


More information about the PyQt mailing list