Home turboPC
Python scripts Python tutorial Bouncing dice Diagram editor LRC network simulation
Qt embedded
OS Bootfloppy Go 64 bits Bochs

Qt embedded

Introduction

Qt4 is an application framework by Nokia [1]. It can be used in combination with the PyQt4 python bindings [2]. There is an alternative python binding PySide [3]. Qt has a embedded variant, which only uses the framebuffer. This is especially handy for embedded applications.

Goal of this page is to create a minimal python + qt linux setup using Qt embedded.

Building Qt embedded

Step 1: build qt embedded

$ tar -xzf qt-everywhere-opensource-src-4.7.4.tar.gz
$ cd qt-everywhere-opensource-src-4.7.4
$ ./configure -embedded -no-qt3support -opensource -prefix /usr
$ make
$ sudo make install

Note that this can take some time, so grab a coffee or so :). I made the following bash script and timed it on a 1.8 GHz duo core:

#!/bin/bash
echo "Extracting.."
tar xzf qt-everywhere-opensource-src-4.7.4.tar.gz > /dev/null
DIR=qt-everywhere-opensource-src-4.7.4
cd $DIR
echo "Configuring"
echo "yes" | ./configure -no-qt3support -no-phonon -embedded -opensource -prefix /usr
echo "Building"
make -j2 > /dev/null
echo "Done"

Saving this script as buildAll.sh and running it:

$ time ./buildAll.sh
...
real    79m21.881s
user    136m13.454s
sys     12m26.338s

To check the behavior of a test application, start your pc in framebuffer mode and start a test application:

$ cd demos/textedit
$ ./textedit -qws

The -qws option is required to enable a sort of replacement for the X-server.

To check that we are indeed using the embedded version of Qt, run ldd to check the libraries that are used by the program:

$ ldd textedit
        linux-vdso.so.1 =>  (0x00007fff2ba7c000)
        libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00007f3989c30000)
        libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0x00007f3989921000)
        libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00007f398944f000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f3989232000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3988f27000)
        libm.so.6 => /lib/libm.so.6 (0x00007f3988ca5000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f3988a8f000)
        libc.so.6 => /lib/libc.so.6 (0x00007f398872f000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f3988516000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f3988312000)
        librt.so.1 => /lib/librt.so.1 (0x00007f398810a000)
        /lib/ld-linux-x86-64.so.2 (0x00007f398a8b8000)

As you can see, there is no Xorg related library linked to the executable.

To be continued...

Python bindings

TODO

References

[1] http://qt.nokia.com/
[2] http://www.riverbankcomputing.co.uk/software/pyqt/download
[3] http://www.pyside.org/