Professional Documents
Culture Documents
?
Thats where me and ~1499 other computerish professionals work
G lobal, based in F inland
~50 % work with mobile technologies A large, traditional S ymbian house S ince day 1, heavily involved with Q t on mobile devices
Qt for Mobile
Objectives 1/2
To get a really good overview on
What is Q t development especially on mobile platforms
Q tMobility APIs
To go technical enough
To actually be able to start doing something meaningful after the course! Q t is C ++, so prior C ++ knowledge is required
If you have any questions at any point, please do not hesitate to ask! F or more information:
http://www.forum.nokia.com http://developer.qt.nokia.com
3
Qt for Mobile
Objectives 2/2
In addition to Q t basics, we will take a look at the various ways a UI can be created in Q t
To understand the variety of Qt offering for a developer!
QGraphicsView
Qt Quick
QtWebkit
CUSTOM LAF
QWidgets
NATIVE LAF
Qt for Mobile
Qt for Mobile
Qt for Mobile
Required Tools
Laptop:
Q t S DK for Desktop (Windows/Linux/Mac) Nokia Q t S DK for mobile development
Includes Q t Mobility APIs Includes Q t for S ymbian and Maemo Includes Q t C reator IDE
Qt for Mobile
Course Material
Please copy the material from the US B stick C ontains:
C ourse slides E xercise solutions A few additional sample applications
A few N8 devices available for you to try out during the hands-on exercises!
Qt for Mobile
Qt Overview
Qt Status for Mobile Devices
What is Qt?
10
Qt for Mobile
Cross-Platform APIs
C ross-platform Q t APIs are wrappers around native services
Application 1
Application 2
Application 3
Qt APIs Qt
11
Qt for Mobile
Different Qt Platforms
Q t is currently ported to
Desktops: Windows, Linux (X 11), Mac Mobile platforms: E mbedded Linux, Windows C E , Maemo/MeeG o, and S ymbian
Qt/X11
Qt/MeeGo
Qt/Win
Qt/Mac
12
Qt for Mobile
What is Qt on Mobile?
13
Qt for Mobile
What is Symbian^3?
Actually, just S ymbian (or the New S ymbian) The latest S ymbian platform release
Multiple home screens Multi-point touch HD multimedia capabilities Improved multitasking Improved graphics architecture Q t libraries pre-installed!
14
Qt for Mobile
The first Symbian^3 device Qt 4.6.3 (4.6.4) pre-installed Second wave of devices will have Qt 4.7 Capasitive touch screen Multi-touch and gestures work A separate GPU! HW accelerated graphics QtOpenVG rasterization mode
15
Qt for Mobile
16
Qt for Mobile
Smart Installer
Your Qt app
Nokia N8 (Qt-ready!)
???
17
Qt for Mobile
Smart Installer
Your Qt app
Nokia N8 (Qt-ready!)
Smart Installer
18
Qt for Mobile
Smart Installer
Your Qt app
Check requirements
Smart Installer
Qt for Mobile
What is MeeGo?
Intels Moblin
Maemo
20
Qt for Mobile
MeeGo Architecture
Netbook UX
Netbook UI + Apps Netbook UI Framework
Handset UX
MeeGo API
Comms Services
Connection Mgmt ConnMan Telephony oFono VOIP, IM, Pres Telepathy Bluetooth BlueZ
Internet Services
Layout Engine WebKit Web Run-Time WebKit Web Services Lib SocialWeb Location GeoClue
Visual Services
3D Graphics OpenGL / ES 2D Graphics Cairo, QPainter I18n Rendering Pango, QText GTK /Clutter
Media Services
Media FW GStreamer Camera GStreamer plug-in Codecs GStreamer plug-in Audio PulseAudio UPnP GUPnP
Data Mgmt
Content Framework Tracker Context Framework ContextKit Package Manager PackageKit
Device Services
Device Health
Personal Services
PIM Services
Sensor Framework
Device Sync
Resource Manager
MeeGo Kernel
MeeGo Architecture
Netbook UX
Netbook UI + Apps Netbook UI Framework
QtCore, QtGui, QtNetwork, Qt Mobility APis, etc
Qt Quick
Handset UX
MeeGo API
Media Services
Media FW GStreamer Camera GStreamer plug-in Codecs GStreamer plug-in Audio PulseAudio UPnP GUPnP
Comms Services
Connection Mgmt ConnMan Telephony oFono VOIP, IM, Pres Telepathy Bluetooth BlueZ
Internet Services
Layout Engine WebKit Web Run-Time WebKit Web Services Lib SocialWeb Location GeoClue
Visual Services
3D Graphics OpenGL / ES 2D Graphics Cairo, QPainter I18n Rendering Pango, QText GTK /Clutter
Data Mgmt
Content Framework Tracker Context Framework ContextKit Package Manager PackageKit
Device Services
Device Health
Personal Services
PIM Services
Sensor Framework
Device Sync
Resource Manager
MeeGo Kernel
==
E VE R Y WHE R E !
23
Qt for Mobile
Qt Developer Offering
Qt Quick, Qt Quick C omponents
UI
QtDeclarative QtWebkit
QtSvg
QtGUI
QtOpenGL
Engine
Qt
QtScript QtSql QtXml QtMultimedia QtCore QtXmlPatterns QtNetwork
Qt Mobility APIs
S ymbian C ++
O pen C / PO S IX
Linux C /C ++ libraries
Desktop OSs
Symbian Symbian
Linux MeeGo
24
Qt for Mobile
25
Qt for Mobile
Build Tools
C onfigure, qmake, moc, uic and rcc
Development Tools
Q t C reator, Q t Designer, Q t Assistant, Q t Linguist
QtOpenGl
QtOpenVG
QtSvg
QtWebKit
QtXmlPatterns
QtGui
QtSql
QtXml
QtNetwork
QtScript
Phonon
QtMultimedia
QtCore
26
Qt for Mobile
1.1
Later?
Service Framework
Organizer
Augmented Reality
Publish&Subscribe
Versit
Document Gallery
Face Recognition
Messaging
Sensors
Feedback
Contacts
System Information
27
Qt for Mobile
Qt Essentials
28
What is Qt Programming?
Heavily object based C ++ Hundreds of ready-made classes, names start with Q High abstraction level UIs built from widgets
= UI Building Block, derived from Q Widget
29
Qt for Mobile
30
Qt for Mobile
2. qmake
Uses the .pro file as input and produces platform-specific Makefile(s)
3. make
C ompiles the program for the current platform E xecutes also additional tools, such as moc, uic and rcc
qmake -project
qmake
make
Application Binary
31
Qt for Mobile
O ften your application UI is a composite widget which consists of multiple contained widgets
We will see plenty of examples during the course
32
Qt for Mobile
Display Widgets
Labels (Q Label) Text Browsers (Q TextBrowser) LC DNumbers (Q LC DNumber) Progress Bar (Q ProgressBar) ...and more
33
Qt for Mobile
S pin boxes (Q S pinBox) Dial (Q Dial) S croll bars (Q S crollBar) S liders (Q S lider)
34
Qt for Mobile
Qt Assistant
Y ou can use Q t Assistant to see how to use all the widgets Provides not only profound class documentation but also good articles on Q t conventions
35
Qt for Mobile
36
Qt for Mobile
QApplication [QtGui]
Initializes application settings
Palette, font
E ncapsulates the main event loop (QApplication::exec()) Defines applications look and feel Provides localization of strings Knows applications windows
widgetAt()
37
Qt for Mobile
More Widgets?
int main( int argc, char** argv ) { QApplication app( argc, argv ); QLabel label( "Hetken kest elm..." ); label.show(); QLabel label2( "...ja sekin synkk ja ikv." ); label2.show(); return app.exec(); }
Not exactly what was intented E ach widget without a parent becomes a window of its own!
Why does S ymbian show only the latter one?
38
Qt for Mobile
39
Qt for Mobile
Parent/Child Relationship
E ach Q O bject instance may take a parent argument
C hild informs its parent about its existence, upon which the parent adds it to its own list of children
If a widget object does not have a parent, it is a window The parent widget does the following for its children:
Hides and shows children, when hidden/shown itself E nables and disables children when enabled or disabled itself
Note that a child may be explicitly hidden, although the parent is shown
40
Qt for Mobile
Memory Management
The ownership of all child Q O bjects is transferred to the parent
Automatic deletion by the parent C hildren must be allocated from the heap with the new operator! Manual deletion will not, however, cause double deletion because the child informs its parent of the deletion
O ccasionally it may seem like Q t would hold some sort of automatic garbage collection but this is not true!
Always pay attention to ownerships and responsibilities!
41
Qt for Mobile
Another Try
int main( int argc, char** argv ) { QApplication app( argc, argv ); QLabel label( "Hetken kest elm..." ); QLabel* label2 = new QLabel( "...ja sekin synkk ja ikv.", &label ); label.show(); return app.exec(); }
42
Qt for Mobile
43
Qt Designer
Qt for Mobile
Result
44
Qt for Mobile
Conclusions So Far
Widgets are put inside a main widget
Main widget becomes a parent for its child widgets No garbage collection, only ownership transfers!
Layout classes are used for non-hard-coded positioning But Do we really need to code and build everything manually?
No, of course not! ==> Nokia Q t S DK & Q t Designer
45
Qt for Mobile
Nokia Qt SDK
46
Nokia Qt SDK
S ince 4/2010 the Nokia Q t S DK has been available for all Q t-related development
Available for Windows, Linux & Mac
Includes
Q t 4.6.3 for S ymbian and Maemo Q tMobility APIs 1.0.2 Q t C reator IDE 2.0 Q t S imulator O DD for all devices E xperimental remote compilation service
Mainly aimed at Linux and Mac users wishing to compile for S ymbian However, can be used to compile for any supported target device from any Nokia Q t S DK desktop environment!
47
Qt for Mobile
C ompile, deploy, execute and debug applications on all Nokia devices by just one click If you want to do builds for regular desktop environments, a separate installation of a normal Q t desktop S DK is needed as well
After this, all development can be done simply using Nokia Q t S DK !
48
Qt for Mobile
49
Qt for Mobile
Work Flow
3. Try in Qt Simulator
50
Qt for Mobile
Work Flow
3. Try in Qt Simulator
51
Back to Qt Essentials
52
53
Qt for Mobile
lcd
slider
54
Qt for Mobile
55
Qt for Mobile
Signals
A signal is a way to inform a possible observer that something of interest has happened inside the observed class
A Q PushButton is clicked
QPushButton::clicked()
S ignals are member functions that are automatically implemented in the metaobject
O nly the function declaration is provided by the developer
56
Qt for Mobile
Slots
A slot is a function that is to be executed when a signal has been emitted.
(When Q PushButton is clicked), close Q Dialog (When service is ready), ask for the value and store it (When Q S lider value is changed), display the value in Q LC DNumber
57
Qt for Mobile
58
Qt for Mobile
Connections
To receive a signal in a slot, signal and slot must be connected
bool success = QObject::connect( senderObject, SIGNAL(valueChanged(int)), observerObject, SLOT(display(int)));
S ignal and slot signatures must match (signal may have more parameters)
No compile time error checking is made!
59
Qt for Mobile
Some Object
slot function
Some Object
2. Event is generated and delivered for the corresponding objects event handler function
QEvent (mouse press)
slot function
Hey! Im
Event handler
60
Qt for Mobile
61
Qt for Mobile
valueChanged()
Hey! Im clicked()
Some Object
slot function
62
Qt for Mobile
2. emit valueChanged(21)
int main( int argc, char** argv ) { QApplication app( argc, argv ); QWidget window; QLCDNumber* lcd = new QLCDNumber( &window ); QSlider* slider = new QSlider( Qt::Horizontal, &window ); QObject::connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int))); window.showMaximized(); return app.exec(); }
3. display(21)
63
Qt for Mobile
64
Qt for Mobile
window
QWidget window; QVBoxLayout* layout = new QVBoxLayout( &window ); QLCDNumber* lcd = new QLCDNumber( &window ); QSlider* slider = new QSlider( Qt::Horizontal, &window ); layout->addWidget( lcd ); layout->addWidget( slider );
layout
lcd
QObject::connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int))); window.showMaximized(); return app.exec(); }
slider
65
Qt for Mobile
66
Qt for Mobile
Summary on Qt Basics
Tree of O bjects O ne main widget acts as the parent S ignals and slots are used for making objects interact with each other Layout managers used instead of hard coded positions
67
Qt for Mobile
Qt Designer
68
Qt Designer
C omes with Desktop Q t as a separate application
Also integrated to C arbide.c++ and Q tC reator, as F orm Designer
Dragndrop UI designer O utputs X ML-based .ui files .ui files are converted automatically to .h files by uic (ui compiler)
myproject.ui -> ui_ myproject.h
69
Qt for Mobile
70
Qt for Mobile
71
Qt for Mobile
72
Qt for Mobile
UI Class
QMainWindow
73
Qt for Mobile
S ingle inheritance
E xtend functionality with custom slots
74
Qt for Mobile
Direct Approach
In the .pro file, add FORMS += Slider.ui
#include ui_Slider.h int main( int argc, char** argv ) { QApplication app( argc, argv ); Ui::SliderClass ui; QMainWindow window; ui.setupUi( &window );
UI Class
QMainWindow
window.showMaximized(); return app.exec(); }
75
Qt for Mobile
Single Inheritance
E asy to add custom functionality with custom slot functions UI C lass becomes a member variable
#include "ui_Slider.h" class SliderApplication : public QMainWindow { Q_OBJECT public: SliderApplication(QWidget *parent = 0); ~SliderApplication(); public slots: void changeLcdColor(int value);
QMainWindow
SliderApplication UI Class
76
Qt for Mobile
void Slider::changeLcdColor(int value) { QPalette pal = ui.lcdNumber->palette(); pal.setBrush( QPalette::WindowText, QBrush(QColor(value*2.55, value*2.55, value*2.55)) ); ui.lcdNumber->setPalette(pal); }
Dragging the slider now also changes the color of the LCD Number (from black to white)
77
Qt for Mobile
3. Try in Qt Simulator
78
1. Design UI
79
Qt for Mobile
80
Qt for Mobile
3. Try in Qt Simulator
81
Qt for Mobile
Qt Simulator
Try out UI in phone LAF S imulate mobile events O nly for quick-testing!
82
Qt for Mobile
3. Try in Qt Simulator
83
Qt for Mobile
O VI S uite (or older PC S uite) is also required for the data connection between Nokia device and your device
84
Qt for Mobile
3. Try in Qt Simulator
85
Qt Simulator
Try out UI in phone LAF S imulate mobile events O nly for quick-testing!
86
Qt for Mobile
O VI S uite (or older PC S uite) is also required for the data connection between Nokia device and your device
87
Qt for Mobile
Make it work!
Try out in the simulator first R un on a real device as well!
88
Qt for Mobile
Qt Mobility APIs
Introduction
89
Background
Q t is originally designed for desktop O S s
O riginally no APIs for mobile device related features
90
Qt for Mobile
1.1
Later?
Service Framework
Organizer
Augmented Reality
Publish&Subscribe
Versit
Document Gallery
Face Recognition
Messaging
Sensors
Feedback
Contacts
System Information
91
Qt for Mobile
Status at 1.0.2
92
Qt for Mobile
Status at 1.1.0
Qt for Mobile
Installation
C omes with Nokia Q t S DK S imply install the provided .sis file to the device
94
Qt for Mobile
int main( int argc, char *argv[] ) { QApplication app( argc, argv ); QSystemInfo s; QLabel *label = new QLabel( "Current language is "+ s.currentLanguage() + " and you're using Qt " + s.version(QSystemInfo::QtCore) ); label->show(); return app.exec(); }
95
Qt for Mobile
int main( int argc, char *argv[] ) { QApplication app( argc, argv ); QSystemInfo s; QLabel *label = new QLabel( "Current language is "+ s.currentLanguage() + " and you're using Qt " + s.version(QSystemInfo::QtCore) ); label->show(); return app.exec(); }
All classes within Mobility APIs are placed inside namespace QtMobility. You can raise the whole namespace or either use syntax QtMobility::<ClassName>, like QtMobility::QSystemInfo
96
Qt for Mobile
97
Qt for Mobile
Compiling
Nokia Q t S DK
S ymbian
qmake make release-gcce To create/install the .sis createpackage i hw_template.pkg release-gcce
98
Qt for Mobile
Q t/S ymbian applications are S ymbian processes from the O S s point of view
Need capabilities for accessing secured services!
99
Qt for Mobile
100
Qt for Mobile
101
Qt for Mobile
102
Qt for Mobile
QSystemInfo
QSystemNetworkInfo
QSystemScreenSaver
QSystemStorageInfo
103
Qt for Mobile
QSystemDeviceInfo Example
S mall application to show the current profile, battery level and power status
Profile status naturally not available on Windows
Demo
104
Qt for Mobile
105
Qt for Mobile
106
Qt for Mobile
107
Qt for Mobile
108
Qt for Mobile
Hands-On Batterize!
109
Qt for Mobile
Qt Training
Day 2
110
Day 2
Mobility APIs API Walkthrough
Hands-on
CUSTOM LAF
QWidgets
NATIVE LAF
111
Qt for Mobile
Qt Mobility APIs
API Overviews
112
1.1
Later?
Service Framework
Organizer
Augmented Reality
Publish&Subscribe
Versit
Document Gallery
Face Recognition
Messaging
Sensors
Feedback
Contacts
System Information
113
Qt for Mobile
QSystemInfo
QSystemNetworkInfo
QSystemScreenSaver
QSystemStorageInfo
114
Qt for Mobile
115
Qt for Mobile
F unctionality can be shared between applications Developer has device independent methods for finding/using/implementing services
116
Qt for Mobile
117
Qt for Mobile
Messaging API
Access to messaging services
S earch and sort C reate and modify S end and retrieve Launch preferred message client
A unified interface for manipulation and storage of S MS , MMS , E mail and X MPP messages is provided
118
Qt for Mobile
119
Qt for Mobile
Creating a Message
// The developer creates a QMessage object and then sets the necessary message details. First set the message type, the default account for messages of the specified type will be used for sending : QMessage message; message.setType(QMessageAddress::Email); // Now a recipient is set : QString recipient(user@example.com); message.setTo(QMessageAddress(QMessageAddress::Email, recipient)); // For email a subject and a body are set, and any relevant attachments added : message.setSubject(Example subject); message.setBody(Example body text); QStringList attachmentPaths; attachmentPaths << images/landscape.png; message.appendAttachments(attachmentPaths);
120
Qt for Mobile
121
Qt for Mobile
Location API
This API provides an easy to use interface that encapsulates basic geographical information obtained from satellite or other sources about the user
Q G eoPositionInfo class contains information gathered on a global position, direction and velocity at a particular point in time
122
Qt for Mobile
123
Qt for Mobile
124
Qt for Mobile
Demo! - Locationer
G et your location and send to your friend via S MS !
125
Qt for Mobile
Contacts API
The C ontacts API allows developers to manage contact data in a platform independent way.
A contact is the digital representation of a person, group or entity A contact consists of a set of contact details with own semantics of usage and storage with different context info (like separate phone number for work and home)
126
Qt for Mobile
QContactDetail
QContactManager
Access to contacts stored in particular backend Used to select contacts through QContactManager Interface for performing actions to contacts (like S end email or Dial)
QContactFilter
QContactAction
127
Qt for Mobile
Versit API
F unctionality for reading and writing Versit documents such as vC ards
QVersitDocument QVersitReader QVersitWriter
128
Qt for Mobile
Allows comparison and prioritization of the access and use of grouped access points When using Bearer Management the developer does not need to worry about locating the best connection
User selects best Transparent selection
Qt for Mobile
QNetworkConfigurationManager
QNetworkSession
C ontrol over the system's access points and enables session management for cases when multiple clients access the same access point
130
Qt for Mobile
Application lists available network configurations and shows information on the selected one
UI consists only of a QListView and a QTextBrowser QListView uses QStringListModel (which has the names of the configurations)
F or a more complex example, see Bearer Monitor example of the Mobility APIs
Demo
131
Qt for Mobile
Multimedia APIs
Play audio & video of various formats R ecord audio Playing and managing of an F M radio With Q tMultimedia, will eventually replace Phonon API Access to multimedia services with minimal code and maximal flexibility
132
Qt for Mobile
Included in 1.1.0
133
Qt for Mobile
Sensors API
The API supports sensors that poll for their data and sensors that push data to the app as it arrives
Application Code QSensor QSensorBackend
QSensorReading
Device Plugin
QSensor (and its subclasses) provide application with access to data input from a sensor
Direct subclass instantiation Q S ensorR eading subclasses represent single readings from a single sensor
QSensorBackend can be used to make sensors available through the same API, by creating plugins
134
Qt for Mobile
135
Qt for Mobile
136
Qt for Mobile
137
Qt for Mobile
1.1
Later?
Service Framework
Organizer
Augmented Reality
Publish&Subscribe
Versit
Document Gallery
Face Recognition
Messaging
Sensors
Feedback
Contacts
System Information
138
Qt for Mobile
139
Contents
Different Application Approaches in Nokia Devices Porting from iPhone or Android to Q t, no code re-use
Mapping concepts
140
Qt for Mobile
Qt C++
WEB
141
Qt for Mobile
Qt Applications
Qt C++
Qt Quick UI Qt C++, UI with QWidgets C++, UI with Graphics View C++ Native LAF Custom LAF Custom LAF with
easy-to-develop More native applications script-like syntax Multiple UI approaches E xtensive engine support through Q t and Q t Mobility APIs
142
Qt for Mobile
QtWebkit
WEB
Qt C++
Possibility to embed dynamic content to Q t C ++ programs E .g. create the whole UI with web technologies and show it in a QWebView widget C ollaborate between J avaS cript and C ++ R e-use existing web documents
143
Qt for Mobile
144
Qt for Mobile
iPhone Overview
Applications in iPhone are written using the Objective-C programming language Development of O bjective-C applications requires the use of Apple environment Tools in use
O bjective-C : X C ode Q t/S ymbian: Q t C reator, C arbide.c++
145
Qt for Mobile
The C ocoa framework consists of libraries, APIs and runtimes that form the development layer for all of Mac O S X
Applications automatically inherit the same Mac O S X LooknF eel
146
Qt for Mobile
O nly one foreground iPhone application can be executed at a time (excluding iPhone 4)
When user selects application icon from menu, new process launches Pressing home screen button closes the application process Applications try to imitate background execution by state saving
147
Qt for Mobile
148
Qt for Mobile
Android apps do not provide one entry point (like main function) but a set of essential components
Activities, services, broadcast receivers and content providers Application process is started when any part of it is needed and J ava objects for that part are instantiated
149
Qt for Mobile
Android Views
View structure
Views
Dialog
Q Dialog
150
Qt for Mobile
Qt Quick UI
C++
151
Qt for Mobile
152
153
Qt for Mobile
Y our own applications are compiled using a native compiler F rom S ymbian O S s point of view your applications are just normal S ymbian processes
But! Program code is no longer S ymbian, but cross-platform Q t code
No S ymbian coding conventions!
154
Qt for Mobile
Graphics Graphics
Base Base
155
Qt for Mobile
Qt UI Qt UI (EXE) (EXE)
New UI with Qt widgets Engine left untouched Direct access to Symbian engine inside Qt UI code => Hybrid code (Qt+Symbian mixed), not cross-platform
156
Qt for Mobile
Works! but only in Symbian, so not cross-platform! Problems in readability, error handling etc.
157
Qt for Mobile
Qt UI Qt UI (EXE) (EXE)
Qt Engine Wrapper
New UI with Qt widgets Engine left untouched Engine wrapped with a separate Qt class Engine wrapper implementation hybrid code, UI plain Qt => Clean UI code, possibility to port engine later
158
Qt for Mobile
By simplest we can just wrap our existing S ymbian engine class with a hybrid class
Q t class with Q t interface and mechanisms (like S ignals&S lots) Y et, dependencies on S ymbian in class interface
UI code stays clean and plain Q t but is actually dependent on S ymbian through E ngineWrappers interface + Q uickneasy - Not very flexible, possible problems with S C /BC if going cross-platform
159
Qt for Mobile
Example Interface
#include <symbianengine.h> // Symbian dependency class EngineWrapper : public QObject { Q_OBJECT public: // Qt-style interface for engine services signals: private: CSymbianEngineClass* m_engine; // Symbian dependency };
160
Qt for Mobile
More flexibility can be achieved by keeping even the E ngineWrappers interface as pure platform independent Q t All platform dependent functionality and data are placed inside a private class
A simple design pattern called private implementation
Q t itself has been implemented for different platforms using the same mechanism!
161
Qt for Mobile
162
Qt for Mobile
EngineWrapperPrivate (maemo)
MaemoEngineClass (maemo)
As mentioned, this mechanism is also used for building cross-platform APIs (like Q t itself!)
O ne unified API Platform-specific private implementation classes
163
Qt for Mobile
The private implementation class can act as an Active O bject and transform S ymbian AO mechanism to Q t S ignals&S lots
CActive
UI Code (Qt)
EngineWrapper (Qt)
EngineWrapperPrivate (Symbian)
164
Qt for Mobile
Qt UI Qt UI (EXE) (EXE)
OR
Qt Engine Qt Engine (DLL) (DLL)
Qt provides strong and easyto-use engine support so reimplementing the whole engine is something to also consider Mobility APIs extend Qt engine support to mobile devices
165
Qt for Mobile
+ Better maintainability
Less code, clearer, only one code technology in use
- More work
- O bviously
166
Qt for Mobile
Porting Summary
iPhone & Android
No code re-use Web content/graphics can be re-used Different alternatives for re-implementation for different purposes (Q t, Q t w/ G raphics View, Q t Q uick, Q tWebkit, WR T)
167
Qt for Mobile
Introduction to Mobile Qt UI
168
Mobile Qt UI Offering
QWidgets
NATIVE LAF
169
Qt for Mobile
Q uite desktop-oriented
Missing mobile concepts, like views Not really there yet, at least in S ^3
170
Qt for Mobile
171
Introduction 1(2)
In Q t 4.6 a new Animation F ramework was introduced The idea is to provide an easy and scalable way of creating animated and smooth G UIs
Hides the complexity of handling timers Provides a set of pre-defined easing curves, custom curves can be provided by the developer as needed
172
Qt for Mobile
Main Classes
173
Qt for Mobile
QPushButton button("Animated Button"); button.show(); QPropertyAnimation animation(&button, "geometry"); animation.setDuration(10000); animation.setStartValue(QRect(0, 0, 100, 30)); animation.setKeyValueAt(0.5, QRect(250, 250, 100, 30)); animation.setEndValue(QRect(0, 0, 100, 30)); animation.start();
Demo
174
Qt for Mobile
175
Qt for Mobile
176
Qt for Mobile
Easing Curves
The Animation F W provides multiple pre-made easing curves for your convenience
R epresented by the class QEasingCurve
Typically used to control e.g. how the animation starts and/or finishes
QEasingCurve::OutBounce QEasingCurve::InOutQuad
QPropertyAnimation animation(&button, "geometry"); animation.setEasingCurve(QEasingCurve::OutBounce);
Qt for Mobile
Graphics Effects
G raphics effects provide an easy-to-use mechanism for adding effects on QGraphicsItems and QWidgets
QGraphicsItem::setGraphicsEffect(QGraphicsEffect*) QWidget::setGraphicsEffect(QGraphicsEffect*)
178
Qt for Mobile
Standard Effects
QGraphicsBlurEffect QGraphicsOpacityEffect
Source Image
QGraphicsColorizeEffect
QGraphicsDropShadowEffect
179
Qt for Mobile
Demo
180
Qt for Mobile
Hands-On Animations!
Play around with
Animation F W G raphics E ffects
Make the two buttons change change place Make a slider follow the other, with a delay
181
Qt for Mobile
Mobile Qt UI
Graphics View
182
Mobile Qt UI Offering
QGraphicsView
CUSTOM LAF
QWidgets
NATIVE LAF
183
Qt for Mobile
Custom UI w/ QGraphicsView
Q G raphicsView is a Q Widget, designed for showing custom 2D graphics:
ra mg sto Cu ph s th e go re
If the only widget (the window itself) is a Q G raphicsView, the whole UI is then custom:
184
Qt for Mobile
QGraphicsScene
is a 2D container for
QGraphicsItem
185
Qt for Mobile
186
Qt for Mobile
Mobile Qt UI
QtWebKit
187
Mobile Qt UI Offering
QGraphicsView
QtWebkit
CUSTOM LAF
QWidgets
NATIVE LAF
188
Qt for Mobile
QWebView
Qt/C++ Application
189
Qt for Mobile
Port easily from an existing Web app (like an iPhone app) UI loaded dynamically (HTML/J avaS cript)
C an actually be a dynamic UI with online content!
190
Qt for Mobile
191
Qt for Mobile
Mobile Qt UI
Qt Quick
192
Mobile Qt UI Offering
QGraphicsView
Qt Quick
QtWebkit
CUSTOM LAF
QWidgets
NATIVE LAF
193
Qt for Mobile
What is Qt Quick?
Q t User Interface C reation K it
UIs written in a J avaS cript-like language called Q ML
194
Qt for Mobile
Demonstrations
Lets study this a bit by looking at a few examples
195
Qt for Mobile
196
Qt for Mobile
Inside Flowd
Qt/C++ Engine
197
Qt for Mobile
No components (yet)
no styling
198
Qt for Mobile
Qt Mobility Bindings
Q t Mobility 1.1 (now in beta) includes Q ML Bindings for some parts Y ou can access mobility APIs functionality directly from Q ML At the moment the following are available to Q t Q uick:
G allery Location Multimedia S ervice F ramework Messaging
199
Qt for Mobile
Summary
200
201
Qt for Mobile
Q uite a bunch of new Q tMobility APIs Q t Q uick Designer (Dragndrop editor for Q ML) finalized Q t Q uick C omponents Q tWebkit constantly improved (HTML5 etc)
202
Qt for Mobile
Qt Developer Offering
Qt Quick, Qt Quick C omponents
UI
QtDeclarative QtWebkit
QtSvg
QtGUI
QtOpenGL
Engine
Qt
QtScript QtSql QtXml QtMultimedia QtCore QtXmlPatterns QtNetwork
Qt Mobility APIs
S ymbian C ++
O pen C / PO S IX
Linux C /C ++ libraries
Desktop OSs
Symbian Symbian
Linux MeeGo
203
Qt for Mobile
Thank You!
tuukka.ahoniemi@ digia.com
www.digia.com
204
Qt for Mobile