SlideShare a Scribd company logo
Submit Search
Upload
Login
Signup
Building the QML Run-time
Report
Johan Thelin
Follow
System Architect at Pelagicore
Mar. 12, 2012
•
0 likes
•
1,999 views
1
of
44
Building the QML Run-time
Mar. 12, 2012
•
0 likes
•
1,999 views
Download Now
Download to read offline
Report
Technology
Slides from my presentation at opensourcedays 2012. http://opensourcedays.org/2012/node/95
Johan Thelin
Follow
System Architect at Pelagicore
Recommended
Cross Platform Qt
Johan Thelin
1.7K views
•
33 slides
Necessitas - Qt on Android - from FSCONS 2011
Johan Thelin
1.7K views
•
47 slides
Qt Workshop
Johan Thelin
2.7K views
•
98 slides
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
2.6K views
•
32 slides
Hello, QML
Jack Yang
1.7K views
•
40 slides
Qt for Beginners Part 3 - QML and Qt Quick
ICS
6.1K views
•
60 slides
More Related Content
What's hot
Qt for beginners part 1 overview and key concepts
ICS
7.2K views
•
66 slides
Qt Internationalization
ICS
2.4K views
•
49 slides
Qt for beginners part 2 widgets
ICS
6.1K views
•
52 slides
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
ICS
16.4K views
•
53 slides
Intro to QML / Declarative UI
OpenBossa
2.5K views
•
17 slides
Best Practices in Qt Quick/QML - Part 3
ICS
3K views
•
53 slides
What's hot
(20)
Qt for beginners part 1 overview and key concepts
ICS
•
7.2K views
Qt Internationalization
ICS
•
2.4K views
Qt for beginners part 2 widgets
ICS
•
6.1K views
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
ICS
•
16.4K views
Intro to QML / Declarative UI
OpenBossa
•
2.5K views
Best Practices in Qt Quick/QML - Part 3
ICS
•
3K views
Qt and QML performance tips & tricks for Qt 4.7
Pasi Kellokoski
•
28.7K views
QVariant, QObject — Qt's not just for GUI development
ICS
•
1.3K views
Qt for beginners part 5 ask the experts
ICS
•
1.8K views
Treinamento Qt básico - aula I
Marcelo Barros de Almeida
•
2.4K views
A Brief Introduction to the Qt Application Framework
Zachary Blair
•
8.5K views
Qt Widget In-Depth
account inactive
•
4.2K views
So I Downloaded Qt, Now What?
Janel Heilbrunn
•
44 views
Meet the Widgets: Another Way to Implement UI
ICS
•
499 views
Qt 5 - C++ and Widgets
Juha Peltomäki
•
10.9K views
Migrating from Photon to Qt
Janel Heilbrunn
•
102 views
Treinamento Qt básico - aula II
Marcelo Barros de Almeida
•
880 views
OpenGL Introduction.
Girish Ghate
•
6.8K views
The Future of Qt Widgets
Marius Bugge Monsen
•
955 views
Programming with OpenGL
Syed Zaid Irshad
•
799 views
Viewers also liked
Repair My Credit Score
Legacy Legal
375 views
•
9 slides
E-Tech 7.2 Summer 2010
Candiek
479 views
•
94 slides
Best Practices in Qt Quick/QML - Part IV
ICS
28.6K views
•
54 slides
Informativo n° 25 2º básico a- viernes 06 de septiembre (2)
Colegio Camilo Henríquez
421 views
•
2 slides
Best Practices in Qt Quick/QML - Part III
ICS
16.4K views
•
53 slides
Apostila pablo stolze
ILDA VALENTIM
8.8K views
•
43 slides
Viewers also liked
(9)
Repair My Credit Score
Legacy Legal
•
375 views
E-Tech 7.2 Summer 2010
Candiek
•
479 views
Best Practices in Qt Quick/QML - Part IV
ICS
•
28.6K views
Informativo n° 25 2º básico a- viernes 06 de septiembre (2)
Colegio Camilo Henríquez
•
421 views
Best Practices in Qt Quick/QML - Part III
ICS
•
16.4K views
Apostila pablo stolze
ILDA VALENTIM
•
8.8K views
English Study and History of the English Lanaguage
ISE NUESTRA SEÑORA DE CHOTA
•
3.9K views
Trabajo Nº 4 - Proyecto Pueblos Originarios de Chile
Colegio Camilo Henríquez
•
623 views
UK-culture
Aziz Bhatiya
•
16.1K views
Similar to Building the QML Run-time
An Introductory course on Verilog HDL-Verilog hdl ppr
Prabhavathi P
495 views
•
41 slides
Fun with QML
ICS
1.8K views
•
16 slides
Deltacloud Presentation - OSSConf 2010
Michal Fojtik
700 views
•
28 slides
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
GetInData
509 views
•
22 slides
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
CybercomChannel
665 views
•
24 slides
C++ Webinar "Why Should You Learn C++ in 2021-22?"
GlobalLogic Ukraine
293 views
•
24 slides
Similar to Building the QML Run-time
(20)
An Introductory course on Verilog HDL-Verilog hdl ppr
Prabhavathi P
•
495 views
Fun with QML
ICS
•
1.8K views
Deltacloud Presentation - OSSConf 2010
Michal Fojtik
•
700 views
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
GetInData
•
509 views
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
CybercomChannel
•
665 views
C++ Webinar "Why Should You Learn C++ in 2021-22?"
GlobalLogic Ukraine
•
293 views
Introduction to 2D/3D Graphics
Prabindh Sundareson
•
8.5K views
Google Cloud Dataflow
Alex Van Boxel
•
7.5K views
Porting Motif Applications to Qt - Webinar
Janel Heilbrunn
•
96 views
Porting Motif Applications to Qt - Webinar
ICS
•
1.8K views
Feb 2018 Spinnaker Meetup Reddit Presentation
Edward Ceaser
•
141 views
Universal Declarative Services - Simon Chemouil
mfrancis
•
372 views
Andreas Jakl Software Development on Nokia Deviceswith Qt
NokiaAppForum
•
1.1K views
HTML literals, the JSX of the platform
Kenneth Rohde Christiansen
•
132 views
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Girl Geek Dinners Milano
•
1.7K views
Untitled presentation(4)
chan20kaur
•
156 views
Qt coin3d soqt
charuchopra84
•
1.8K views
Qt for beginners part 4 doing more
ICS
•
2.8K views
Qt
Anupam Kumar Srivastava
•
553 views
Java and Serverless - A Match Made In Heaven, Part 2
Curity
•
66 views
More from Johan Thelin
Degrees of Freedom
Johan Thelin
142 views
•
35 slides
Hacktoberfest - An Open Source Story
Johan Thelin
286 views
•
32 slides
Open Source on Wheels - Tech Day by Init 2017
Johan Thelin
989 views
•
30 slides
Qt Automotive Suite - under the hood // Qt World Summit 2017
Johan Thelin
1.1K views
•
26 slides
QtWS15 Revolutionizing Automotive with Qt
Johan Thelin
1.9K views
•
21 slides
Introduction to Qt Embedded
Johan Thelin
722 views
•
33 slides
More from Johan Thelin
(6)
Degrees of Freedom
Johan Thelin
•
142 views
Hacktoberfest - An Open Source Story
Johan Thelin
•
286 views
Open Source on Wheels - Tech Day by Init 2017
Johan Thelin
•
989 views
Qt Automotive Suite - under the hood // Qt World Summit 2017
Johan Thelin
•
1.1K views
QtWS15 Revolutionizing Automotive with Qt
Johan Thelin
•
1.9K views
Introduction to Qt Embedded
Johan Thelin
•
722 views
Recently uploaded
UiPath Tips and Techniques for Error Handling - Session 2
DianaGray10
24 views
•
9 slides
How to use the Cataloguing Code Ethics at your day job : a hands-on workshop ...
CILIP MDG
34 views
•
13 slides
BuilderAI Proposal_Malesniak
Michael Lesniak
85 views
•
9 slides
LLaMA 2.pptx
RkRahul16
19 views
•
19 slides
ISO Survey 2022: ISO 27001 certificates (ISMS)
Andrey Prozorov, CISM, CIPP/E, CDPSE. LA 27001
79 views
•
10 slides
Prompt Engineering - an Art, a Science, or your next Job Title?
Maxim Salnikov
18 views
•
28 slides
Recently uploaded
(20)
UiPath Tips and Techniques for Error Handling - Session 2
DianaGray10
•
24 views
How to use the Cataloguing Code Ethics at your day job : a hands-on workshop ...
CILIP MDG
•
34 views
BuilderAI Proposal_Malesniak
Michael Lesniak
•
85 views
LLaMA 2.pptx
RkRahul16
•
19 views
ISO Survey 2022: ISO 27001 certificates (ISMS)
Andrey Prozorov, CISM, CIPP/E, CDPSE. LA 27001
•
79 views
Prompt Engineering - an Art, a Science, or your next Job Title?
Maxim Salnikov
•
18 views
Advancing Equity and Inclusion for Deaf Students in Higher Education
3Play Media
•
143 views
Future of Skills
Alison B. Lowndes
•
38 views
Safe Community Call #12.pdf
LornyPfeifer
•
15 views
Swiss Re Reinsurance Solutions - Automated Claims Experience – Insurer Innova...
The Digital Insurer
•
30 views
info_session_gdsc_tmsl .pptx
NikitaSingh741518
•
16 views
h2 meet pdf test.pdf
JohnLee971654
•
52 views
Framing Few Shot Knowledge Graph Completion with Large Language Models
MODUL Technology GmbH
•
27 views
Common WordPress APIs - Options API
Jonathan Bossenger
•
19 views
Elevate Your Enterprise with FME 23.1
Safe Software
•
277 views
Understanding Wireguard, TLS and Workload Identity
Christian Posta
•
100 views
Swiss Re Reinsurance Solutions - Claims Automated Rules Engine – Insurer Inno...
The Digital Insurer
•
19 views
Orchestration, Automation and Virtualisation Maturity Model
CSUC - Consorci de Serveis Universitaris de Catalunya
•
51 views
Cloud Composer workshop at Airflow Summit 2023.pdf
Leah Cole
•
77 views
Roottoo Innovation V24_CP.pdf
roottooinnovation
•
25 views
Building the QML Run-time
1.
Building the run-time
by Johan Thelin Pelagicore Copyright©2012 Johan Thelin CC-BY-SA
2.
Bio ●
Johan Thelin @e8johan ● Worked with Qt since 10+ years ● Author ● FoQD ● Articles ● Tutorials ● Embedded Linux Copyright©2012 Johan Thelin CC-BY-SA
3.
Work ●
Produces an In-Vehicle Infotainment (IVI) framework ● Open Source / Linux / Qt ● GENIVI / LinuxFoundation / Ubuntu Core ● We're hiring! ● http://www.pelagicore.com/career.html Copyright©2012 Johan Thelin CC-BY-SA
4.
Demo Screens
Copyright©2012 Johan Thelin CC-BY-SA
5.
Copyright©2012 Johan Thelin
CC-BY-SA
6.
Copyright©2012 Johan Thelin
CC-BY-SA
7.
Copyright©2012 Johan Thelin
CC-BY-SA
8.
Copyright©2012 Johan Thelin
CC-BY-SA
9.
QML is Productive ●
Developed over 2.5 months for CES 2012 ● Interaction and graphics design ● Run-time and QML development ● ~5 full time persons involved (team of 15) ● The code consists of ● 5986 loc (4871 / 1115 according to cloc) ● 10312 lines of QML (not loc) Copyright©2012 Johan Thelin CC-BY-SA
10.
QML in Five
Slides Copyright©2012 Johan Thelin CC-BY-SA
11.
QML 1(5) –
Creating and Naming import QtQuick 1.0 Rectangle { id: root Rectangle { id: red } Rectangle { id: yellow } } Copyright©2012 Johan Thelin CC-BY-SA
12.
QML 2(5) –
Basic Items Rectangle { width: … ● Rectangle height: … color: “#abcdef” } Image { ● Image } source: “...” Text { text: “abc 123” ● Text abc 123 font.family: “helvetica” font.pixelSize: 25 color: “black” } ● MouseArea Copyright©2012 Johan Thelin CC-BY-SA
13.
QML 3(5) –
Binding and Actions Rectangle { id: red width: 100; height: yellow.height color: “red” MouseArea { anchors.fill: parent onClicked: console.log(“I'm clicked!”) } } Copyright©2012 Johan Thelin CC-BY-SA
14.
QML 4(5) -
Components // Button.qml Rectangle { id: root signal clicked property string text Text { anchors.centerIn: parent; text: root.text } MouseArea { anchors.fill: parent onClicked: root.clicked() } } // main.qml Button { text: “Click me!”; onClicked: { … } } Copyright©2012 Johan Thelin CC-BY-SA
15.
QML 5(5) –
States and Transitions Rectangle { id: r states: [ State { name: “either” PropertyChanges { target: r; opacity: 1.0 } }, State { name: “or” PropertyChanges { target: r; opacity: 0.2 } } ] state: “either” transitions: [ Transition { PropertyAnimation { properties: “opacity”; duration: 3000 } } ] } Copyright©2012 Johan Thelin CC-BY-SA
16.
QML, Declarative and
QtQuick ● QtQuick consists of ● QML – the Qt Meta Language ● QtDeclarative – the Qt module for executing QML ● Tooling – Visual designer, profiler, viewer, etc Copyright©2012 Johan Thelin CC-BY-SA
17.
The Demonstrator
Copyright©2012 Johan Thelin CC-BY-SA
18.
Taking one Step
Back User Experience Run-time Environment Copyright©2012 Johan Thelin CC-BY-SA
19.
Taking one Step
Back QML HTML5 Qt and C++ Linux Copyright©2012 Johan Thelin CC-BY-SA
20.
Taking one Step
Back WebKit WebKit2 QML Qt 4.x Qt 5.x Deep Integration WebChannels Qt and C++ Copyright©2012 Johan Thelin CC-BY-SA
21.
The Interface
QML Values Classes Objects Qt and C++ Copyright©2012 Johan Thelin CC-BY-SA
22.
A Basic Run-Time int
main(int argc, char **argv) { QApplication a(argc, argv); QDeclarativeView view; view.setSource(“main.qml”); view.show(); return a.exec(); } Copyright©2012 Johan Thelin CC-BY-SA
23.
Exposing a Value ●
Expose it as a root context property, i.e. a global variable view.rootContext()-> setContextProperty(“itemWidth”, 350); ● Bind to it in QML Rectangle { width: itemWidth } Copyright©2012 Johan Thelin CC-BY-SA
24.
Exposing an Object class
ClimateControl : public QObject { Q_OBJECT Q_PROPERTY(int fanSpeed READ fanSpeed WRITE setFanSpeed NOTIFY fanSpeedChanged) public: Q_INVOKABLE resetClimate(); int fanSpeed() const; void setFanSpeed(int); Image { signals: source: “fan-image-” + void climateReset(); climate.fanSpeed + “.png” void fanSpeedChanged(); } }; Copyright©2012 Johan Thelin CC-BY-SA
25.
Exposing an Item ●
Inherit QDeclarativeItem ● Position and size ● Anchoring ● Keyboard focus ● For Qt 5, inherit QQuickPaintedItem ● Slightly different signature, but nothing dramatical ● http://bit.ly/y17W1n (Zchydem) ● Register using qmlRegisterType qmlRegisterType<MapItem>(“com.pelagicore.navigation”, 1, 0, “Map”); Copyright©2012 Johan Thelin CC-BY-SA
26.
From QML import com.pelagicore.navigation
1.0 Map { pitch: 30 zoom: 128 position: vehicle.position } Copyright©2012 Johan Thelin CC-BY-SA
27.
Exposing a Class ●
An item is just another QObject – you can expose more! ● Functional building blocks ● Dynamic control elements ● etc ● Just qmlRegisterType any type derived from QObject and let QML handle the instantiation Copyright©2012 Johan Thelin CC-BY-SA
28.
Models ●
The QAbstractItemModel interface provides a standardized way to expose data models in Qt ● Can be exposed both as objects and classes ● An ideal way to expose lists of data to QML ● The current playlist ● The locations of restaurants in the vicinity ● A list of tweets Copyright©2012 Johan Thelin CC-BY-SA
29.
A Basic Model class
PlayListModel : public QAbstractListModel { Q_OBJECT public: int rowCount() const; QVariant data(const QModelIndex&, int) const; QVariant headerData(int, Qt::Orientation, int) const; }; Copyright©2012 Johan Thelin CC-BY-SA
30.
Models in QML
Model View Separates the presentation Delegate from the visualization! Copyright©2012 Johan Thelin CC-BY-SA
31.
Available Views GridView
PathView ListView Copyright©2012 Johan Thelin CC-BY-SA
32.
And from QML... ●
Exposed as an object ListView { model: media.playlist delegate: PlayListDelegate {} } ● Exposed as a class MediaSearchModel { id: mediaModel } ListView { model: mediaModel delegate: MediaDelegate {} } Copyright©2012 Johan Thelin CC-BY-SA
33.
Exposing Different Roles ●
For each element of a model, there can be multiple roles ● Using QAbstractItemModel::setRoleNames more roles can be named ● Allows for easy-to-read delegates Text { text: albumName } Text { text: songDuration } Image { source: albumArtUrl } Copyright©2012 Johan Thelin CC-BY-SA
34.
Asynchronous Data Retrieval ●
Use canFetchMore and fetchMore to request more data bool canFetchMore(const QModelIndex&); void fetchMore(const QModelIndex&); ● Use beginInsertRows and endInsertRows when the data has been retrieved void MyModel::gotMoreData() { beginInsertRows(parent, first, last); updateModelWithNewData(); endInserRows(); } Copyright©2012 Johan Thelin CC-BY-SA
35.
Prototyping Models in
QML ListModel { id: musicModel ListElement { albumName: “The Wall” songTitle: “Empty Spaces” } ListElement { … } Copyright©2012 Johan Thelin CC-BY-SA
36.
When to do
what? Copyright©2012 Johan Thelin CC-BY-SA
37.
The Goals ●
QML controls ● Appearance ● Behaviour ● The run-time provides ● Functionality CC-BY ekkebus http://www.flickr.com/photos/ekkebus/5020840511/ ● Access to state and data ● A well defined interface allows designers and run-time developers to work in parallel Copyright©2012 Johan Thelin CC-BY-SA
38.
The State of
the System ● Use system-wide singletons per function, e.g. ● vehicle, climate, media ● Rationale ● There is only a single vehicle, so only one state ● Dividing them among functional areas – gives small, clean interfaces – allows limited system access for sandboxed elements Copyright©2012 Johan Thelin CC-BY-SA
39.
The State of
the System ● Provide properties ● media.masterVolume ● Provide signals for events ● navigation.onDestinationReached ● Provide methods for common functions ● media.mute Copyright©2012 Johan Thelin CC-BY-SA
40.
The State from
QML VolumeIndicator { volume: media.masterVolume } Slider { onValueChanged: { media.masterVolume = value; } } MuteButton { onClicked: media.mute(); } Connections { target: navigation onDestinationReached: navigation.resetDestination(); } Copyright©2012 Johan Thelin CC-BY-SA
41.
Data From the
System ● Use models for all data that is not a state ● What is a state and what is a model? ● Climate zone states? – driverTemperature, passengerTemperature, rearTemperature ● Climate zone as a model? zoneName temperature Driver 20.5 Passenger 20.0 Rear 22.0 ● How dynamic is your system? ● How dynamic is your design? Copyright©2012 Johan Thelin CC-BY-SA
42.
Object or Class ●
Exposing a model as an object ● There is only one playlist, use media.playlist, e.g. ListView { model: media.playlist } ● Exposing a model as a class ● There can be any number of search results, use MediaSearchModel, e.g. MediaSearchModel { id: search filter: “artist=Pink Floyd” } PathView { model: search } Copyright©2012 Johan Thelin CC-BY-SA
43.
The Engineering Choice ●
QML forces you to separate form and function ● It also gives you new choices ● Limiting the run-time environment saves development time short term ● Generalizing the run-time improves reuseability ● How do you work? ● What are you building? Copyright©2012 Johan Thelin CC-BY-SA
44.
Thank you!
@e8johan johan.thelin@pelagicore.com Copyright©2012 Johan Thelin CC-BY-SA