[Interest] QML in larger projects, and "packaging" (KDE-related)

Alan Alpert 416365416c at gmail.com
Thu Dec 27 06:38:45 CET 2012


On Wed, Dec 26, 2012 at 5:59 PM, VStevenP <vstevenpavao at yahoo.com> wrote:
> I'm trying to locate some doc or get some good tips on "packaging" subsets of QML for easy import in big projects.
>
> I saw the syntax of one kind of import used in KDE, from Aaron Seigo's talk at Qt Dev Days.
>
> import "plasmapackage:/code/Foo.js" as Foo
>
> Can any of the KDE developers on the list describe how the "scheme" plasma package resolves?  What are the other parts of the mechanism that make it work, I wonder.  I'm not familiar with this type of import syntax and am wondering how exactly it all works, and I'm not sure where to look in order to learn all what's needed.
>
> I'm really interested in making a "package" of a subset of some QML code, and being able to import it with a particular specified version.  I'd like to understand all the pieces needed to make it work.  Any complete doc or code examples would be highly appreciated, especially if the learning could help make it easier to manage QML in larger projects.

It sounds like you want to create a QML module. The docs for that are
Qt 5: http://qt-project.org/doc/qt-5.0/qtqml/qtqml-modules-topic.html
Qt 4: http://qt-project.org/doc/qt-4.8/qdeclarativemodules.html#qml-modules

If the Qt 5 one is confusing try reading the Qt 4 one (even for Qt 5).
It shouldn't be confusing, but the docs got reorganized between 4 and
5 despite little actually changing about how QML modules work. So the
Qt 4 doc should still be applicable.

IIRC there's also a simple example in
qtdeclarative/examples/qml/plugins which creates a module containing
both C++ and QML types.

The KDE plasma package stuff builds on top of QML modules, so is worth
looking into if you need some functionality that plain QML modules
don't provide. I think the main features plasma packages add is a
bundled file format and better scope for platform independence.

--
Alan Alpert



More information about the Interest mailing list