Installing Qt and running demos in Maemo 5 SDK
Almost all Qt demos found in normal Qt installation can be used in Maemo. Since the default window style for Qt applications compiled for Maemo is Hildon, your application will follow Hildon style. It is possible to see larger menus, toolbars at bottom of screen, large close (x) button at upper right and so on. in this page it is possible to verify the current status of Qt Hildon widgets. In this article it is described how to install Qt for Maemo SDK 5 and running original Qt demos.
Adding Qt packages to Maemo 5 SDK
If you have already installed Maemo 5 SDK (see Maemo 5 SDK installation for beginners) and want to play with Qt, your next step is to install Qt libraries. Maemo community has a large tutorial about this subject, please check this link. There are pre-compiled binaries available for Debian/Ubuntu in the repository Maemo extras. Just login into scratchbox, add the repositories and install Qt packages.
/scratchbox/login sb-conf se FREMANTLE_X86 echo "deb http://repository.maemo.org/extras/ fremantle free non-free" >> /etc/apt/sources.list echo "deb http://repository.maemo.org/extras-devel/ fremantle free non-free" >> /etc/apt/sources.list apt-get update fakeroot apt-get install libqt4-gui libqt4-dev
The following packages will be installed:
libqt4-assistant libqt4-core libqt4-dbus libqt4-designer libqt4-help libqt4-network libqt4-sql libqt4-svg libqt4-test libqt4-webkit libqt4-xml libqt4-script
It is interesting to add packages for phonon, sqlite and opengl, required in some Qt examples:
fakeroot apt-get install libqt4-phonon libqt4-opengl libqt4-opengl-dev libqt4-sql-sqlite
If you have any network problem during the installation, please check the following issues:
- DNS problems: from a normal Linux shell check if /scratchbox/etc/resolv.conf is properly configured (it is supposed that your scratchbox is installed inside /scratchbox/). If it is wrong, you can copy your Linux resolve.conf using the following command:
cat /etc/resolv.conf | sudo tee /scratchbox/etc/resolv.conf
- Proxy problems: if you are using proxies, it is necessary to configure it for proper APT operation. After logging into scratchbox you can create a file called 99proxy inside /etc/apt/apt.conf.d with the following contents:
Just replace proxy_user, user_passwd, proxy_address and proxy_port by your own proxy settings.
Running Qt demos
For running these demos, start copying original Qt demos from your local Qt installation. For instance, suppose Qt is installed in /opt/qtsdk-2009.04/, you will find the demos at /opt/qtsdk-2009.04/qt/demos/. Besides, your home account inside scratchbox is located at /scratchbox/users/$USER/$HOME/ where $USER and $HOME are environment variables for current logged user name and its home directory. This way, the following command will copy all demos into scratchbox:
cp -a /opt/qtsdk-2009.04/qt/demos/ /scratchbox/users/$USER/$HOME/
Now you can login into scratchbox and compile your demo. For instance, suppose you want to run the textedit demo, do the following:
/scratchbox/login sb-conf se FREMANTLE_X86 cd ~/demos/textedit/ qmake make
Using a Linux terminal, start Xephyr using DISPLAY 2:
Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -kb &
Finally, execute textview demo in scratchbox:
export DISPLAY=:2 af-sb-init.sh start run-standalone.sh ./textedit
In the next screenshots it is possible to see textedit in action.
browser is other interesting demo based on webkit that can be executed in Maemo without modifications.
cd ~/demos/browser/ qmake make run-standalone.sh ./browser