Qtopia Home - Classes - Annotated - Functions - Qt Embedded |
|
Qtopia is a windowing system for handheld devices. It offers developers the powerful Qt API, and provides users with fast and intuitive interaction.
Since Qtopia offers the complete Qt API, you can do much of your development on any of the other platforms for which Qt is available: Windows, Unix/X11, or Mac OS X. However, for optimal tailoring of your application to the smaller screen and other limitations of a small device, we recommend that you use the Qtopia SDK.
The Qtopia SDK allows you to develop Qtopia applications under the Linux desktop environment using the Qt Virtual Framebuffer, which completely emulates the handheld Qtopia environment. It also includes cross-compiler software so that you can compile your application to run on the target device. If you do not already have the Qtopia SDK (this document is normally part of the SDK), contact info@trolltech.com, or see the Trolltech web site.
To build applications for the SHARP SL5000 or similar StrongARM-based devices, you will also need a StrongARM cross compiler.
The SDK includes an example application. We recommend that you compile and run this example to learn how things work, before tackling your own projects.
Here are the steps necessary to compile and run the example program on the Linux desktop:
export QPEDIR=/opt/Qtopia export QTDIR=$QPEDIR export PATH=$QTDIR/bin:$PATH export QMAKESPEC=qws/linux-generic-g++ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATHotherwise the following example may be used:
cd ~/buildQtopia export QTOPIA_PREFIX=$PWD export QPEDIR=`echo $QTOPIA_PREFIX/qtopia-*2.*.0` if ! test -d "$QPEDIR";then echo 'A Qtopia directory was not found!';fi export QTDIR="$QTOPIA_PREFIX/qt-2.3.2" export QTEDIR=`echo $QTOPIA_PREFIX/qt-2.3.*` if ! test -d "$QTEDIR";then echo 'A Qt/Embedded directory was not found!';fi export PATH=$QPEDIR/bin/:$QTEDIR/bin:$QTDIR/bin:$PATH export QMAKESPEC=qws/linux-generic-g++ export LD_LIBRARY_PATH=$QPEDIR/lib/$QTEDIR/lib:$QTDIR/lib:$LD_LIBRARY_PATH export QTDIR=$QTEDIRwhere ~/buildQtopia is replaced by the path to the Qtopia prefix directory
cd somewhere cp -r $QPEDIR/examples/application . cd application
qmake -o Makefile example.pro
make
su # root privileges required to install cp example.desktop $QPEDIR/apps/Applications/ cp Example.png $QPEDIR/pics/ cp example $QPEDIR/bin/ cp example.html $QPEDIR/help/html/ exit # no need to be root anymore
qvfb &
qpeYour application should now be available in the Applications tab which is visible inside the Qt Virtual Framebuffer window.
mkipks -rpm -arch i386 example.control
To make your own application, use the example program as a model. Make sure that when you add files to your project, you also add them to your project file (i.e. to example.pro) and rerun the qmake command to update the Makefile whenever you update the .pro file.
To build you application for the SHARP SL5000 rather than just running on the desktop, the process is similar. The example below assumes you have installed the cross compiler in /usr/local/arm.
export QPEDIR=/opt/Qtopia/sharp export QTDIR=$QPEDIR export QMAKESPEC=qws/linux-sharp-g++ export PATH=$QTDIR/bin:/usr/local/arm/bin:$PATHotherwise the following example may be used:
cd ~/buildQtopiaSharp export QTOPIA_PREFIX=$PWD export QPEDIR=`echo $QTOPIA_PREFIX/arm/qtopia-*2.*.0` if ! test -d "$QPEDIR";then echo 'A Qtopia directory was not found!';fi export QTDIR="$QTOPIA_PREFIX/qt-2.3.2" export QTEDIR=`echo $QTOPIA_PREFIX/arm/qt-2.3.*` if ! test -d "$QTEDIR";then echo 'A Qt/Embedded directory was not found!';fi export PATH=$QPEDIR/bin/:$QTEDIR/bin:$QTDIR/bin:/usr/local/arm:$PATH export QMAKESPEC=qws/linux-sharp-g++ export QTDIR=$QTEDIRwhere ~/buildQtopiaSharp is replaced by the path to the Qtopia prefix directory that suits your target device.
make clean qmake -o Makefile example.pro
make
su # root privileges required to install cp example.desktop $QPEDIR/apps/Applications cp Example.png $QPEDIR/pics cp example $QPEDIR/bin cp example.html $QPEDIR/help/html/ exit # no need to be root anymore
su -m # root privileges required to strip the executable mkipks example.control exit # no need to be root anymore
The resulting example-1.0.0.ipk can be installed on the SL5000 using Qtopia Desktop.
Once you have built the example, you can proceed with writing your own applicatons. If you are not familiar with Qt, you should consult the Qt documentation by pointing your web browser at /opt/Qtopia/doc/index.html when you have installed the SDK, or use the online Trolltech Documentation Site. The Qt Whitepaper provides a good overview of, and introduction to, the Qt API.
When you add more files to your application, just edit the project file (e.g. example.pro) and rerun qmake.
The .ui files are Qt Designer user interface files. You can create and edit these using Qt Designer:
designer example.ui
Qt Designer's online documentation (accessible from the links mentioned above) includes a complete tutorial.
| Copyright © 2001-2004 Trolltech | Trademarks | Qtopia version 2.0.1
|