world leader in high performance signal processing
Trace: » qt

QT Embedded

Qt is a cross-platform application framework created and maintained by Trolltech. Using Qt, you can develop applications and user interfaces once, and deploy them across many desktop and embedded operating systems without rewriting the source code. Visit the QT homepage at http://www.qtsoftware.com/ for more information.

QT provides different licensing methods depending on your needs. For people whose project is open source, they can use the free version. For people whose project is closed source, a commercial version is available for you to license. See the QT licensing page for all the gory details at http://www.qtsoftware.com/products/licensing.

The QT documentation can be found at http://doc.trolltech.com/, and every QT source tree includes full documentation as well. Simply browse to the doc/html/ sub directory in the QT distribution. The summary page for embedded Linux is pretty useful as well http://doc.trolltech.com/4.5/qt-embedded-linux.html.

This documentation covers QT as integrated into the uClinux distribution. If you're using an older release, please view Old revisions of this page (see the button in the upper left).

Building

To build QT, just enable it in your user/vendor settings. Depending on what you want to do, the major build options are controlled as sub-QT options.

WebKit is for web browsers (HTML rendering). The QT Virtual Framebuffer is for development when you don't have a real framebuffer to work with, and VNC/ethernet is not an option. If you're interested in testing things or developing your own code, then the demos/examples may be useful to you.

Library Configuration  --->
  [*] Build QT
  [ ]   Build WebKit
  [ ]   Build QT Virtual Framebuffer
  [ ]   Build demos/examples

qconfig

If QT is too big for your needs, you can customize the options that are enabled even further via the qconfig.h header. Support for this header is integrated automatically by putting it into your board's directory: uClinux-dist/vendors/<vendor>/<board>/qconfig-uc.h.

For more information, visit the http://doc.trolltech.com/4.5/fine-tuning-features.html page.

Drivers

Display

If you do not have a QT server running already, then just launch your QT app with the -qws flag to automatically create one for your application.

root:~> some-qt-app -qws

See the http://doc.trolltech.com/4.5/qt-embedded-running.html page for more information.

VNC

Usually if you want to launch a QT app in a VNC session and then connect to it from your desktop, you can use the flag -display VNC:0.

root:~> some-qt-app -qws -display VNC:0

See the http://doc.trolltech.com/4.5/qt-embedded-vnc.html page for more information.

Mouse

Touchscreen

You should consult the tslib documentation first for setting up the proper touchscreen environment.

Then just do:

root:~> export QWS_MOUSE_PROTO=tslib

USB

root:~> export QWS_MOUSE_PROTO=Auto:/dev/input/mice

Serial

For serial mouse on UART0. Make sure there is no console running on the UART you have the mouse hooked up to. Consult the setup serial mouse page for more details.

root:~> stty -F /dev/ttyBF0 ispeed 1200 cs7 -icanon
root:~> export QWS_MOUSE_PROTO=Microsoft:/dev/ttyBF0

QT 4.7

For some new version of QT, we should do following to enable mouse and keyboard:

root:~> export QWS_KEYBOARD=USB:/dev/input/event0
root:~> export QWS_MOUSE_PROTO=USB:/dev/input/event0

QT plugin

While QT is compiled in FDPIC format, dynamic plugins can be used without any problem. But in FLAT format, we can only use static plugins.

The way to use static plugins are importing them in the applications and adding corresponding options in the .pro file of the project. For example, to let pictureflow support jpeg using qjpeg plugin, we need give the following patch:

Index: pictureflow-0.1.0/pictureflow-qt/pictureflow.pro
===================================================================
--- pictureflow-0.1.0/pictureflow-qt/pictureflow.pro    (revision 9290)
+++ pictureflow-0.1.0/pictureflow-qt/pictureflow.pro    (working copy)
@@ -1,7 +1,9 @@
 TARGET = pictureflow
 TEMPLATE = app 
 linux-bfin-flat-* {
-       QMAKE_LIBS_THREAD += -lz -lpng
+       QMAKE_LIBS_THREAD += -lz -lpng -lqjpeg -ljpeg
+       QTPLUGIN += qjpeg
+       CONFIG += static 
 }
 HEADERS = pictureflow.h
 SOURCES = pictureflow.cpp main.cpp
Index: pictureflow-0.1.0/pictureflow-qt/main.cpp
===================================================================
--- pictureflow-0.1.0/pictureflow-qt/main.cpp   (revision 9290)
+++ pictureflow-0.1.0/pictureflow-qt/main.cpp   (working copy)
@@ -30,6 +30,12 @@
 #include <qfileinfo.h>
 #include <qimage.h>
 
+#ifdef QT_STATIC_PLUGIN
+#include <qplugin.h>
+
+Q_IMPORT_PLUGIN(qjpeg)
+#endif
+
 #if QT_VERSION >= 0x040000
 #include <QTime>
 #endif

QT Demos

The demos/examples are all installed into the staging directory uclinux-dist/staging/usr/qt/demos/ and uclinux-dist/staging/usr/qt/examples/. Since they tend to be quite large (~15 megs), they are not installed automatically for you into the romfs directory (and thus the kernel image). Copy over any demos/examples you wish to play with and execute them manually. For simple apps, this may be just the binary.

For example, to run the gradients demo, first copy it to the board with rcp (you'll have to change the IP obviously):

$ rcp staging/usr/qt/demos/gradients/gradients root@192.168.0.15:/bin/

Then just run it on the board:

root:~> gradients -qws

Examples

Demo

Here is a short video which includes some Qt examples:

The Adobe Flash Plugin is needed to display this content.

PictureFlow

PictureFlow compiled for the Blackfin:

root:~> cd /media/picts/
root:/media/picts> pictureflow -qws
Creating mouse: Auto