Qt Embedded
From OpenTom
Some time ago i have succeeded porting Qt Embedded to my TomTom ONE XL. Here i will shortly describe the main steps.
Contents |
To port Qt
You will need:
- A host machine with a cross-compiler - Host_linux_target_ARM;
- Get Tslib library to enable the use of the touchscreen;
- Download and install Qt Embedded;
- Configure and build everything
Building Qt
After downloading and extracting Qt Embedded (I used version 4.4.3), configure it with the following command:
./configure -embedded arm -xplatform qws/linux-arm-g++ -fast -prefix <your target directory> -qt-mouse-tslib -qt-freetype
The -prefix directory refers to two places. First, it refers to the directory on the device where the Qt library files will reside. For instance, setting /mnt/sdcard would mean that lib would be searched for under /mnt/sdcard/lib on the TomTom. This path is hard-coded into the library once compiled and cannot be changed unless a qt.conf file is specified. Second, setting -prefix will also affect qmake if you use it down the road to manage your projects. This can cause include directories to be incorrectly referenced in the makefile that you generate. (So, it may just be best to set -prefix and specify a qt.conf file.)
You may also try disabling some features to make your version smaller - just add corresponding options to the command line above:
-no-phonon -no-webkit -no-nis -no-cups - no-dbus - qconfig minimalAfter configure script finishes, run
make
Now all you have to do is copy the result to your TomTom and assure its in your PATH. One of the ways is to include a special file in a directory with your Qt programs. The file should be named qt.conf. This file is only necessary if the prefix specified during configure does not match where Qt actually resides on the device.
[Paths] Prefix = <path to your Qt directory>
This is just a rough description of what was done. I'm going to get a clean installation on my host machine and build everything again. Then i will be sure i didn't miss anything important.
Running Qt programs
To run your or any of the supplied with Qt demos/samples, the following command is needed:
./MyProgram -qws -display "LinuxFb:/dev/fb"
Touchscreen
To be able to interact with your TomTom running Qt, you will need touch screen library. How to build it is already described on that page:Tslib
Here i will give just few notes related to Qt. First, Qt needs to know where Tslib include files and libraries are located. Make corresponding changes to <your Qt location>/mkspecs/qws/linux-arm-g++/qmake.conf file. Place these lines after any include("") lines if you have them in the file (depends on the version of Qt).
QMAKE_INCDIR = <path to Tslib on your host machine>/include QMAKE_LIBDIR = <path to Tslib on your host machine>/lib
Once you are ready to run some Qt program, define special environment variable specifying which device to use, depending on what your input device file is:
QWS_MOUSE_PROTO="Tslib:/dev/ts"
or, for newer hardware,
QWS_MOUSE_PROTO="Tslib:/dev/input/event0"
What i got
- A running QT Embedded Toolkit;
- A set of supplied examples to play with.
- A simple Qt application for reading texts in txt and html format, based on QTextBrowser class.
To be done
- Port existing Qt applications to TomTom (FBReader is in progress). I have already succeeded porting desktop version to Tomtom. It works ok, but the window with text is quite small, and the UI is not easy to use. So, I plan to put more effort and optimize it for TomTom's screen resoliution
- Optimize speed/memory usage. On my device some test applications are not fast enough. Actually, when running applications in standalone mode, with navigation software off, the performance is quite good. Playing with Qt build options may help as well.
- Any suggestions?

