[Qt-qml] QML into your Native App: how do you do it?
Alan Alpert
alan.alpert at nokia.com
Wed Mar 31 14:06:11 CEST 2010
Onsdag 31. mars 2010 19:03:26 skrev ext Ivan De Marino :
> Hello.
> The question is in the Subject: How do you package your QML into your
> Native App? Of course, assuming you do have developed a Native App that
> uses QML for the UI.
>
> Myself I'm doing like this.
> 1) I have putted my QMLs into a simple hierarchy of directories, just 2
> levels. This allowed to developed the UI quite "componentized". 2) I
> include every QML and image used from the QMLs into a QRC file. Extension
> for all this stuff will be "/qmls/" 3) QML code refers to images through
> their "qrc://..." path (I'm not really convinced I'm doing it right here
> :-S) 4) I have a QGraphicsView-subclass, a QDeclarativeEngine etc.
> 5) In the QDeclarativeEngine I call "setBaseUrl" and set "qrc:/qmls/" as
> Base URL 6) I load an initial "start.qml", knowing that its "qrc path" is
> "qrc:/qmls/start.qml"
>
> What do you think guys?
> Am I doing something wrong?
> Should I do it differently?
You're doing about what we'd suggest, with the exception of that base URL. You
should be able to simply load qrc:/qmls/start.qml and then any paths inside
the QML (like relative image paths) should use the qrc path automatically.
> It works fine on Linux, Windows and Mac, using the Qt-4.7-tp1 source
> release of few weeks ago. Not 1 problem across all those platforms: in
> fact, I do have good performance and the code is very clean.
>
> I'm struggling to have a version of this running on Maemo 5, but given that
> there are mismatches even in the QML grammar required on Maemo 5 latest
> build respect to the one on Desktop, I guess the "fremantle-4.7" team is
> playing a bit "ahead", catching up quite frequently with the evolution of
> the 4.7 branch. There, on Maemo 5, I have a lot of "undefined/not found"
> components.
>
> Is anyone doing the same kind of experimentation/work with QML?
We've thought about it, but would like to hear about how it goes from someone
actually doing it :) .
--
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks
More information about the Qt-qml
mailing list