[PyQt] Python wrappers for QML/ "Qt Quick"?

Giovanni Bajo rasky at develer.com
Tue Mar 9 19:19:55 GMT 2010


On Tue, 2010-03-09 at 19:57 +0100, Attila Csipa wrote:
> On Tuesday 09 March 2010 15:54:54 Ville M. Vainio wrote:
> > On Tue, Mar 9, 2010 at 2:07 PM, Giovanni Bajo <rasky at develer.com> wrote:
> > > It might make more sense to have a way to export PyQt classes to QML,
> > > that is implement QMLElement in Python rather than in C++, and make them
> > > available to QML itself.
> >
> > This is pretty much what I'm thinking of. Python would take the part
> > of C++ here, not Javascript.
> 
> If I understand correctly what you want to do, it has little to do with PyQt, 
> it would be more of a PyQML custom binding... Which is interesting, but sounds 
> like quite a niche to me - it will be hard to avoid Qt parts, and at that 
> point it's much easier to go via the 'main' PyQt path. But, I'm no QML expert 
> (yet :), so take this with a grain of salt, I don't intend to discourage 
> anyone. What might be related, but I also don't know enough about, is what the 
> current state of QtScript is. Is currently it possible to operate on Python 
> objects from QtScript ? 'Cause if it is, QML should not be far off.

Your two examples are unrelated.

QtScript creates an automatic binding between Javascript and C++ using
QObject introspection features. Thus, if you create a Python QObject,
explicitly define signals/slots/properties at the QMetaObject level
through PyQt decorators, the resulting object will be accessible from
QtScript, with QtScript totally ignoring it is a Python object under the
hood.

For a C++ object to be exported to QML, on the other hand, you need an
additional set of meta-definitions which are currently unavailable from
Python. I'm not even sure if those meta-definitions resolves to
*runtime* data that can be dynamically build, as it would be required by
PyQt. Surely, there is more work to be done on the PyQt side.

-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com




More information about the PyQt mailing list