[Qt-qml] QML must love binding programmers
Hugo Parente Lima
hugo.lima at openbossa.org
Wed Oct 27 18:02:53 CEST 2010
On Wednesday 27 October 2010 13:58:20 Kristian Mueller wrote:
> Hi Hugo,
>
> we are actually working on something similar here at mixd.tv. Our
> approach is to map Python objects directly into QML using the Qt Meta
> Object System (QDeclarativeOpenMetaObject) and by accessing the
> QScripEngine.
>
> We are using QML for our frontend and the business logic is mostly done
> in Python. Qt is used here for things like:
>
> - Window Creation (+ setting the QML main file)
> - TrayIcon stuff
> - Window movement
> - Drag & Drop Cursor Icons
> - Setting the Mouse Cursor Pixmap
>
> Some of those could actually be implemented as part of QML.
>
> What we'd like our Python <-> QML project to become is a pure QML UI
> Binding for Python. With the modulatization of Qt maybe only needing a
> subset of Qt.
>
> Our approch is not to control QML from Python, but to allow access to
> "normal" Python objects from QML. So actually we don't need
> qmlRegisterType, because we don't need to subclass Qt objects in
> Python.
But we do need qmlRegisterType, because QML bindings must work the same way Qt
does, so we need to be able to export Python types to QML.
If nobody does nothing about, PyQt, PySide, Jambi and Qt-Ruby (among others)
wont be able to fully support QML, the only way I found until now to get this
working is a bit ugly and add some limitation as the number of types you can
export to QML.
Regards;
> Our strategy is to keep direct access to QML from Python low. To convert
> types we are currently using Python-Boost but will remove Boost
> dependencies over time.
>
> We'd see a public release of our code in maybe a month from now.
>
>
> Greetings from Berlin
> Georg & Kristian
> --
> mixd.tv
>
> Am Montag, den 25.10.2010, 19:18 -0200 schrieb Hugo Parente Lima:
> > Hi;
> >
> > I'm working on getting Python (PySide) able to export Python types to QML
> > the same way you can do with C++ types, i.e.:
> >
> > class Foo(QObject):
> > ...
> >
> > qmlRegisterType(Foo, "foo.bar.com", 1, 0, "FooOnQml_huhu")
> >
> > I took a look on QtDeclarative sources and faced some issues to integrate
> > Python or any other language to QML.
> >
> > First, QML uses qmlRegisterType<T> function to register a type, this
> > function just fills a struct with some info and pass it to the depths of
> > QML, one of these fields is a function pointer, this function pointer is
> > used as a factory function by QML to create instances of the exported
> > type T. So what's the problem?
> >
> > Using a template function everything can be decided at compile time, so
> > we have a different factory function for each type exported to QML,
> > perfect for C++ but Qt bindings doesn't have the information about user
> > created types at compile time, so we can't have a factory function for
> > each type created by the user as we have on C++.
> >
> > One way to ease the work of people doing Qt bindings to support QML is
> > adding a bit more info on this factory function, so we can use a Proxy
> > object to decide what type need to be instantiated.
> >
> > I attached a pseudo-patch that implements this idea, pseudo because I
> > wrote it just to show what changes are needed, if I get a thumbs up
> > about it I can work, test and create a merge request for it.
> >
> > Any comments? Any chances to get it or something like it into the
> > mainline for Qt4.7.1?
> >
> > _______________________________________________
> > Qt-qml mailing list
> > Qt-qml at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-qml
--
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101027/fa9e0b97/attachment.bin
More information about the Qt-qml
mailing list