Native Application Development With Qt

1,934 views
1,871 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,934
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Native Application Development With Qt

  1. 1. Native application development with Qt Hands on development of Qt application Rahul Nimbalkar
  2. 2. Agenda <ul><li>Qt on desktop and maemo </li></ul><ul><li>Qt Creator </li></ul><ul><li>Developing Qt application for N900 </li></ul><ul><li>Usage of accelerometer API’s for Qt application </li></ul><ul><li>X86 usage for device emulator </li></ul><ul><li>Debian packaging </li></ul><ul><li>Deploying on N900 </li></ul><ul><li>Links </li></ul>
  3. 3. Qt on desktop and maemo <ul><li>Qt is a cross-platform application and UI framework. </li></ul><ul><li>Write applications once and deploy across desktop, mobile and embedded OS without rewriting the source code </li></ul><ul><li>Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language </li></ul><ul><li>Use of native UI-rendering APIs </li></ul><ul><li>Meta object compiler </li></ul><ul><ul><li>Meta information is used to provide the signal/slot system </li></ul></ul>
  4. 4. Qt on desktop and maemo <ul><li>Maemo is like any Linux distro </li></ul><ul><li>Most of applications can be compiled to Maemo without any modifications </li></ul><ul><li>Maemo is mobile optimized and Qt applications should be mobile optimized as well </li></ul><ul><li>Maemo Qt4 port for adding maemo/hildon mobile optimizations to Qt </li></ul>
  5. 5. Qt Creator <ul><li>Qt Creator is a new cross-platform (IDE) </li></ul><ul><li>An advanced C++ code editor </li></ul><ul><li>Integrated GUI layout and forms designer </li></ul><ul><li>Project and build management tools </li></ul><ul><li>Integrated, context-sensitive help system </li></ul><ul><li>Visual debugger </li></ul><ul><li>Rapid code navigation tools </li></ul><ul><li>Supports multiple platforms </li></ul>
  6. 6. Developing Qt application for N900 <ul><li>Developing Qt for device is similar to desktop application </li></ul><ul><li>Qt Creator can be used for developing UI </li></ul><ul><li>Signal/slots and basic coding can be done on desktop app </li></ul><ul><li>Create device specific skeleton code </li></ul><ul><li>Hildonized Menu for application </li></ul>
  7. 7. Accelerometer API for application <ul><li>MCE – Mode Control Entity </li></ul><ul><li>Fremantle provides an accelerometer API through two interfaces: </li></ul><ul><ul><li>D-Bus </li></ul></ul><ul><ul><li>sysfs - /sys/class/i2c-adapter/i2c-3/3-001d/coord </li></ul></ul>
  8. 8. Accelerometers application
  9. 9. Class Diagram meters «inherits» MCE «signal/slots» «Dbus/callback» CAccelerometerNotifier QMainWindow Ui::meters centralwidget: QWidget*
  10. 10. X86 usage for device emulator <ul><li>Outside scratchbox execute </li></ul><ul><ul><li>Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -kb & </li></ul></ul><ul><li>Create directory in scratchbox and copy desktop project to: </li></ul><ul><ul><li>/scratchbox/users/username/home/username/MyDocs/appname-0.1 </li></ul></ul><ul><li>Set up UI framework </li></ul><ul><ul><li>export DISPLAY=:2 </li></ul></ul><ul><ul><li>af-sb-init.sh start </li></ul></ul><ul><li>Execute following commands </li></ul><ul><ul><li>qmake && make </li></ul></ul><ul><ul><li>run-standalone ./appname </li></ul></ul>
  11. 11. Debian packaging <ul><li>Create directory by name as appname-0.1 </li></ul><ul><li>Edit *.pro file to add following lines </li></ul><ul><ul><li>target.path = /opt/maemo/usr/bin/ – executable path on device </li></ul></ul><ul><ul><li>INSTALLS += target – added to generate Makefile with this path </li></ul></ul><ul><ul><li>desktop.files = appname.desktop </li></ul></ul><ul><ul><li>desktop.path = /opt/maemo/usr/share/applications/hildon </li></ul></ul><ul><ul><li>INSTALLS += desktop </li></ul></ul><ul><li>qmake – generate make files </li></ul><ul><li>make – compile the source code </li></ul><ul><li>dh_make –e [email_address] –r –s </li></ul><ul><ul><li>Creates all the required files for debian packaging in ‘debian’ directory </li></ul></ul>
  12. 12. Debian packaging Contd… <ul><li>Edit debian/rules </li></ul><ul><ul><li>Add qmake-qt4 PREFIX=/opt/maemo/usr meters.pro in Make section </li></ul></ul><ul><ul><li>Rename DEST_DIR to INSTALL_ROOT </li></ul></ul><ul><li>Edit debian/control </li></ul><ul><ul><li>Add maintainer name </li></ul></ul><ul><ul><li>Add icons for application manager menu </li></ul></ul><ul><li>dpkg-buildpackage –rfakeroot –us –uc </li></ul><ul><ul><li>Final step for creating debian package </li></ul></ul><ul><ul><li>Package is created at one level up of current directory </li></ul></ul>
  13. 13. Deploying on N900 <ul><li>Copy deb package to device </li></ul><ul><li>Open Xterm on device </li></ul><ul><li>Execute </li></ul><ul><ul><li>sudo gainroot </li></ul></ul><ul><ul><li>Navigate to MyDocs </li></ul></ul><ul><ul><li>dpkg –i meters_0.1-1_armel.deb </li></ul></ul><ul><li>Launch Meters from More… in main application menu </li></ul>
  14. 14. Links <ul><li>http://wiki.maemo.org/Packaging_a_Qt_application </li></ul><ul><li>http://qt4.garage.maemo.org </li></ul><ul><li>http://qt.nokia.com </li></ul><ul><li>http://doc.trolltech.com </li></ul><ul><li>[email_address] </li></ul>

×