QML

Introduction
QML is the latest experimental feature based on Qt 4.6. If you don't know QML yet, probably you would like to look at this: [url]http://labs.trolltech.com/blogs/2009/11/04/qt-declarative-binaries/[/url]

It's a Javascript like language and allow you to build your own application rapidly. And yes, you don't need to really care about your development platform too much. All you need to do is using QmlViewer to examine your code. That's pretty much the same when you run on the device (though might be slightly different because of resolution and performance. And note that currently it's still highly experimental!)

Building Qt 4.6 with QML
To build Qt with QML support on N900, you need a 32-bit Linux box (better choice is Ubuntu, I am using Karmic, but you can use other versions as well).

I assumed you already have Maemo SDK running (also Nokia closed binary with SGX). Now it's time to download Qt-declarative UI branch: [url]http://qt.gitorious.org/+qt-kinetic-developers/qt/kinetic/commits/kinetic-declarativeui[/url]

Once you unpack it within your scratchbox, say ~/qt-kinetic, create a build directory anywhere you like, e.g.: ~/qt-build, then do the following within scratchbox:

1. execute command 'export PKG_CONFIG_PATH=/usr/lib/pkgconfig; export PKG_CONFIG_SYSROOT=/' 2. edit ~/qt-kinetic/mkspecs/common/g++.conf, and remove -fvisibility=hidden -fvisibility-inlines-hidden, otherwise qemu would crash during compiling. 3. configure Qt with '~/qt-kinetic/configure -platform linux-g++ -release -opengl es -webkit -force-pkg-config --prefix=/opt/qt' 4. make 5. make install

It will take a whole day to compile this sexy devil. Make sure you have brewed the coffee. In case of running into linking problem (or you have trouble to pass EGL test), please try "export SUBLIBS='-lX11 -lXau -lEGL -lGLESv2 ...' ", throwing whatever GCC complains what's missing (I left my laptop in the office, forgive me I am typing this in my plain memory).

Now, you should have the Qt 4.6 DUI binary sitting in your scratchbox. You can either copy those binaries under /opt/qt to your device or mount it as NFS.

Test Run on Device
On this stage, you should be able to write your first QML application.

[CODE]
 * 1) include 
 * 2) include 
 * 3) include 
 * 4) include 

int main(int argc, char *argv[]) {   QApplication a(argc, argv);

QmlView *canvas = new QmlView; QGLFormat format = QGLFormat::defaultFormat; format.setSampleBuffers(false); QGLWidget *glWidget = new QGLWidget(format); // make QmlView use OpenGL ES2 backend. glWidget->setAutoFillBackground(false); canvas->setViewport(glWidget); canvas->setUrl(QUrl::fromLocalFile("/home/user/demos/declarative/flickr/flickr-desktop.qml")); // wherever your qml file is. canvas->execute; canvas->show;

return a.exec; }[/CODE]

Then you will see the program running as same as this demo: [url]http://labs.trolltech.com/blogs/2009/05/13/qt-declarative-ui/[/url]

Attachment is the fresh screenshot as proof! =]

Finally, here are some few notices / limitation of current Qt4.6-QML: 1. Performance is not that great yet. You may suffer some tearing issues. Write your Qt app in full screen mode will give you some boost. 2. Document is bundle inside the source tree. 'make docs' will generate proper document for you. 3. -webkit may crash your qmlviewer under N900 if you wish to try. That's why I wrote the code with QmlView binding. If you want to play with qmlviewer, please remove -webkit from your configuration. 4. All credits go to Qt team. =] Thanks for their help on technical support. If you have any questions / comments, please don't hesitate to visit: [url]http://labs.trolltech.com/blogs/[/url] 5. Happy hacking!