Soumettre la recherche
Mettre en ligne
Building the QML Run-time
•
3 j'aime
•
2,003 vues
Johan Thelin
Suivre
Slides from my presentation at opensourcedays 2012. http://opensourcedays.org/2012/node/95
Lire moins
Lire la suite
Technologie
Signaler
Partager
Signaler
Partager
1 sur 44
Télécharger maintenant
Télécharger pour lire hors ligne
Recommandé
Cross Platform Qt
Cross Platform Qt
Johan Thelin
Necessitas - Qt on Android - from FSCONS 2011
Necessitas - Qt on Android - from FSCONS 2011
Johan Thelin
Qt Workshop
Qt Workshop
Johan Thelin
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
Hello, QML
Hello, QML
Jack Yang
Qt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt Quick
ICS
State of the Art OpenGL and Qt
State of the Art OpenGL and Qt
ICS
QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong?
ICS
Recommandé
Cross Platform Qt
Cross Platform Qt
Johan Thelin
Necessitas - Qt on Android - from FSCONS 2011
Necessitas - Qt on Android - from FSCONS 2011
Johan Thelin
Qt Workshop
Qt Workshop
Johan Thelin
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
Hello, QML
Hello, QML
Jack Yang
Qt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt Quick
ICS
State of the Art OpenGL and Qt
State of the Art OpenGL and Qt
ICS
QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong?
ICS
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1 overview and key concepts
ICS
Qt Internationalization
Qt Internationalization
ICS
Qt for beginners part 2 widgets
Qt for beginners part 2 widgets
ICS
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
ICS
Intro to QML / Declarative UI
Intro to QML / Declarative UI
OpenBossa
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3
ICS
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7
Pasi Kellokoski
QVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI development
ICS
Qt for beginners part 5 ask the experts
Qt for beginners part 5 ask the experts
ICS
Treinamento Qt básico - aula I
Treinamento Qt básico - aula I
Marcelo Barros de Almeida
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
Zachary Blair
Qt Widget In-Depth
Qt Widget In-Depth
account inactive
So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?
Janel Heilbrunn
Meet the Widgets: Another Way to Implement UI
Meet the Widgets: Another Way to Implement UI
ICS
Qt 5 - C++ and Widgets
Qt 5 - C++ and Widgets
Juha Peltomäki
Migrating from Photon to Qt
Migrating from Photon to Qt
Janel Heilbrunn
Treinamento Qt básico - aula II
Treinamento Qt básico - aula II
Marcelo Barros de Almeida
OpenGL Introduction.
OpenGL Introduction.
Girish Ghate
The Future of Qt Widgets
The Future of Qt Widgets
Marius Bugge Monsen
Programming with OpenGL
Programming with OpenGL
Syed Zaid Irshad
Repair My Credit Score
Repair My Credit Score
Legacy Legal
E-Tech 7.2 Summer 2010
E-Tech 7.2 Summer 2010
Candiek
Contenu connexe
Tendances
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1 overview and key concepts
ICS
Qt Internationalization
Qt Internationalization
ICS
Qt for beginners part 2 widgets
Qt for beginners part 2 widgets
ICS
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
ICS
Intro to QML / Declarative UI
Intro to QML / Declarative UI
OpenBossa
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3
ICS
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7
Pasi Kellokoski
QVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI development
ICS
Qt for beginners part 5 ask the experts
Qt for beginners part 5 ask the experts
ICS
Treinamento Qt básico - aula I
Treinamento Qt básico - aula I
Marcelo Barros de Almeida
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
Zachary Blair
Qt Widget In-Depth
Qt Widget In-Depth
account inactive
So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?
Janel Heilbrunn
Meet the Widgets: Another Way to Implement UI
Meet the Widgets: Another Way to Implement UI
ICS
Qt 5 - C++ and Widgets
Qt 5 - C++ and Widgets
Juha Peltomäki
Migrating from Photon to Qt
Migrating from Photon to Qt
Janel Heilbrunn
Treinamento Qt básico - aula II
Treinamento Qt básico - aula II
Marcelo Barros de Almeida
OpenGL Introduction.
OpenGL Introduction.
Girish Ghate
The Future of Qt Widgets
The Future of Qt Widgets
Marius Bugge Monsen
Programming with OpenGL
Programming with OpenGL
Syed Zaid Irshad
Tendances
(20)
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1 overview and key concepts
Qt Internationalization
Qt Internationalization
Qt for beginners part 2 widgets
Qt for beginners part 2 widgets
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
Intro to QML / Declarative UI
Intro to QML / Declarative UI
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7
QVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI development
Qt for beginners part 5 ask the experts
Qt for beginners part 5 ask the experts
Treinamento Qt básico - aula I
Treinamento Qt básico - aula I
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
Qt Widget In-Depth
Qt Widget In-Depth
So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?
Meet the Widgets: Another Way to Implement UI
Meet the Widgets: Another Way to Implement UI
Qt 5 - C++ and Widgets
Qt 5 - C++ and Widgets
Migrating from Photon to Qt
Migrating from Photon to Qt
Treinamento Qt básico - aula II
Treinamento Qt básico - aula II
OpenGL Introduction.
OpenGL Introduction.
The Future of Qt Widgets
The Future of Qt Widgets
Programming with OpenGL
Programming with OpenGL
En vedette
Repair My Credit Score
Repair My Credit Score
Legacy Legal
E-Tech 7.2 Summer 2010
E-Tech 7.2 Summer 2010
Candiek
Best Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IV
ICS
Informativo n° 25 2º básico a- viernes 06 de septiembre (2)
Informativo n° 25 2º básico a- viernes 06 de septiembre (2)
Colegio Camilo Henríquez
Best Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part III
ICS
Apostila pablo stolze
Apostila pablo stolze
ILDA VALENTIM
English Study and History of the English Lanaguage
English Study and History of the English Lanaguage
ISE NUESTRA SEÑORA DE CHOTA
Trabajo Nº 4 - Proyecto Pueblos Originarios de Chile
Trabajo Nº 4 - Proyecto Pueblos Originarios de Chile
Colegio Camilo Henríquez
UK-culture
UK-culture
Aziz Bhatiya
En vedette
(9)
Repair My Credit Score
Repair My Credit Score
E-Tech 7.2 Summer 2010
E-Tech 7.2 Summer 2010
Best Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IV
Informativo n° 25 2º básico a- viernes 06 de septiembre (2)
Informativo n° 25 2º básico a- viernes 06 de septiembre (2)
Best Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part III
Apostila pablo stolze
Apostila pablo stolze
English Study and History of the English Lanaguage
English Study and History of the English Lanaguage
Trabajo Nº 4 - Proyecto Pueblos Originarios de Chile
Trabajo Nº 4 - Proyecto Pueblos Originarios de Chile
UK-culture
UK-culture
Similaire à Building the QML Run-time
An Introductory course on Verilog HDL-Verilog hdl ppr
An Introductory course on Verilog HDL-Verilog hdl ppr
Prabhavathi P
Fun with QML
Fun with QML
ICS
Deltacloud Presentation - OSSConf 2010
Deltacloud Presentation - OSSConf 2010
Michal Fojtik
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
GetInData
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
CybercomChannel
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"
GlobalLogic Ukraine
Introduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
Prabindh Sundareson
Google Cloud Dataflow
Google Cloud Dataflow
Alex Van Boxel
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
ICS
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
Janel Heilbrunn
Feb 2018 Spinnaker Meetup Reddit Presentation
Feb 2018 Spinnaker Meetup Reddit Presentation
Edward Ceaser
Universal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon Chemouil
mfrancis
Andreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith Qt
NokiaAppForum
HTML literals, the JSX of the platform
HTML literals, the JSX of the platform
Kenneth Rohde Christiansen
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Girl Geek Dinners Milano
Untitled presentation(4)
Untitled presentation(4)
chan20kaur
Qt coin3d soqt
Qt coin3d soqt
charuchopra84
Qt for beginners part 4 doing more
Qt for beginners part 4 doing more
ICS
Qt
Qt
Anupam Kumar Srivastava
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2
Curity
Similaire à Building the QML Run-time
(20)
An Introductory course on Verilog HDL-Verilog hdl ppr
An Introductory course on Verilog HDL-Verilog hdl ppr
Fun with QML
Fun with QML
Deltacloud Presentation - OSSConf 2010
Deltacloud Presentation - OSSConf 2010
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"
Introduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
Google Cloud Dataflow
Google Cloud Dataflow
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
Feb 2018 Spinnaker Meetup Reddit Presentation
Feb 2018 Spinnaker Meetup Reddit Presentation
Universal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon Chemouil
Andreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith Qt
HTML literals, the JSX of the platform
HTML literals, the JSX of the platform
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Untitled presentation(4)
Untitled presentation(4)
Qt coin3d soqt
Qt coin3d soqt
Qt for beginners part 4 doing more
Qt for beginners part 4 doing more
Qt
Qt
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2
Plus de Johan Thelin
Degrees of Freedom
Degrees of Freedom
Johan Thelin
Hacktoberfest - An Open Source Story
Hacktoberfest - An Open Source Story
Johan Thelin
Open Source on Wheels - Tech Day by Init 2017
Open Source on Wheels - Tech Day by Init 2017
Johan Thelin
Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017
Johan Thelin
QtWS15 Revolutionizing Automotive with Qt
QtWS15 Revolutionizing Automotive with Qt
Johan Thelin
Introduction to Qt Embedded
Introduction to Qt Embedded
Johan Thelin
Plus de Johan Thelin
(6)
Degrees of Freedom
Degrees of Freedom
Hacktoberfest - An Open Source Story
Hacktoberfest - An Open Source Story
Open Source on Wheels - Tech Day by Init 2017
Open Source on Wheels - Tech Day by Init 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017
QtWS15 Revolutionizing Automotive with Qt
QtWS15 Revolutionizing Automotive with Qt
Introduction to Qt Embedded
Introduction to Qt Embedded
Dernier
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Alan Dix
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
HostedbyConfluent
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
Neo4j
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Malak Abu Hammad
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Padma Pradeep
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
2toLead Limited
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
AndikSusilo4
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Dernier
(20)
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
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
Télécharger maintenant