necessitas - qt on android - from fscons 2011
DESCRIPTION
TRANSCRIPT
![Page 1: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/1.jpg)
NecessitasQt on Android
Johan ThelinPelagicore
![Page 2: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/2.jpg)
Biography
● Johan Thelin
● Worked with Qt for 10+ years● Foundations in Qt Development● Also worked embedded, embedded Linux, enterprise software, web
● Today – senior developer at Pelagicore
![Page 3: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/3.jpg)
Pelagicore
● Open source based in-vehicle infotainment● Member of Linux Foundation● Ubuntu Core member● GENIVI member● Active within MeeGo, etc
● Uses Qt and QtQuick extensively● Also HTML5, JavaScript and Android
![Page 4: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/4.jpg)
What is Qt
“Code less, create more, deploy everywhere”
● A great framework for creating applications● Truly cross-platform
● Desktop● Devices
● Licensed for everyone – GPL, LGPL or closed
![Page 5: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/5.jpg)
Qt on Desktop
● X11● OS X● Windows
![Page 6: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/6.jpg)
Qt on Devices
● Linux with X11● N900, N9
● Linux without X11● industrial, etc
● Symbian● WinCE
● more...
![Page 7: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/7.jpg)
Who runs Qt?
● Trolltech ● Bought by Nokia● Nokia Qt Development Frameworks
● Digia develops and licenses Qt Commercial
● Qt is open source – www.qt-project.org● True open governance!
![Page 8: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/8.jpg)
Qt on Devices
● More than the official ports● Android
● RIM Blackberry● WebOS● iOS● Kindle
● WP7 can support native code mid-2012 :-)
![Page 9: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/9.jpg)
Qt on Devices
● More verticals● Set-top boxes● Industrial panels● Tablets
● Your car
![Page 10: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/10.jpg)
Finding the Roots of Qt
Backends
![Page 11: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/11.jpg)
Backends
● Backends for OS primitives● Atomic operations, files, etc
● Backends for graphics rendering● Soft, OpenGL, OpenGL ES, GDI, etc
● Backends for image handling● Backends for accessibility● Backends for ...
![Page 12: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/12.jpg)
Why Backends
Portability!
![Page 13: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/13.jpg)
Portability between Devices
● QPA – Qt Platform Architecture – or something● Formerly known as Lighthouse
● A backend for porting Qt to new platforms● Focused at minimal effort, but with possibilities
![Page 14: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/14.jpg)
Qt on Android
● Based on Android SDK / NDK● QPA
● Necessitas - the actual Qt Port
● QtCreator (IDE) adaptations● The tooling
● Ministro● The deployment
![Page 15: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/15.jpg)
Current Status
● Alpha 3 was just released● Most of Qt is ported● OpenGL rendering● WebKit
● Missing● Mobility (for many Android Versions)● Rewriting soft keyboard support● Android Style and Android Menus● Development support in non-Linux environments● Documentation
![Page 16: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/16.jpg)
The Near Future
● Planning to release First Beta soon● Will give a stable API/ABI
“...meaning that an application which uses that version will run without *any* change, on any further releases! It also
means you can target a billion devices using Qt, much sooner than you expected :)”
![Page 17: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/17.jpg)
Getting Started
● Installation party!● OpenJDK● ant 1.8+● The necessitas installer downloads and installs
– Android SDK + NDK– Platforms for the SDK, etc
● Setup QtCreator– Add path to ant
![Page 18: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/18.jpg)
Installer
![Page 19: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/19.jpg)
Demo Application
![Page 20: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/20.jpg)
Demo Application
● Strip out some of the crud from the template source code – it refers to Symbian
![Page 21: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/21.jpg)
Demo Application
void MainWindow::on_pushButton_clicked(){ static int v = 0; ui->listWidget->addItem( QString("Value%1").arg(v++));}
![Page 22: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/22.jpg)
Demo Application
![Page 23: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/23.jpg)
Demo Application
● From project directory
$ ls -l android/bin/total 1988-rw-rw-r-- 1 e8johan e8johan 179 2011-11-10 21:42 build.propdrwxrwxr-x 3 e8johan e8johan 4096 2011-11-10 21:42 classes-rw-rw-r-- 1 e8johan e8johan 33396 2011-11-10 21:42 classes.dex-rw-rw-r-- 1 e8johan e8johan 2251 2011-11-10 21:42 classes.dex.ddrwxrwxr-x 6 e8johan e8johan 4096 2011-11-10 21:42 res-rw-rw-r-- 1 e8johan e8johan 431594 2011-11-10 21:42 Widgetdemo.ap_-rw-rw-r-- 1 e8johan e8johan 2045 2011-11-10 21:42 Widgetdemo.ap_.d-rw-rw-r-- 1 e8johan e8johan 767735 2011-11-10 21:42 Widgetdemo-debug.apk-rw-rw-r-- 1 e8johan e8johan 767731 2011-11-10 21:42 Widgetdemo-debug-unaligned.apk-rw-rw-r-- 1 e8johan e8johan 305 2011-11-10 21:42 Widgetdemo-debug-unaligned.apk.d
![Page 24: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/24.jpg)
First Run on Phone
● Installs Ministro – Installs Qt – Resumeshttps://market.android.com/details?id=eu.licentia.necessitas.ministro
![Page 25: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/25.jpg)
Second Run
It simply works!
![Page 26: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/26.jpg)
More on Ministro
● Qt libraries are shared among all Qt apps on the device
● From the beta release, the ABI is stable, i.e. Qt can be upgraded separately from apps
![Page 27: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/27.jpg)
Configurability
● Android target SDK● API levels
● Application icon● Permissions
● What your app wants to be able to do
● Libraries● Which Qt modules are needed
● More...
![Page 28: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/28.jpg)
Debugging
● Yes! :-)
● Android NDK comes with gdb● Works with QtCreator
● Requires some tweaking● Described in the Necessitas Wiki
![Page 29: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/29.jpg)
Qt and Device UIs
Got to show you this!
![Page 30: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/30.jpg)
User Interface Development
● Classic – standard widgets, etc● Rectangular areas● Non-overlapping● Clipping their children● Provides familiarity
● Device UIs● Blend with the device● Provide a brand feel● etc
![Page 31: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/31.jpg)
Building Modern UIs
● No more widgets! ● Canvas / scene
● Timers everywhere● Multiple simultaneous transitions● Complex, interconnected state machines
● Pain! :-)
![Page 32: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/32.jpg)
History of Qt and Modern UIs
● QCanvas● QGraphicsView● QTimeLine● QGraphicsItemAnimation● An animation framework● A state machine framework● The birth of QtQuick
![Page 33: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/33.jpg)
QtQuick
● What is QtQuick?● A run-time for QML● Tooling
● What is QML● Declarative● JavaScript
![Page 34: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/34.jpg)
QML
import QtQuick 1.0
Rectangle {
Rectangle {
MouseArea {
}
}
}
![Page 35: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/35.jpg)
QML
Rectangle {
width: 500
height: 500
Rectangle {
![Page 36: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/36.jpg)
QML
Rectangle {
Rectangle {
id: box
color: "red"
width: 100
height: 100
x: 200
![Page 37: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/37.jpg)
QML
MouseArea {
anchors.fill: parent
onClicked: {
if(box.state=="up")
box.state="down";
else
box.state="up";
}
}
![Page 38: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/38.jpg)
QML
Rectangle {
state: "up"
states: [
State {
name: "up"
PropertyChanges { target: box; y: 50 }
},
State {
name: "down"
PropertyChanges { target: box; y: 350 }
}
]
![Page 39: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/39.jpg)
Demo
![Page 40: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/40.jpg)
QML
Behavior on y {
PropertyAnimation {
duration: 1000
easing.type: Easing.OutBounce
}
}
![Page 41: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/41.jpg)
Demo
![Page 42: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/42.jpg)
Integrate with C++
● QObjects to QtQuickQObject *foo = …;
setProperty(“foo”, foo);
● C++ classes in QtQuickclass Foo : public QObject { … };
qmlRegisterType<Foo>("FooLib", 1, 0, "Foo");
Foo { property: value }
● QtMediaHub - http://gitorious.org/qtmediahub
![Page 43: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/43.jpg)
QtMediaHub
![Page 44: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/44.jpg)
Of course QtQuick works on Android too.With hardware accelerated graphics.
![Page 45: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/45.jpg)
Qt 5
● A great opportunity to …● … get rid of API limitations● … split the repos into more independent parts● … take advantage of modern C++
● Widgets and QML are peers● More acceleration, shaders, etc – amazing
performance
![Page 46: Necessitas - Qt on Android - from FSCONS 2011](https://reader034.vdocuments.us/reader034/viewer/2022051608/540d43608d7f728d7e8b4829/html5/thumbnails/46.jpg)
A new Dawn
● Truly Open Source – a www.qt-project.org● Qt for Desktop
● Windows / X11 / OS X... more
● Qt for Devices● Symbian / Maemo / MeeGo / Android / Blackberry /
iOS / Kindle... more