With the release of Qt 4.7.1 and Qt Mobility 1.1.0, both in 9th Nov 2010, their support for QML has greatly improved. This modest guide will assume that none of these tools are installed in the current system.
On the other hand you do need to have a working installation of GNU Compiler.
The following three items are to be installed:
- Qt 4.7.1 (official instructions)
- Qt Creator pre-2.1 (latest snapshot)
- Qt Mobility 1.1.0 (only sources available)
Qt 4.7.1 is installed to /usr/local/Trolltech/Qt-4.7.1, most likely due to historical reasons as the Qt Software section of Nokia used to be an independent company in Oslo, Norway called Trolltech.
./configure -opensource
gmake
sudo gmake installNow it most likely will be that you already have some older version of Qt installed. On the other hand the minor level release such as Qt 4.7 in late September 2010 will take some time for throughout testing, specially in the case of KDE where so many application is based on Qt. Once a package for the given Linux distribution is made, it definitely makes sense to use that and uninstall the custom version that might been installed like previously described above.
Qt Creator comes as a binary file, which is pretty straight forward with its graphical installation wizard. You might need to add executable flag before installing it as a super user.
chmod +x qtcreator-linux-x86-opensource-2...bin
sudo ./qtcreator-linux-x86-opensource-2...binInstalling as a super user will allow other users to use Qt Creator as well. By default it suggest /opt/qtcreator-2.0.94 or similar as the default installation directory.
Last step on the software installation part, is to compile the Qt Mobility module.
./configure -prefix /usr/local/Trolltech/QtMobility -releaseNext step would be to initiate the compile process:
gmakeInstallation:
sudo gmake installLike in the official documentation, the PATH and library linking should be updated.
PATH=/usr/local/Trolltech/QtMobility/bin:$PATH
export PATH
The Qt Mobility API with QML bindings is filled with opportunities, while the following example merely tests the successful installation.
import QtQuick 1.0
import QtMobility.location 1.1
/**
* Map with a simple interaction to change its center
* http://apidocs.meego.com/git-tip/qtmobility/qml-map.html
*/
Rectangle {
width: 800
height: 600
Map {
id: mapArea
anchors.fill: parent
// http://en.wikipedia.org/wiki/Ut%C3%B6,_Finland
center.latitude: 59.783333
center.longitude: 21.366667
connectivityMode: Map.OnlineMode
mapType: Map.TerrainMap
size.width: parent.width
size.height: parent.height
zoomLevel: 14
// No idea where to find a list of possible plugins...
plugin : Plugin {
name : "nokia"
}
MapCircle {
border.color: "pink"
border.width: 2
center: mapArea.center
radius: 1000 // 1 km
}
}
// Change map center to where it was clicked
MouseArea {
anchors.fill: parent
onClicked: {
var pos = mapArea.toCoordinate(
Qt.point(mouse.x, mouse.y));
console.log("alt: " + pos.altitude +
", lat: " + pos.latitude +
", lng: " + pos.longitude);
mapArea.center = pos;
}
}
}
Seems actually that the Map element is not "officially" in the release 1.1.0 but in 1.2.0, at least while looking at the documentation version.
Additionally it might be interesting to browse through the bugs for the API. Please post there if you encounter any problems or errors.






















