SlideShare a Scribd company logo
1 of 23
Download to read offline
Rapid Application
                         Development with
                            Qt Quick
                              Henrik Hartz




Monday, April 26, 2010                       1
Agenda
                     •   Background
                     •   Structure of a Quick App
                     •   Hello Elements
                     •   Integrating with Native code
                     •   Hello Device
                     •   Adding New Semantics
                     •   Hello Widgets


Monday, April 26, 2010                                  2
Background
                           QWidget                QGraphicsView                     Components
                   Controls come from         Low-level API                   Convenience of prebuilt
                   desktop                                                    components

                   Controls are boxed         Close to hardware               C++


                   Controls are for Mouse     Cumbersome to implement Difficult to customize
                                              fluid UI

                   Controls are heavyweight   Limited API to push             UX-specific
                                              hardware capapbilities

                                              Easy to shoot yourself in the
                                              foot




Monday, April 26, 2010                                                                                  3
Qt Quick App
                QML              QtDeclarativeView

          Java   UI
                                      JavaScriptCore
         Script
                               QtDeclarative
                                        QtWebKit
                             QtSVG                     QtOpenGL
                              QtGui               QtXmlPatterns
                         QtNetwork    QtXml     QtScript QtSQL

                                      QtCore
                                        System Libs


Monday, April 26, 2010                                            4
Qt Meta-Object Language
                         import Qt 4.7
                         import "content"

                         Rectangle {
                             color: "#545454"
                             width: 300; height: 300

                             // Dial with a slider to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }

                             Rectangle {
                                 id: container
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                 anchors.right: parent.right; anchors.rightMargin: 20; height: 16
                                 gradient: Gradient {
                                     GradientStop { position: 0.0; color: "gray" }
                                     GradientStop { position: 1.0; color: "white" }
                                 }
                                 radius: 8; opacity: 0.7; smooth: true
                                 Rectangle {
                                     id: slider
                                     x: 1; y: 1; width: 30; height: 14
                                     radius: 6; smooth: true
                                     gradient: Gradient {
                                         GradientStop { position: 0.0; color: "#424242" }
                                         GradientStop { position: 1.0; color: "black" }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
Qt Meta-Object Language
                         import Qt 4.7
Built-in                 import "content"
Elements
                         Rectangle {
                             color: "#545454"
                             width: 300; height: 300

                             // Dial with a slider to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }

                             Rectangle {
                                 id: container
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                 anchors.right: parent.right; anchors.rightMargin: 20; height: 16
                                 gradient: Gradient {
                                     GradientStop { position: 0.0; color: "gray" }
                                     GradientStop { position: 1.0; color: "white" }
                                 }
                                 radius: 8; opacity: 0.7; smooth: true
                                 Rectangle {
                                     id: slider
                                     x: 1; y: 1; width: 30; height: 14
                                     radius: 6; smooth: true
                                     gradient: Gradient {
                                         GradientStop { position: 0.0; color: "#424242" }
                                         GradientStop { position: 1.0; color: "black" }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
Qt Meta-Object Language
                         import Qt 4.7
                         import "content"
Local Elements
                         Rectangle {
                             color: "#545454"
                             width: 300; height: 300

                             // Dial with a slider to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }

                             Rectangle {
                                 id: container
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                 anchors.right: parent.right; anchors.rightMargin: 20; height: 16
                                 gradient: Gradient {
                                     GradientStop { position: 0.0; color: "gray" }
                                     GradientStop { position: 1.0; color: "white" }
                                 }
                                 radius: 8; opacity: 0.7; smooth: true
                                 Rectangle {
                                     id: slider
                                     x: 1; y: 1; width: 30; height: 14
                                     radius: 6; smooth: true
                                     gradient: Gradient {
                                         GradientStop { position: 0.0; color: "#424242" }
                                         GradientStop { position: 1.0; color: "black" }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
Qt Meta-Object Language
                         import Qt 4.7
                         import "content"

                         Rectangle {
Toplevel                     color: "#545454"
Window                       width: 300; height: 300

                             // Dial with a slider to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }

                             Rectangle {
                                 id: container
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                 anchors.right: parent.right; anchors.rightMargin: 20; height: 16
                                 gradient: Gradient {
                                     GradientStop { position: 0.0; color: "gray" }
                                     GradientStop { position: 1.0; color: "white" }
                                 }
                                 radius: 8; opacity: 0.7; smooth: true
                                 Rectangle {
                                     id: slider
                                     x: 1; y: 1; width: 30; height: 14
                                     radius: 6; smooth: true
                                     gradient: Gradient {
                                         GradientStop { position: 0.0; color: "#424242" }
                                         GradientStop { position: 1.0; color: "black" }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
Qt Meta-Object Language
                         import Qt 4.7
                         import "content"

                         Rectangle {
                             color: "#545454"
Basic                        width: 300; height: 300
properties                   // Dial with a slider to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }

                             Rectangle {
                                 id: container
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                 anchors.right: parent.right; anchors.rightMargin: 20; height: 16
                                 gradient: Gradient {
                                     GradientStop { position: 0.0; color: "gray" }
                                     GradientStop { position: 1.0; color: "white" }
                                 }
                                 radius: 8; opacity: 0.7; smooth: true
                                 Rectangle {
                                     id: slider
                                     x: 1; y: 1; width: 30; height: 14
                                     radius: 6; smooth: true
                                     gradient: Gradient {
                                         GradientStop { position: 0.0; color: "#424242" }
                                         GradientStop { position: 1.0; color: "black" }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
import Qt 4.7




           Qt Meta-Object Language
                                            Item {
                                                id: root
                                                property real value : 0

                                                width: 210; height: 210

                                                Image { source: "background.png" }

                         import Qt 4.7         Image {
                         import "content"          x: 93
                                                   y: 35
                         Rectangle {               source: "needle_shadow.png"
                             color: "#545454"      transform: Rotation {
                             width: 300; height: 300 origin.x: 11; origin.y: 67
                                                       angle: needleRotation.angle
                             // Dial with a slider }to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }
                                               }
Custom Type                                    Image {
                             Rectangle {           id: needle
                                 id: container     x: 95; y: 33
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                                   smooth: true
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                                   source: "needle.png"
                                 anchors.right: parent.right; Rotation {
                                                   transform: anchors.rightMargin: 20; height: 16
                                 gradient: Gradient { id: needleRotation
                                     GradientStop { position: 0.0; color: "gray" }
                                                       origin.x: 7; origin.y: 65
                                     GradientStop { position: -130 color: "white" }
                                                       angle: 1.0;
                                 }                     SpringFollow on angle {
                                 radius: 8; opacity: 0.7; smooth: true
                                                           spring: 1.4
                                 Rectangle {               damping: .15
                                     id: slider            to: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
                                     x: 1; y: 1; width: 30; height: 14
                                                       }
                                     radius: 6; smooth: true
                                                   }
                                     gradient: }Gradient {
                                         GradientStop { position: 0.0; color: "#424242" } }
                                               Image { x: 21; y: 18; source: "overlay.png"
                                         GradientStop { position: 1.0; color: "black" }
                                          }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
import Qt 4.7




           Qt Meta-Object Language
                                            Item {
                                                id: root
                                                property real value : 0

                                                width: 210; height: 210

                                                Image { source: "background.png" }

                         import Qt 4.7         Image {
                         import "content"          x: 93
                                                   y: 35
                         Rectangle {               source: "needle_shadow.png"
                             color: "#545454"      transform: Rotation {
                             width: 300; height: 300 origin.x: 11; origin.y: 67
                                                       angle: needleRotation.angle
                             // Dial with a slider }to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }
                                               }
                                               Image {
                             Rectangle {           id: needle
                                 id: container     x: 95; y: 33
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                                   smooth: true
Anchor Lines                     anchors.left: parent.left; anchors.leftMargin: 20
                                                   source: "needle.png"
w/Margins                        anchors.right: parent.right; Rotation {
                                                   transform: anchors.rightMargin: 20; height: 16
                                 gradient: Gradient { id: needleRotation
                                     GradientStop { position: 0.0; color: "gray" }
                                                       origin.x: 7; origin.y: 65
                                     GradientStop { position: -130 color: "white" }
                                                       angle: 1.0;
                                 }                     SpringFollow on angle {
                                 radius: 8; opacity: 0.7; smooth: true
                                                           spring: 1.4
                                 Rectangle {               damping: .15
                                     id: slider            to: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
                                     x: 1; y: 1; width: 30; height: 14
                                                       }
                                     radius: 6; smooth: true
                                                   }
                                     gradient: }Gradient {
                                         GradientStop { position: 0.0; color: "#424242" } }
                                               Image { x: 21; y: 18; source: "overlay.png"
                                         GradientStop { position: 1.0; color: "black" }
                                          }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
import Qt 4.7




           Qt Meta-Object Language
                                            Item {
                                                id: root
                                                property real value : 0

                                                width: 210; height: 210

                                                Image { source: "background.png" }

                         import Qt 4.7         Image {
                         import "content"          x: 93
                                                   y: 35
                         Rectangle {               source: "needle_shadow.png"
                             color: "#545454"      transform: Rotation {
                             width: 300; height: 300 origin.x: 11; origin.y: 67
                                                       angle: needleRotation.angle
                             // Dial with a slider }to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }
                                               }
                                               Image {
                             Rectangle {           id: needle
                                 id: container     x: 95; y: 33
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                                   smooth: true
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                                   source: "needle.png"
                                 anchors.right: parent.right; Rotation {
                                                   transform: anchors.rightMargin: 20; height: 16
                                 gradient: Gradient { id: needleRotation
                                     GradientStop { position: 0.0; color: "gray" }
                                                       origin.x: 7; origin.y: 65
                                     GradientStop { position: -130 color: "white" }
                                                       angle: 1.0;
                                 }                     SpringFollow on angle {
                                 radius: 8; opacity: 0.7; smooth: true
                                                           spring: 1.4
                                 Rectangle {               damping: .15
                                     id: slider            to: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
                                     x: 1; y: 1; width: 30; height: 14
                                                       }
                                     radius: 6; smooth: true
                                                   }
                                     gradient: }Gradient {
                                         GradientStop { position: 0.0; color: "#424242" } }
                                               Image { x: 21; y: 18; source: "overlay.png"
                                         GradientStop { position: 1.0; color: "black" }
                                          }
                                     }
                                     MouseArea {
Mouse                                    anchors.fill: parent
Interaction area                     }
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32

                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
import Qt 4.7




           Qt Meta-Object Language
                                            Item {
                                                id: root
                                                property real value : 0

                                                width: 210; height: 210

                                                Image { source: "background.png" }

                         import Qt 4.7         Image {
                         import "content"          x: 93
                                                   y: 35
                         Rectangle {               source: "needle_shadow.png"
                             color: "#545454"      transform: Rotation {
                             width: 300; height: 300 origin.x: 11; origin.y: 67
                                                       angle: needleRotation.angle
                             // Dial with a slider }to adjust it
                             Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) }
                                               }
                                               Image {
                             Rectangle {           id: needle
                                 id: container     x: 95; y: 33
                                 anchors.bottom: parent.bottom; anchors.bottomMargin: 10
                                                   smooth: true
                                 anchors.left: parent.left; anchors.leftMargin: 20
                                                   source: "needle.png"
                                 anchors.right: parent.right; Rotation {
                                                   transform: anchors.rightMargin: 20; height: 16
                                 gradient: Gradient { id: needleRotation
                                     GradientStop { position: 0.0; color: "gray" }
                                                       origin.x: 7; origin.y: 65
                                     GradientStop { position: -130 color: "white" }
                                                       angle: 1.0;
                                 }                     SpringFollow on angle {
                                 radius: 8; opacity: 0.7; smooth: true
                                                           spring: 1.4
                                 Rectangle {               damping: .15
                                     id: slider            to: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
                                     x: 1; y: 1; width: 30; height: 14
                                                       }
                                     radius: 6; smooth: true
                                                   }
                                     gradient: }Gradient {
                                         GradientStop { position: 0.0; color: "#424242" } }
                                               Image { x: 21; y: 18; source: "overlay.png"
                                         GradientStop { position: 1.0; color: "black" }
                                          }
                                     }
                                     MouseArea {
                                         anchors.fill: parent
                                         drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32
                                     }
                                 }
                             }
                         }




Monday, April 26, 2010                                                                                                                    5
Code Walkthrough
                     • (MeeGo?) RSS viewer
                      • Written in-flight; ~4 hrs
                      • Single window, 2 lists
                      • Graphics borrowed



Monday, April 26, 2010                             6
Hello Elements
                     • Item, Rectangle
                     • MouseArea, LineEdit
                     • Model,View
                     • BorderImage, Gradient, Rotation



Monday, April 26, 2010                                   7
What’s Quick about it?
                     •   Simplicity of language and intuitive structure
                         •   Created with Designers in mind
                         •   Easy to pick up
                         •   Good separation between code and presentation
                     •   Designers and developers in same environment
                         •   Common understanding of semantics
                         •   Design around same constraints
                     •   Hardware accelerated
                         •   Openl GL (ES), OpenVG



Monday, April 26, 2010                                                       8
States and Transitions
                     • State represents a configuration of
                         properties for some items
                         • PropertyChanges, ParentChange,
                           AnchorChanges
                     • Transitions define interpolation between two
                         states
                         • PropertyAnimation, SequentialAnimation/
                           ParallelAnimation, PauseAnimation


Monday, April 26, 2010                                               9
Integrating with Native Code
                     • QtDeclarative == Qt, native C++
                     • QGraphicsView runtime environment
                         populated by QDeclarativeEngine::load()
                     • All QMetaObject information exposed
                      • Signals, Slots, Properties
                     ➡Easy to bind to native business logic

Monday, April 26, 2010                                             10
Hello Device
                     • QML UI ‘runtime’ identical on Desktop and
                         Device
                     • Device-specific features can be guarded and
                         added in executable
                     • Device-specific packaging apply
                     • Lets do it..

Monday, April 26, 2010                                              11
Adding New Semantics
                     • Any QGraphicsItem can be exposed
                         #define QML_DECLARE_TYPE(T)

                         int qmlRegisterType ( const char * uri,
                                               int versionMajor,
                                               int versionMinor,
                                               const char * qmlName )


                     • Must subclass QObject, default-constructor
                     • Properties can be bound to if
                          NOTIFY is present


Monday, April 26, 2010                                                  12
Hello Widgets




         http://qt.gitorious.org/qt-components
Monday, April 26, 2010                           13
Roadmap
                     ✓ Emulate MeeGo Netbook UX with Qt (QML)
                     • WIP components to enable easy app creation, starting with
                         embedded/mobile space
                         •   MeeGo handset-optimized
                         •   ...but will work on others too
                     •   Enable bindings of other UX
                         (QGraphicsView-based) to QML
                     •   Working on controller API for UI
                         •   i.e. models pluggable to multiple UX
                         •   http://qt.gitorious.org/qt-components



Monday, April 26, 2010                                                             14
Where, What, How?
                     •   http://qt.nokia.com/developer/qt-roadmap
                     •   http://qt.nokia.com/doc/4.7-snapshot/declarativeui.html
                     •   4.7 branch of git://gitorious.org/qt/qt.git
                     •   http://labs.trolltech.com/blogs/category/labs/graphics/
                         kinetic/declarative_ui/
                     •   http://twitter.com/#search?q=QML
                     •   http://chaos.troll.no/~hhartz/
                         QtQuickAtLinuxCollaborationSummit2010.pdf
                     •   #qt-qml on irc.freenode.org



Monday, April 26, 2010                                                             15

More Related Content

Viewers also liked

евдокимова о. кухонная посуда цептер
евдокимова о. кухонная посуда цептеревдокимова о. кухонная посуда цептер
евдокимова о. кухонная посуда цептерRaimando
 
η ελληνίδα την περίοδο του μεσοπολέμου
η ελληνίδα την περίοδο του μεσοπολέμουη ελληνίδα την περίοδο του μεσοπολέμου
η ελληνίδα την περίοδο του μεσοπολέμουEllh
 
Laerdal: Helping Save Lives
Laerdal: Helping Save LivesLaerdal: Helping Save Lives
Laerdal: Helping Save Livesjehill3
 
Cyril Jackson Powerpoint
Cyril Jackson PowerpointCyril Jackson Powerpoint
Cyril Jackson PowerpointThomas Salmon
 
Differentiated instruction presentation
Differentiated instruction presentationDifferentiated instruction presentation
Differentiated instruction presentationb l
 
Feed the Future Update April 2010
Feed the Future Update April 2010Feed the Future Update April 2010
Feed the Future Update April 2010jehill3
 
@Tim_Official: Il Customer care va su Twitter
@Tim_Official: Il Customer care va su Twitter@Tim_Official: Il Customer care va su Twitter
@Tim_Official: Il Customer care va su TwitterLUCA BARTOLINI
 
οι 3 φάκελοι
οι 3 φάκελοιοι 3 φάκελοι
οι 3 φάκελοιatanatsis
 
2009 IAITAM Conference - Stockman
2009 IAITAM Conference - Stockman2009 IAITAM Conference - Stockman
2009 IAITAM Conference - Stockmansstockman
 
Community Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB ProjectCommunity Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB Projectjehill3
 
Powers of 10
Powers of 10Powers of 10
Powers of 10Earl Cote
 
Sgp Final
Sgp FinalSgp Final
Sgp FinalAmirjon
 
English for specific_purposes
English for specific_purposesEnglish for specific_purposes
English for specific_purposesAnton
 
Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...
Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...
Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...Dottie Hodges
 
Save the Children’s Community Case Management Initiative
Save the Children’s Community Case Management InitiativeSave the Children’s Community Case Management Initiative
Save the Children’s Community Case Management Initiativejehill3
 
Value Driven Regulatory Use Case Simulation
Value Driven Regulatory Use Case Simulation Value Driven Regulatory Use Case Simulation
Value Driven Regulatory Use Case Simulation Aaron Benningfield
 
Pedagogical Potential Of Social Media
Pedagogical  Potential Of  Social MediaPedagogical  Potential Of  Social Media
Pedagogical Potential Of Social Mediapqchienac
 
Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...
Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...
Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...Hernan Sagastegui Chigne
 

Viewers also liked (20)

Workshop Damascus ANIE 2009
Workshop Damascus ANIE 2009Workshop Damascus ANIE 2009
Workshop Damascus ANIE 2009
 
евдокимова о. кухонная посуда цептер
евдокимова о. кухонная посуда цептеревдокимова о. кухонная посуда цептер
евдокимова о. кухонная посуда цептер
 
η ελληνίδα την περίοδο του μεσοπολέμου
η ελληνίδα την περίοδο του μεσοπολέμουη ελληνίδα την περίοδο του μεσοπολέμου
η ελληνίδα την περίοδο του μεσοπολέμου
 
Laerdal: Helping Save Lives
Laerdal: Helping Save LivesLaerdal: Helping Save Lives
Laerdal: Helping Save Lives
 
Cyril Jackson Powerpoint
Cyril Jackson PowerpointCyril Jackson Powerpoint
Cyril Jackson Powerpoint
 
Differentiated instruction presentation
Differentiated instruction presentationDifferentiated instruction presentation
Differentiated instruction presentation
 
Feed the Future Update April 2010
Feed the Future Update April 2010Feed the Future Update April 2010
Feed the Future Update April 2010
 
@Tim_Official: Il Customer care va su Twitter
@Tim_Official: Il Customer care va su Twitter@Tim_Official: Il Customer care va su Twitter
@Tim_Official: Il Customer care va su Twitter
 
οι 3 φάκελοι
οι 3 φάκελοιοι 3 φάκελοι
οι 3 φάκελοι
 
2009 IAITAM Conference - Stockman
2009 IAITAM Conference - Stockman2009 IAITAM Conference - Stockman
2009 IAITAM Conference - Stockman
 
Community Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB ProjectCommunity Mobilization: Indonesia MITRA TB Project
Community Mobilization: Indonesia MITRA TB Project
 
Powers of 10
Powers of 10Powers of 10
Powers of 10
 
Sgp Final
Sgp FinalSgp Final
Sgp Final
 
Greece4ever
Greece4everGreece4ever
Greece4ever
 
English for specific_purposes
English for specific_purposesEnglish for specific_purposes
English for specific_purposes
 
Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...
Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...
Architecting Your Site For Search Engine Performance: And We Ain't Talkin' Ju...
 
Save the Children’s Community Case Management Initiative
Save the Children’s Community Case Management InitiativeSave the Children’s Community Case Management Initiative
Save the Children’s Community Case Management Initiative
 
Value Driven Regulatory Use Case Simulation
Value Driven Regulatory Use Case Simulation Value Driven Regulatory Use Case Simulation
Value Driven Regulatory Use Case Simulation
 
Pedagogical Potential Of Social Media
Pedagogical  Potential Of  Social MediaPedagogical  Potential Of  Social Media
Pedagogical Potential Of Social Media
 
Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...
Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...
Informal Learning Evidence in Online Communities of Mobile Device Enthusiasts...
 

Similar to Qt quickatlinuxcollaborationsummit2010

Copy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with QtCopy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with Qtaccount inactive
 
GeoExt Foss4G 2009
GeoExt Foss4G 2009GeoExt Foss4G 2009
GeoExt Foss4G 2009Moullet
 
iPhone Development Intro
iPhone Development IntroiPhone Development Intro
iPhone Development IntroLuis Azevedo
 
用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化Shengyou Fan
 
MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsSpiffy
 
Processing presentation
Processing presentationProcessing presentation
Processing presentationrngtng
 
Introduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene GraphIntroduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene GraphICS
 
Genome Browser based on Google Maps API
Genome Browser based on Google Maps APIGenome Browser based on Google Maps API
Genome Browser based on Google Maps APIHong ChangBum
 
The Ring programming language version 1.9 book - Part 114 of 210
The Ring programming language version 1.9 book - Part 114 of 210The Ring programming language version 1.9 book - Part 114 of 210
The Ring programming language version 1.9 book - Part 114 of 210Mahmoud Samir Fayed
 
Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1NokiaAppForum
 
Using the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam HannaUsing the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam HannaCodemotion
 
Advanced Visualization with OpenGL in Oil & Gas
Advanced Visualization with OpenGL in Oil & GasAdvanced Visualization with OpenGL in Oil & Gas
Advanced Visualization with OpenGL in Oil & Gasaccount inactive
 
Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008Taha Sochi
 
Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Daker Fernandes
 
Google io bootcamp_2010
Google io bootcamp_2010Google io bootcamp_2010
Google io bootcamp_2010Chris Ramsdale
 

Similar to Qt quickatlinuxcollaborationsummit2010 (20)

The Future of Qt Widgets
The Future of Qt WidgetsThe Future of Qt Widgets
The Future of Qt Widgets
 
Copy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with QtCopy Your Favourite Nokia App with Qt
Copy Your Favourite Nokia App with Qt
 
Coding for
Coding for Coding for
Coding for
 
GeoExt Foss4G 2009
GeoExt Foss4G 2009GeoExt Foss4G 2009
GeoExt Foss4G 2009
 
Ajax-Tutorial
Ajax-TutorialAjax-Tutorial
Ajax-Tutorial
 
iPhone Development Intro
iPhone Development IntroiPhone Development Intro
iPhone Development Intro
 
用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化
 
MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome Bits
 
Processing presentation
Processing presentationProcessing presentation
Processing presentation
 
Introduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene GraphIntroduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene Graph
 
Genome Browser based on Google Maps API
Genome Browser based on Google Maps APIGenome Browser based on Google Maps API
Genome Browser based on Google Maps API
 
The Ring programming language version 1.9 book - Part 114 of 210
The Ring programming language version 1.9 book - Part 114 of 210The Ring programming language version 1.9 book - Part 114 of 210
The Ring programming language version 1.9 book - Part 114 of 210
 
Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1
 
Using the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam HannaUsing the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam Hanna
 
Advanced Visualization with OpenGL in Oil & Gas
Advanced Visualization with OpenGL in Oil & GasAdvanced Visualization with OpenGL in Oil & Gas
Advanced Visualization with OpenGL in Oil & Gas
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
Easy edd
Easy eddEasy edd
Easy edd
 
Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008Easy edd phd talks 28 oct 2008
Easy edd phd talks 28 oct 2008
 
Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13
 
Google io bootcamp_2010
Google io bootcamp_2010Google io bootcamp_2010
Google io bootcamp_2010
 

Qt quickatlinuxcollaborationsummit2010

  • 1. Rapid Application Development with Qt Quick Henrik Hartz Monday, April 26, 2010 1
  • 2. Agenda • Background • Structure of a Quick App • Hello Elements • Integrating with Native code • Hello Device • Adding New Semantics • Hello Widgets Monday, April 26, 2010 2
  • 3. Background QWidget QGraphicsView Components Controls come from Low-level API Convenience of prebuilt desktop components Controls are boxed Close to hardware C++ Controls are for Mouse Cumbersome to implement Difficult to customize fluid UI Controls are heavyweight Limited API to push UX-specific hardware capapbilities Easy to shoot yourself in the foot Monday, April 26, 2010 3
  • 4. Qt Quick App QML QtDeclarativeView Java UI JavaScriptCore Script QtDeclarative QtWebKit QtSVG QtOpenGL QtGui QtXmlPatterns QtNetwork QtXml QtScript QtSQL QtCore System Libs Monday, April 26, 2010 4
  • 5. Qt Meta-Object Language import Qt 4.7 import "content" Rectangle { color: "#545454" width: 300; height: 300 // Dial with a slider to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } Rectangle { id: container anchors.bottom: parent.bottom; anchors.bottomMargin: 10 anchors.left: parent.left; anchors.leftMargin: 20 anchors.right: parent.right; anchors.rightMargin: 20; height: 16 gradient: Gradient { GradientStop { position: 0.0; color: "gray" } GradientStop { position: 1.0; color: "white" } } radius: 8; opacity: 0.7; smooth: true Rectangle { id: slider x: 1; y: 1; width: 30; height: 14 radius: 6; smooth: true gradient: Gradient { GradientStop { position: 0.0; color: "#424242" } GradientStop { position: 1.0; color: "black" } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 6. Qt Meta-Object Language import Qt 4.7 Built-in import "content" Elements Rectangle { color: "#545454" width: 300; height: 300 // Dial with a slider to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } Rectangle { id: container anchors.bottom: parent.bottom; anchors.bottomMargin: 10 anchors.left: parent.left; anchors.leftMargin: 20 anchors.right: parent.right; anchors.rightMargin: 20; height: 16 gradient: Gradient { GradientStop { position: 0.0; color: "gray" } GradientStop { position: 1.0; color: "white" } } radius: 8; opacity: 0.7; smooth: true Rectangle { id: slider x: 1; y: 1; width: 30; height: 14 radius: 6; smooth: true gradient: Gradient { GradientStop { position: 0.0; color: "#424242" } GradientStop { position: 1.0; color: "black" } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 7. Qt Meta-Object Language import Qt 4.7 import "content" Local Elements Rectangle { color: "#545454" width: 300; height: 300 // Dial with a slider to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } Rectangle { id: container anchors.bottom: parent.bottom; anchors.bottomMargin: 10 anchors.left: parent.left; anchors.leftMargin: 20 anchors.right: parent.right; anchors.rightMargin: 20; height: 16 gradient: Gradient { GradientStop { position: 0.0; color: "gray" } GradientStop { position: 1.0; color: "white" } } radius: 8; opacity: 0.7; smooth: true Rectangle { id: slider x: 1; y: 1; width: 30; height: 14 radius: 6; smooth: true gradient: Gradient { GradientStop { position: 0.0; color: "#424242" } GradientStop { position: 1.0; color: "black" } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 8. Qt Meta-Object Language import Qt 4.7 import "content" Rectangle { Toplevel color: "#545454" Window width: 300; height: 300 // Dial with a slider to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } Rectangle { id: container anchors.bottom: parent.bottom; anchors.bottomMargin: 10 anchors.left: parent.left; anchors.leftMargin: 20 anchors.right: parent.right; anchors.rightMargin: 20; height: 16 gradient: Gradient { GradientStop { position: 0.0; color: "gray" } GradientStop { position: 1.0; color: "white" } } radius: 8; opacity: 0.7; smooth: true Rectangle { id: slider x: 1; y: 1; width: 30; height: 14 radius: 6; smooth: true gradient: Gradient { GradientStop { position: 0.0; color: "#424242" } GradientStop { position: 1.0; color: "black" } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 9. Qt Meta-Object Language import Qt 4.7 import "content" Rectangle { color: "#545454" Basic width: 300; height: 300 properties // Dial with a slider to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } Rectangle { id: container anchors.bottom: parent.bottom; anchors.bottomMargin: 10 anchors.left: parent.left; anchors.leftMargin: 20 anchors.right: parent.right; anchors.rightMargin: 20; height: 16 gradient: Gradient { GradientStop { position: 0.0; color: "gray" } GradientStop { position: 1.0; color: "white" } } radius: 8; opacity: 0.7; smooth: true Rectangle { id: slider x: 1; y: 1; width: 30; height: 14 radius: 6; smooth: true gradient: Gradient { GradientStop { position: 0.0; color: "#424242" } GradientStop { position: 1.0; color: "black" } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 10. import Qt 4.7 Qt Meta-Object Language Item { id: root property real value : 0 width: 210; height: 210 Image { source: "background.png" } import Qt 4.7 Image { import "content" x: 93 y: 35 Rectangle { source: "needle_shadow.png" color: "#545454" transform: Rotation { width: 300; height: 300 origin.x: 11; origin.y: 67 angle: needleRotation.angle // Dial with a slider }to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } } Custom Type Image { Rectangle { id: needle id: container x: 95; y: 33 anchors.bottom: parent.bottom; anchors.bottomMargin: 10 smooth: true anchors.left: parent.left; anchors.leftMargin: 20 source: "needle.png" anchors.right: parent.right; Rotation { transform: anchors.rightMargin: 20; height: 16 gradient: Gradient { id: needleRotation GradientStop { position: 0.0; color: "gray" } origin.x: 7; origin.y: 65 GradientStop { position: -130 color: "white" } angle: 1.0; } SpringFollow on angle { radius: 8; opacity: 0.7; smooth: true spring: 1.4 Rectangle { damping: .15 id: slider to: Math.min(Math.max(-130, root.value*2.6 - 130), 133) x: 1; y: 1; width: 30; height: 14 } radius: 6; smooth: true } gradient: }Gradient { GradientStop { position: 0.0; color: "#424242" } } Image { x: 21; y: 18; source: "overlay.png" GradientStop { position: 1.0; color: "black" } } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 11. import Qt 4.7 Qt Meta-Object Language Item { id: root property real value : 0 width: 210; height: 210 Image { source: "background.png" } import Qt 4.7 Image { import "content" x: 93 y: 35 Rectangle { source: "needle_shadow.png" color: "#545454" transform: Rotation { width: 300; height: 300 origin.x: 11; origin.y: 67 angle: needleRotation.angle // Dial with a slider }to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } } Image { Rectangle { id: needle id: container x: 95; y: 33 anchors.bottom: parent.bottom; anchors.bottomMargin: 10 smooth: true Anchor Lines anchors.left: parent.left; anchors.leftMargin: 20 source: "needle.png" w/Margins anchors.right: parent.right; Rotation { transform: anchors.rightMargin: 20; height: 16 gradient: Gradient { id: needleRotation GradientStop { position: 0.0; color: "gray" } origin.x: 7; origin.y: 65 GradientStop { position: -130 color: "white" } angle: 1.0; } SpringFollow on angle { radius: 8; opacity: 0.7; smooth: true spring: 1.4 Rectangle { damping: .15 id: slider to: Math.min(Math.max(-130, root.value*2.6 - 130), 133) x: 1; y: 1; width: 30; height: 14 } radius: 6; smooth: true } gradient: }Gradient { GradientStop { position: 0.0; color: "#424242" } } Image { x: 21; y: 18; source: "overlay.png" GradientStop { position: 1.0; color: "black" } } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 12. import Qt 4.7 Qt Meta-Object Language Item { id: root property real value : 0 width: 210; height: 210 Image { source: "background.png" } import Qt 4.7 Image { import "content" x: 93 y: 35 Rectangle { source: "needle_shadow.png" color: "#545454" transform: Rotation { width: 300; height: 300 origin.x: 11; origin.y: 67 angle: needleRotation.angle // Dial with a slider }to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } } Image { Rectangle { id: needle id: container x: 95; y: 33 anchors.bottom: parent.bottom; anchors.bottomMargin: 10 smooth: true anchors.left: parent.left; anchors.leftMargin: 20 source: "needle.png" anchors.right: parent.right; Rotation { transform: anchors.rightMargin: 20; height: 16 gradient: Gradient { id: needleRotation GradientStop { position: 0.0; color: "gray" } origin.x: 7; origin.y: 65 GradientStop { position: -130 color: "white" } angle: 1.0; } SpringFollow on angle { radius: 8; opacity: 0.7; smooth: true spring: 1.4 Rectangle { damping: .15 id: slider to: Math.min(Math.max(-130, root.value*2.6 - 130), 133) x: 1; y: 1; width: 30; height: 14 } radius: 6; smooth: true } gradient: }Gradient { GradientStop { position: 0.0; color: "#424242" } } Image { x: 21; y: 18; source: "overlay.png" GradientStop { position: 1.0; color: "black" } } } MouseArea { Mouse anchors.fill: parent Interaction area } drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } Monday, April 26, 2010 5
  • 13. import Qt 4.7 Qt Meta-Object Language Item { id: root property real value : 0 width: 210; height: 210 Image { source: "background.png" } import Qt 4.7 Image { import "content" x: 93 y: 35 Rectangle { source: "needle_shadow.png" color: "#545454" transform: Rotation { width: 300; height: 300 origin.x: 11; origin.y: 67 angle: needleRotation.angle // Dial with a slider }to adjust it Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } } Image { Rectangle { id: needle id: container x: 95; y: 33 anchors.bottom: parent.bottom; anchors.bottomMargin: 10 smooth: true anchors.left: parent.left; anchors.leftMargin: 20 source: "needle.png" anchors.right: parent.right; Rotation { transform: anchors.rightMargin: 20; height: 16 gradient: Gradient { id: needleRotation GradientStop { position: 0.0; color: "gray" } origin.x: 7; origin.y: 65 GradientStop { position: -130 color: "white" } angle: 1.0; } SpringFollow on angle { radius: 8; opacity: 0.7; smooth: true spring: 1.4 Rectangle { damping: .15 id: slider to: Math.min(Math.max(-130, root.value*2.6 - 130), 133) x: 1; y: 1; width: 30; height: 14 } radius: 6; smooth: true } gradient: }Gradient { GradientStop { position: 0.0; color: "#424242" } } Image { x: 21; y: 18; source: "overlay.png" GradientStop { position: 1.0; color: "black" } } } MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 } } } } Monday, April 26, 2010 5
  • 14. Code Walkthrough • (MeeGo?) RSS viewer • Written in-flight; ~4 hrs • Single window, 2 lists • Graphics borrowed Monday, April 26, 2010 6
  • 15. Hello Elements • Item, Rectangle • MouseArea, LineEdit • Model,View • BorderImage, Gradient, Rotation Monday, April 26, 2010 7
  • 16. What’s Quick about it? • Simplicity of language and intuitive structure • Created with Designers in mind • Easy to pick up • Good separation between code and presentation • Designers and developers in same environment • Common understanding of semantics • Design around same constraints • Hardware accelerated • Openl GL (ES), OpenVG Monday, April 26, 2010 8
  • 17. States and Transitions • State represents a configuration of properties for some items • PropertyChanges, ParentChange, AnchorChanges • Transitions define interpolation between two states • PropertyAnimation, SequentialAnimation/ ParallelAnimation, PauseAnimation Monday, April 26, 2010 9
  • 18. Integrating with Native Code • QtDeclarative == Qt, native C++ • QGraphicsView runtime environment populated by QDeclarativeEngine::load() • All QMetaObject information exposed • Signals, Slots, Properties ➡Easy to bind to native business logic Monday, April 26, 2010 10
  • 19. Hello Device • QML UI ‘runtime’ identical on Desktop and Device • Device-specific features can be guarded and added in executable • Device-specific packaging apply • Lets do it.. Monday, April 26, 2010 11
  • 20. Adding New Semantics • Any QGraphicsItem can be exposed #define QML_DECLARE_TYPE(T) int qmlRegisterType ( const char * uri, int versionMajor, int versionMinor, const char * qmlName ) • Must subclass QObject, default-constructor • Properties can be bound to if NOTIFY is present Monday, April 26, 2010 12
  • 21. Hello Widgets http://qt.gitorious.org/qt-components Monday, April 26, 2010 13
  • 22. Roadmap ✓ Emulate MeeGo Netbook UX with Qt (QML) • WIP components to enable easy app creation, starting with embedded/mobile space • MeeGo handset-optimized • ...but will work on others too • Enable bindings of other UX (QGraphicsView-based) to QML • Working on controller API for UI • i.e. models pluggable to multiple UX • http://qt.gitorious.org/qt-components Monday, April 26, 2010 14
  • 23. Where, What, How? • http://qt.nokia.com/developer/qt-roadmap • http://qt.nokia.com/doc/4.7-snapshot/declarativeui.html • 4.7 branch of git://gitorious.org/qt/qt.git • http://labs.trolltech.com/blogs/category/labs/graphics/ kinetic/declarative_ui/ • http://twitter.com/#search?q=QML • http://chaos.troll.no/~hhartz/ QtQuickAtLinuxCollaborationSummit2010.pdf • #qt-qml on irc.freenode.org Monday, April 26, 2010 15