Qt S60 Technical Presentation Fn Stripped


Published on

Public webinar in Dec 2008 about Qt for S60 - by Eero Penttinen and Pekka Kosonen

Published in: Technology, Business
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Qt S60 Technical Presentation Fn Stripped

  1. 1. Qt on S60 Webinar Introduction to Qt – Eero Penttinen Qt on S60 – Eero Penttinen Hands-on Session with Qt on S60 – Pekka Kosonen
  2. 2. Qt in Depth A technical look at the Qt cross-platform application framework Eero Penttinen Qt on S60 Program Manager
  3. 3. <ul><li>Introducing Qt </li></ul><ul><li>The Qt Library </li></ul><ul><li>Qt Development Tools </li></ul><ul><li>How to Get Started? </li></ul>Contents
  4. 4. Cross-platform application framework <ul><li>Qt is a cross platform application framework. </li></ul><ul><li>It includes: </li></ul><ul><ul><li>Intuitive C++ class library </li></ul></ul><ul><ul><li>Integrated development tools </li></ul></ul><ul><ul><li>Support for C++ and Java™ development </li></ul></ul><ul><ul><li>Support for desktop and embedded development </li></ul></ul>
  5. 5. <ul><li>Introducing Qt </li></ul><ul><li>The Qt Library </li></ul><ul><li>Qt Development Tools </li></ul><ul><li>How to Get Started? </li></ul>Contents
  6. 6. C++ Application Framework <ul><li>Qt includes an intuitive API and an intuitive C++ class library with a rich set of application build blocks for C++ development. Qt goes beyond C++ in the areas of inter-object communication and flexibility for advanced GUI development. </li></ul><ul><li>The standard C++ object model provides very efficient runtime support for the object paradigm, however its static nature is inflexible in some respects. By combining the speed of C++ with the flexibility of the Qt Object Model, Qt provides both runtime efficiency and a high level of flexibility for GUI programming. Qt goes beyond C++ to add the following features: </li></ul><ul><ul><li>A very powerful mechanism for seamless object communication called signals and slots </li></ul></ul><ul><ul><li>Queryable and designable object properties </li></ul></ul><ul><ul><li>Powerful events and event filters </li></ul></ul><ul><ul><li>Contextual string translation for internationalization </li></ul></ul><ul><ul><li>Sophisticated interval driven timers that make it possible to elegantly integrate many tasks in an event-driven GUI </li></ul></ul><ul><ul><li>Hierarchical and queryable object trees that organize object ownership in a natural way </li></ul></ul><ul><ul><li>Guarded pointers (QPointer) that are automatically set to 0 when the referenced object is destroyed </li></ul></ul><ul><ul><li>A dynamic cast that works across library boundaries </li></ul></ul>
  7. 7. Overview <ul><li>The Qt class library encompasses all the functions needed to build robust, high-end applications </li></ul><ul><li>Separated into several modules, Qt’s intuitive API includes </li></ul><ul><ul><li>Core Classes </li></ul></ul><ul><ul><li>GUI Classes </li></ul></ul><ul><ul><li>SQL Database Classes </li></ul></ul><ul><ul><li>XML Classes </li></ul></ul><ul><ul><li>Networking Classes </li></ul></ul><ul><ul><li>OpenGL ® Classes </li></ul></ul><ul><ul><li>Qt WebKit Integration </li></ul></ul><ul><ul><li>Multimedia classes </li></ul></ul><ul><ul><li>And more </li></ul></ul>
  8. 8. Qt Core Classes <ul><li>Qt core modules and utility classes </li></ul><ul><ul><li>Qt kernel: Object model, event handling </li></ul></ul><ul><ul><li>Basic input / output: File, IO, Streams </li></ul></ul><ul><ul><li>Threading </li></ul></ul><ul><ul><ul><li>Signals and slots support, atomic reference counting, per-thread event loops </li></ul></ul></ul><ul><ul><li>Container classes </li></ul></ul><ul><ul><ul><li>For storing, sorting and retrieving groups of data </li></ul></ul></ul><ul><ul><ul><li>Robust, easy to use, low memory overhead, highly optimized </li></ul></ul></ul><ul><ul><ul><li>Alternative to STL (but Qt and STL work well together) </li></ul></ul></ul><ul><ul><li>Fast XML stream reader and writer </li></ul></ul><ul><ul><li>IPC classes </li></ul></ul><ul><ul><ul><li>shared memory, local domain sockets, memory mapped files </li></ul></ul></ul><ul><ul><li>Supporting tools: qmake, rcc, configure, moc </li></ul></ul>
  9. 9. Concurrency Framework in Core Module <ul><li>Provides an abstraction on top of multithreading </li></ul><ul><li>Write multithreaded programs without using basic synchronization primitives such as mutexes and wait conditions </li></ul><ul><li>Reduces the programmer’s need to deal with thread management </li></ul><ul><li>Provides approximation of required threads for the available hardware </li></ul><ul><li>Software scales without recompilation </li></ul>
  10. 10. Signals and Slots in Core Module <ul><li>Unique inter-object communication mechanism provides </li></ul><ul><ul><li>Type-safe callback between objects </li></ul></ul><ul><ul><li>Facilitates loose coupling / encapsulation </li></ul></ul><ul><ul><ul><li>Sender and receiver does not “know about” each other </li></ul></ul></ul><ul><ul><li>1-to-many, many-to-1 communication between objects </li></ul></ul><ul><ul><li>Works across threads </li></ul></ul><ul><li>Fully object-oriented </li></ul><ul><li>A signal is emitted when a particular event occurs. A slot is a function that is called in response to a particular signal. </li></ul>
  11. 11. Qt GUI Classes <ul><li>Provides rich set of GUI components and supporting functionality </li></ul><ul><ul><li>User interface components </li></ul></ul><ul><ul><ul><li>Simple to complex widgets and controls, dialogs </li></ul></ul></ul><ul><ul><li>Model-View-Controller (MVC) Itemviews </li></ul></ul><ul><ul><li>Styles – ensuring native or custom look and feel on target platform(s) </li></ul></ul><ul><ul><li>Font-aware layout system </li></ul></ul><ul><ul><li>Accessibility classes </li></ul></ul><ul><ul><li>Canvas component with Widget support </li></ul></ul>
  12. 12. Qt Database Classes <ul><li>Provide platform and database- independent access functionality </li></ul><ul><li>Driver Layer </li></ul><ul><ul><li>Low-level bridge between specific databases and the SQL API layer </li></ul></ul><ul><li>SQL API Layer </li></ul><ul><ul><li>Provide access to databases </li></ul></ul><ul><li>User Interface Layer </li></ul><ul><ul><li>Link data from a database to data-aware widgets </li></ul></ul><ul><li>Supports most major database drivers </li></ul><ul><ul><li>DB2, IBASE, MySQL, OCI, ODBC, PSQL, SQLITE, TDS </li></ul></ul>
  13. 13. Qt Networking Classes <ul><li>Provides TCP/IP networking functionality </li></ul><ul><li>TCP sockets for clients and for servers </li></ul><ul><li>Encapsulates TCP and UDP APIs </li></ul><ul><li>SSL support </li></ul><ul><li>HTTP 1.1 compliant asynchronous API </li></ul><ul><li>FTP, DNS implementation </li></ul>
  14. 14. <ul><li>Allows you to build your user interface in Qt, display and manipulate 3D model in OpenGL ® </li></ul><ul><li>Integrates OpenGL canvas with Qt </li></ul><ul><li>Provides frame buffer and pixel buffer abstraction </li></ul><ul><li>Supports accelerating 2D painting with OpenGL </li></ul><ul><li>Mix 2D painting and 3D scenes </li></ul>Qt OpenGL Classes
  15. 15. Qt XML Classes <ul><li>Core Module </li></ul><ul><ul><li>Simple XML stream reader and writer </li></ul></ul><ul><li>XML Module </li></ul><ul><ul><li>A well-formed XML parser using the SAX2 (Simple API for XML) interface </li></ul></ul><ul><ul><li>Implementation of the DOM Level 2 (Document Object Model) </li></ul></ul><ul><li>XmlPatterns module </li></ul><ul><ul><li>An implementation of the XQuery standard </li></ul></ul><ul><ul><li>Enable users to query XML files similar to SQL </li></ul></ul><ul><ul><li>Semantics for value assignment, filtering, and simple operations </li></ul></ul><ul><ul><li>Fully controllable output formatting </li></ul></ul>
  16. 16. Qt WebKit Integration <ul><li>An open source HTML rendering component integrated with Qt </li></ul><ul><li>Web standards compliant </li></ul><ul><ul><li>support for HTML, XHTML, XML, stylesheets, JavaScript, HTML editing, HTML canvas, AJAX, XSLT, XPath, some SVG. </li></ul></ul><ul><li>Deployable wherever Qt is: cross-platform/cross-version/cross-device </li></ul><ul><li>Interact with Web environment, expose native objects </li></ul><ul><li>NPAPI (Flash) support coming in Qt 4.5 </li></ul>
  17. 17. Phonon Multimedia Framework <ul><li>Single, easy to use API (”Phonon”) for playback </li></ul><ul><li>Provides possibility to play/synchronize multiple sound/video streams </li></ul><ul><li>Will use native back-end format support </li></ul><ul><ul><li>DirectShow on Windows </li></ul></ul><ul><ul><li>GStreamer on X11 </li></ul></ul><ul><ul><li>QuickTime on Mac </li></ul></ul><ul><li>Plan to add more video and authoring support in the future </li></ul>
  18. 18. <ul><li>Introducing Qt </li></ul><ul><li>The Qt Library </li></ul><ul><li>Qt Development Tools </li></ul><ul><li>How to Get Started? </li></ul>Contents
  19. 19. <ul><li>Qt Designer: GUI layout and forms builder </li></ul><ul><li>Qt Linguist: Internationalization toolset </li></ul><ul><li>Qt Assistant: Customizable documentation reader </li></ul><ul><li>qmake: Cross-platform build tool </li></ul><ul><li>Integration with Visual Studio ® and Eclipse ® IDEs </li></ul>Development Tools: Overview
  20. 20. Qt Designer <ul><li>Qt Designer is a powerful, drag-and-drop GUI layout and forms builder </li></ul><ul><li>Features </li></ul><ul><ul><li>Supports forms and dialog creation with instant preview </li></ul></ul><ul><ul><li>Integrates with Qt layout system </li></ul></ul><ul><ul><li>Extensive collection of standard widgets </li></ul></ul><ul><ul><li>Support for custom widgets and dialogs </li></ul></ul><ul><ul><li>Seamless integration with Microsoft ® Visual Studio .NET and Eclipse </li></ul></ul><ul><li>Benefits </li></ul><ul><ul><li>Greatly speeds the interface design process </li></ul></ul><ul><ul><li>Enables native look and feel across all supported platforms </li></ul></ul><ul><ul><li>Developers work within the environment of their choice, leveraging existing skills </li></ul></ul>
  21. 21. <ul><li>Qt Linguist is a set of tools that smooth the internationalization workflow </li></ul><ul><li>Features </li></ul><ul><ul><li>Collects all UI text and presents it to a human translator in a simple window </li></ul></ul><ul><ul><li>Support for all languages, including CJK </li></ul></ul><ul><ul><li>Simultaneous support for multiple languages and writing systems from within a single application binary </li></ul></ul><ul><li>Benefits </li></ul><ul><ul><li>Greatly speeds the translation/localization process </li></ul></ul><ul><ul><li>Works with Qt’s language-aware layout engine for clean, consistent interface no matter the language </li></ul></ul><ul><ul><li>Easily target international markets </li></ul></ul>Qt Linguist
  22. 22. Qt Assistant <ul><li>Qt Assistant is a fully customizable, redistributable help file/documentation browser </li></ul><ul><li>Features </li></ul><ul><ul><li>Simple, web-browser-like navigation, bookmarking and linking of documentation files </li></ul></ul><ul><ul><li>Support for rich text and HTML </li></ul></ul><ul><ul><li>Full text and keyword lookup </li></ul></ul><ul><ul><li>Can be customized and shipped with Qt applications </li></ul></ul><ul><li>Benefits </li></ul><ul><ul><li>No longer have to build a help system from scratch </li></ul></ul><ul><ul><li>Leverage existing HTML skills </li></ul></ul><ul><ul><li>Deliver documentation in an easily searchable and navigable format to your end users </li></ul></ul>
  23. 23. qmake <ul><li>A cross-platform application build tool </li></ul><ul><li>Features </li></ul><ul><ul><li>Reads project source, generates dependency tree, generates platform specific project and makefiles </li></ul></ul><ul><ul><li>Integrates with Visual Studio and Xcode </li></ul></ul><ul><li>Benefits </li></ul><ul><ul><li>Takes the pain out of cross-platform builds </li></ul></ul><ul><ul><li>Eliminates the need for makefile generation </li></ul></ul>
  24. 24. IDE Integrations <ul><li>Integration for Microsoft Visual Studio 2003, 2005 and 2008 </li></ul><ul><li>Integration for Eclipse </li></ul><ul><li>Provides Qt API integration, Qt Designer and Qt Documentation </li></ul><ul><li>Class Wizard </li></ul><ul><li>Project Wizard </li></ul><ul><li>Import and Export to Qt .pro files </li></ul><ul><li>Qt version management </li></ul>
  25. 25. <ul><li>Introducing Qt </li></ul><ul><li>The Qt Library </li></ul><ul><li>Qt Development Tools </li></ul><ul><li>How to Get Started? </li></ul>Contents
  26. 26. How to Get Started? <ul><li>The best place to get started with Qt development is Qt SW units web page www.trolltech.com </li></ul>
  27. 27. Qt on S60 A technical look in Qt on S60
  28. 28. Disclaimer <ul><li>Note that Qt on S60 is not ready yet! </li></ul><ul><li>What is released is an early technical pre-release with limited functionality for early adopters. </li></ul><ul><li>Some of the presented functionality may change in the final release. </li></ul>
  29. 29. <ul><li>Introducing Qt on S60 </li></ul><ul><li>Build Process </li></ul><ul><li>Symbian Concepts </li></ul><ul><li>Carbide.c++ support </li></ul>Contents
  30. 30. Qt on S60 <ul><li>Qt Software announced in October the porting of Qt to S60 on Symbian OS(TM), the world's leading, open smartphone platform. </li></ul><ul><li>An early technical preview of Qt for S60 is available for download from Qt Software current website www.trolltech.com. This is in line with Qt Software's usual approach of developing Qt openly and working with the community to incorporate feedback throughout the entire development process. Qt on S60 will work with S60 3rd Edition Feature Pack 1 and later releases. The first production release of Qt for S60 will be available in the second quarter of 2009. </li></ul><ul><li>With the inclusion of the S60 platform, developers have an additional 80 million target devices that they can support with their Qt-based applications. </li></ul>
  31. 31. Qt on S60 Total Offering <ul><li>Qt on S60 port – Qt 4.5 ported to S60 3 rd Edition FP 1 and FP 2, 5 th edition and also coming S60 platform editions. </li></ul><ul><ul><li>Currently, the Qt on S60 pre-release is based on Qt 4.4, but final release will be based on Qt 4.5. </li></ul></ul><ul><li>Carbide.c++ 2.0 supporting Qt/S60 development. </li></ul><ul><ul><li>Fully integrated form editor ( Qt Designer ) </li></ul></ul><ul><ul><li>Wizards for creating new Qt projects and classes </li></ul></ul><ul><ul><li>Integrated .pro file editor </li></ul></ul><ul><ul><li>Automated build setup for moc, uic, and rcc </li></ul></ul><ul><li>Examples and additional documentation available in Forum Nokia </li></ul><ul><li>And more to come… </li></ul>
  32. 32. Licensing <ul><li>There have been lot of speculation and concerns of used licensing model. </li></ul><ul><li>The current release is under Commercial Tech Preview license which allows evaluating and testing only. </li></ul><ul><li>We intend to make Qt available for the Symbian platform free of charge. Details to be announced. </li></ul>
  33. 33. Current Release <ul><li>The release is called Temple with following functionality </li></ul><ul><ul><li>QtCore, </li></ul></ul><ul><ul><li>QtGui (full-screen only, no S60 UI integration nor support for inputs), </li></ul></ul><ul><ul><li>QtNetwork, </li></ul></ul><ul><ul><li>QtScript, </li></ul></ul><ul><ul><li>QtSvg, </li></ul></ul><ul><ul><li>QtXml </li></ul></ul><ul><ul><li>qmake enhancements allowing integration with Symbian tool chain </li></ul></ul><ul><li>The next release, Garden, will provide the rest of the QtGui module, including a new S60 style and input methods. </li></ul><ul><li>Where to get it: http://pepper.troll.no/s60prereleases/ </li></ul>
  34. 34. <ul><li>Introducing Qt on S60 </li></ul><ul><li>Build Process </li></ul><ul><li>Symbian Concepts </li></ul><ul><li>Carbide.c++ support </li></ul>Contents
  35. 35. Build Process <ul><li>The contents of a project are described in a project file that is the master file of the project. Generally it lists the source and header files, configuration information, and application-specific details (such as libraries and include paths). </li></ul><ul><li>A default project file can be generated from known extension (.h, .cpp, .ui etc) using the command </li></ul><ul><ul><li>qmake -project </li></ul></ul><ul><li>Qt’s .pro files are the master files used in Qt/S60. Symbian build files are generated by the qmake command and should never be manually edited. </li></ul><ul><li>Building a Qt application on the S60 platform differs from building an S60 application only at the beginning of the toolchain . We intend to provide a wrapper makefile as well as part of coming releases. </li></ul>
  36. 36. Build Process <ul><li>qmake generates Symbian specific bld.inf, mmp files, default registration file, extension makefiles and package files based on the project file. </li></ul><ul><li>Extension makefiles are used to integrate Qt-specific tools like moc, uic and rcc to the Symbian toolchain. </li></ul>
  37. 37. Symbian Extensions to Project Files <ul><li>A Qt application on S60, is a Symbian application written in Qt running on S60 devices. Some Symbian specific settings are needed in .pro files. </li></ul><ul><li>Target type is specified using TEMPLATE and CONFIG variables in the .pro file. </li></ul><ul><ul><li>TEMPLATE = app value maps to target type EXE in MMP file, </li></ul></ul><ul><ul><li>TEMPLATE = lib , CONFIG variable is used to distinguish between lib and dll target types. </li></ul></ul><ul><li>Name of application executable – use TARGET statement in .pro file (maps to TARGET in MMP file) </li></ul><ul><li>Symbian specific definitions in the project file should be separated from other definitions using a Symbian keyword. Example: </li></ul><ul><ul><li>symbian: { </li></ul></ul><ul><ul><li>TARGET.UID2 = 0x100039CE </li></ul></ul><ul><ul><li>TARGET.UID3 = 0xA000017F </li></ul></ul><ul><ul><li>} </li></ul></ul>
  38. 38. Symbian Extensions to Project Files <ul><li>Some other examples of Symbian specific keywords: </li></ul><ul><ul><li>TARGET.SID = 0xA000017F </li></ul></ul><ul><ul><li>TARGET.VID = 0x70000001 </li></ul></ul><ul><ul><li>TARGET.EPOCSTACKSIZE = 0x5000 // 20kb </li></ul></ul><ul><ul><li>TARGET.EPOCHEAPSIZE = “0x20000 0x1000000 // Min 128kb, Max 16Mb” </li></ul></ul><ul><ul><li>TARGET.CAPABILITY = NetworkServices </li></ul></ul><ul><li>If other platform-specific libraries need to be added to the project, this can be done by adding the LIBS variable to the project file with the appropriate library name preceded with a ‘–l’ prefix: </li></ul><ul><ul><li>LIBS += -lbitgdi –lfbscli </li></ul></ul><ul><li>QMAKE_CXXFLAGS can be used for setting compiler-specific options. The keyword is followed by the specific compiler: </li></ul><ul><ul><li>QMAKE_CXXFLAGS.CW += -O2 </li></ul></ul><ul><ul><li>QMAKE_CXXFLAGS.ARMCC += -O0 </li></ul></ul>
  39. 39. Symbian Extensions to Project Files <ul><li>The DEFINES keyword can be used to add MACRO statements to the mmp file. </li></ul><ul><li>The DEPLOYMENT keyword is used to specify additional files that need to be deployed. </li></ul><ul><ul><li>symbian: { </li></ul></ul><ul><ul><li>addFiles.sources = helloworld_fi.qm helloworld_en.qm </li></ul></ul><ul><ul><li>addFiles.path = . </li></ul></ul><ul><ul><li>DEPLOYMENT += addFiles </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>Lot of other keywords are supported, see the Qt/S60 documentation for more details. </li></ul>
  40. 40. <ul><li>Introducing Qt on S60 </li></ul><ul><li>Build Process </li></ul><ul><li>Symbian Concepts </li></ul><ul><li>Carbide.c++ support </li></ul>Contents
  41. 41. Platform Security <ul><li>All platform security rules also apply for Qt applications in the S60 environment. Because Qt is mainly ported on top of Open C, the required capabilities are also derived from those APIs. Platform security requires that needed capabilities be defined in the project file. The Qt application may require, for example, the following capabilities: </li></ul><ul><ul><li>AllFiles, when using file operations and accessing protected folders </li></ul></ul><ul><ul><li>NetworkServices should be enough in most cases when using the QtNetwork module, but there might be certain API calls that also require NetworkControl. </li></ul></ul><ul><li>When using Symbian APIs the capabilities needed are, of course, the ones that the APIs define. </li></ul>
  42. 42. Memory Management <ul><li>Qt applications are implemented in such a way that the cleanup stack is not needed for them. If there is not enough memory when running the Qt application, the application will simply be closed. </li></ul><ul><li>When implementing an application with Qt in the S60 environment, the cleanup stack should be used with Symbian code. </li></ul><ul><li>Qt stores objects into an object tree when they are created. The object tree enables automatic deletion of child objects that have a parent. </li></ul><ul><ul><li>For example, when a widget is created with another object as a parent, it is added to the parent’s child list and deleted automatically when the parent is deleted. </li></ul></ul><ul><ul><li>If an object with a parent is created with new on the heap, the deletion of the object removes it automatically from the parent. </li></ul></ul><ul><ul><li>If the deleted object has children, they are automatically deleted when the object is deleted. The same behaviour applies to objects created on the stack. </li></ul></ul><ul><ul><li>The only objects that have to be explicitly deleted are the objects created with new and that have no parent. </li></ul></ul>
  43. 43. How to Mix Qt and Symbian C++ code <ul><li>We will document in future releases what’s the best way of developing hybrid applications having both Qt and Symbian code </li></ul><ul><ul><li>Traps/leaves and error management </li></ul></ul><ul><ul><li>How to hide Symbian code from Qt code </li></ul></ul><ul><ul><li>How to make conversions between Qt and Symbian types (like QString to descriptors) </li></ul></ul><ul><li>Some guidance exists already in the Qt on S60 developer library </li></ul><ul><li>Also, we are investigating how to improve the OOM capabilities in Qt to better suit the needs of embedded devices </li></ul>
  44. 44. <ul><li>Introducing Qt on S60 </li></ul><ul><li>Build Process </li></ul><ul><li>Symbian Concepts </li></ul><ul><li>Carbide.c++ support </li></ul>Contents
  45. 45. Qt Support in Carbide.c++ 2.0 <ul><li>Support for Qt development </li></ul><ul><li>Carbide works with Qt projects </li></ul><ul><ul><li>.PRO editor for easy project configuration </li></ul></ul><ul><ul><li>Package /deploy projects to phone </li></ul></ul><ul><ul><li>Qt plug-ins are included in Carbide </li></ul></ul><ul><ul><li>Qt project Wizard </li></ul></ul><ul><ul><li>Support for Qt UI design tool </li></ul></ul><ul><li>Oh yeah, since Qt on S60 is a Symbian application, you can use same tools for debugging, profiling etc. </li></ul>
  46. 46. Additional Qt support in Carbide Qt Template Wizard .PRO Project Editor