SlideShare une entreprise Scribd logo
1  sur  44
Télécharger pour lire hors ligne
Building the run-time
     by Johan Thelin
       Pelagicore




       Copyright©2012 Johan Thelin
                CC-BY-SA
Bio
●   Johan Thelin                                    @e8johan

●   Worked with Qt
    since 10+ years
●   Author
    ●   FoQD
    ●   Articles
    ●   Tutorials
●   Embedded Linux
                      Copyright©2012 Johan Thelin
                               CC-BY-SA
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
Demo Screens




  Copyright©2012 Johan Thelin
           CC-BY-SA
Copyright©2012 Johan Thelin
         CC-BY-SA
Copyright©2012 Johan Thelin
         CC-BY-SA
Copyright©2012 Johan Thelin
         CC-BY-SA
Copyright©2012 Johan Thelin
         CC-BY-SA
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
QML in Five Slides




    Copyright©2012 Johan Thelin
             CC-BY-SA
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
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
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
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
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
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
The Demonstrator




    Copyright©2012 Johan Thelin
             CC-BY-SA
Taking one Step Back


       User Experience




            Run-time




          Environment




      Copyright©2012 Johan Thelin
               CC-BY-SA
Taking one Step Back


    QML                             HTML5




              Qt and C++




                   Linux




          Copyright©2012 Johan Thelin
                   CC-BY-SA
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
The Interface


                     QML




 Values
                                          Classes
Objects




                Qt and C++




            Copyright©2012 Johan Thelin
                     CC-BY-SA
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
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
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
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
From QML
import com.pelagicore.navigation 1.0


Map {
    pitch: 30
    zoom: 128
    position: vehicle.position
}

                 Copyright©2012 Johan Thelin
                          CC-BY-SA
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
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
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
Models in QML



 Model




                                                 View




                                       Separates the presentation
Delegate                                 from the visualization!

              Copyright©2012 Johan Thelin
                       CC-BY-SA
Available Views

GridView




               PathView
                                            ListView




              Copyright©2012 Johan Thelin
                       CC-BY-SA
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
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
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
Prototyping Models in QML
ListModel {
    id: musicModel


    ListElement {
         albumName: “The Wall”
         songTitle: “Empty Spaces”
    }
    ListElement {
         …
}
                     Copyright©2012 Johan Thelin
                              CC-BY-SA
When to do what?




   Copyright©2012 Johan Thelin
            CC-BY-SA
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
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
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
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
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
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
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
Thank you!
           @e8johan
johan.thelin@pelagicore.com




        Copyright©2012 Johan Thelin
                 CC-BY-SA

Contenu connexe

Tendances

Qt for beginners part 1 overview and key concepts
Qt for beginners part 1   overview and key conceptsQt for beginners part 1   overview and key concepts
Qt for beginners part 1 overview and key conceptsICS
 
Qt Internationalization
Qt InternationalizationQt Internationalization
Qt InternationalizationICS
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt for beginners part 2   widgets
Qt for beginners part 2 widgetsICS
 
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with QtConvert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with QtICS
 
Intro to QML / Declarative UI
Intro to QML / Declarative UIIntro to QML / Declarative UI
Intro to QML / Declarative UIOpenBossa
 
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3ICS
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Pasi Kellokoski
 
QVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI developmentQVariant, QObject — Qt's not just for GUI development
QVariant, QObject — Qt's not just for GUI developmentICS
 
Qt for beginners part 5 ask the experts
Qt for beginners part 5   ask the expertsQt for beginners part 5   ask the experts
Qt for beginners part 5 ask the expertsICS
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkZachary Blair
 
So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?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 UIMeet the Widgets: Another Way to Implement UI
Meet the Widgets: Another Way to Implement UIICS
 
Migrating from Photon to Qt
Migrating from Photon to QtMigrating from Photon to Qt
Migrating from Photon to QtJanel Heilbrunn
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.Girish Ghate
 

Tendances (20)

Qt for beginners part 1 overview and key concepts
Qt for beginners part 1   overview and key conceptsQt for beginners part 1   overview and key concepts
Qt for beginners part 1 overview and key concepts
 
Qt Internationalization
Qt InternationalizationQt Internationalization
Qt Internationalization
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt 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 QtConvert 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 UIIntro to QML / Declarative UI
Intro to QML / Declarative UI
 
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3Best 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.7Qt 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 developmentQVariant, 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 expertsQt 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 ITreinamento 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 FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
 
Qt Widget In-Depth
Qt Widget In-DepthQt Widget In-Depth
Qt Widget In-Depth
 
So I Downloaded Qt, Now What?
So I Downloaded Qt, Now What?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 UIMeet the Widgets: Another Way to Implement UI
Meet the Widgets: Another Way to Implement UI
 
Qt 5 - C++ and Widgets
Qt 5 - C++ and WidgetsQt 5 - C++ and Widgets
Qt 5 - C++ and Widgets
 
Migrating from Photon to Qt
Migrating from Photon to QtMigrating from Photon to Qt
Migrating from Photon to Qt
 
Treinamento Qt básico - aula II
Treinamento Qt básico - aula IITreinamento Qt básico - aula II
Treinamento Qt básico - aula II
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.
 
The Future of Qt Widgets
The Future of Qt WidgetsThe Future of Qt Widgets
The Future of Qt Widgets
 
Programming with OpenGL
Programming with OpenGLProgramming with OpenGL
Programming with OpenGL
 

En vedette

Repair My Credit Score
Repair My Credit ScoreRepair My Credit Score
Repair My Credit ScoreLegacy Legal
 
E-Tech 7.2 Summer 2010
E-Tech 7.2 Summer 2010E-Tech 7.2 Summer 2010
E-Tech 7.2 Summer 2010Candiek
 
Best Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVBest Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVICS
 
Informativo n° 25 2º básico a- viernes 06 de septiembre (2)
Informativo n° 25  2º básico a- viernes 06 de septiembre (2)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 IIIBest Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIICS
 
Apostila pablo stolze
Apostila pablo stolzeApostila pablo stolze
Apostila pablo stolzeILDA VALENTIM
 
English Study and History of the English Lanaguage
English Study and History of the English LanaguageEnglish Study and History of the English Lanaguage
English Study and History of the English LanaguageISE NUESTRA SEÑORA DE CHOTA
 
Trabajo Nº 4 - Proyecto Pueblos Originarios de Chile
Trabajo Nº 4 - Proyecto Pueblos Originarios de ChileTrabajo Nº 4 - Proyecto Pueblos Originarios de Chile
Trabajo Nº 4 - Proyecto Pueblos Originarios de ChileColegio Camilo Henríquez
 

En vedette (9)

Repair My Credit Score
Repair My Credit ScoreRepair My Credit Score
Repair My Credit Score
 
E-Tech 7.2 Summer 2010
E-Tech 7.2 Summer 2010E-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 IVBest 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)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 IIIBest Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part III
 
Apostila pablo stolze
Apostila pablo stolzeApostila pablo stolze
Apostila pablo stolze
 
English Study and History of the English Lanaguage
English Study and History of the English LanaguageEnglish 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 ChileTrabajo Nº 4 - Proyecto Pueblos Originarios de Chile
Trabajo Nº 4 - Proyecto Pueblos Originarios de Chile
 
UK-culture
UK-cultureUK-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 pprAn Introductory course on Verilog HDL-Verilog hdl ppr
An Introductory course on Verilog HDL-Verilog hdl pprPrabhavathi P
 
Fun with QML
Fun with QMLFun with QML
Fun with QMLICS
 
Deltacloud Presentation - OSSConf 2010
Deltacloud Presentation - OSSConf 2010Deltacloud Presentation - OSSConf 2010
Deltacloud Presentation - OSSConf 2010Michal Fojtik
 
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInDataModel serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInDataGetInData
 
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.2010Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010CybercomChannel
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"GlobalLogic Ukraine
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarICS
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarJanel Heilbrunn
 
Feb 2018 Spinnaker Meetup Reddit Presentation
Feb 2018 Spinnaker Meetup Reddit PresentationFeb 2018 Spinnaker Meetup Reddit Presentation
Feb 2018 Spinnaker Meetup Reddit PresentationEdward Ceaser
 
Universal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon ChemouilUniversal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon Chemouilmfrancis
 
Andreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith QtAndreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith QtNokiaAppForum
 
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10Girl Geek Dinners Milano
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)chan20kaur
 
Qt for beginners part 4 doing more
Qt for beginners part 4   doing moreQt for beginners part 4   doing more
Qt for beginners part 4 doing moreICS
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Curity
 

Similaire à Building the QML Run-time (20)

An Introductory course on Verilog HDL-Verilog hdl ppr
An Introductory course on Verilog HDL-Verilog hdl pprAn Introductory course on Verilog HDL-Verilog hdl ppr
An Introductory course on Verilog HDL-Verilog hdl ppr
 
Fun with QML
Fun with QMLFun with QML
Fun with QML
 
Deltacloud Presentation - OSSConf 2010
Deltacloud Presentation - OSSConf 2010Deltacloud 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, GetInDataModel 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.2010Qt 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?"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 GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
 
Google Cloud Dataflow
Google Cloud DataflowGoogle Cloud Dataflow
Google Cloud Dataflow
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
 
Feb 2018 Spinnaker Meetup Reddit Presentation
Feb 2018 Spinnaker Meetup Reddit PresentationFeb 2018 Spinnaker Meetup Reddit Presentation
Feb 2018 Spinnaker Meetup Reddit Presentation
 
Universal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon ChemouilUniversal Declarative Services - Simon Chemouil
Universal Declarative Services - Simon Chemouil
 
Andreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith QtAndreas 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 platformHTML 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 10Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
Luca Filigheddu - Sviluppiamo in Cascades per Blackberry 10
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)
 
Qt coin3d soqt
Qt coin3d soqtQt coin3d soqt
Qt coin3d soqt
 
Qt for beginners part 4 doing more
Qt for beginners part 4   doing moreQt for beginners part 4   doing more
Qt for beginners part 4 doing more
 
Qt
QtQt
Qt
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java 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 FreedomDegrees of Freedom
Degrees of FreedomJohan Thelin
 
Hacktoberfest - An Open Source Story
Hacktoberfest - An Open Source StoryHacktoberfest - An Open Source Story
Hacktoberfest - An Open Source StoryJohan Thelin
 
Open Source on Wheels - Tech Day by Init 2017
Open Source on Wheels - Tech Day by Init 2017Open Source on Wheels - Tech Day by Init 2017
Open Source on Wheels - Tech Day by Init 2017Johan Thelin
 
Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017Johan Thelin
 
QtWS15 Revolutionizing Automotive with Qt
QtWS15 Revolutionizing Automotive with QtQtWS15 Revolutionizing Automotive with Qt
QtWS15 Revolutionizing Automotive with QtJohan Thelin
 
Introduction to Qt Embedded
Introduction to Qt EmbeddedIntroduction to Qt Embedded
Introduction to Qt EmbeddedJohan Thelin
 

Plus de Johan Thelin (6)

Degrees of Freedom
Degrees of FreedomDegrees of Freedom
Degrees of Freedom
 
Hacktoberfest - An Open Source Story
Hacktoberfest - An Open Source StoryHacktoberfest - 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 2017Open 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 2017Qt 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 QtQtWS15 Revolutionizing Automotive with Qt
QtWS15 Revolutionizing Automotive with Qt
 
Introduction to Qt Embedded
Introduction to Qt EmbeddedIntroduction to Qt Embedded
Introduction to Qt Embedded
 

Dernier

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

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
  • 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