SlideShare a Scribd company logo
A Desktop UI with QtQuick
        How QtQuick encouraged us to totally rethink a Desktop
                          User Interface




                                                                 1

Freitag, 25. November 2011
my Qt mileage


          Nils Jeisecke
          saltation GmbH & Co. KG / Bielefeld / Germany
          http://www.saltation.de


          Qt developer > 10 years (since Qt 2)




                                                          2

Freitag, 25. November 2011
The Use Case       Computer Telephony Integration


          The Use Case is called „TK-Suite Client“, a CTI and PIM
          application for a PBX.
                                     Personal Information Management

       Business telephone system

          That Application went through nearly all Qt iterations:
     • Qt 2 used for prototype
     • Qt 3 used for 1.0, 2.0, 3.0 and the !rst Mac Version
     • Qt 4 used for 4.x 1st (!rst rewrite)




                                                                        3

Freitag, 25. November 2011
Evolution of TK-Suite Client
          Version 1 and 2




                                                   4

Freitag, 25. November 2011
Evolution of TK-Suite Client
          Version 3




                                                   5

Freitag, 25. November 2011
Evolution of TK-Suite Client
          Version 4




                                                   6

Freitag, 25. November 2011
Highlighting some UI problems


          * Live Demo of Version 4 *




                                                    7

Freitag, 25. November 2011
Building a UI with Qt Widgets
          What does a Qt programmer do if he must implement a
          UI?


     1. I look for the widget that is the nearest match for the
        requirements
     2. I tune the widget by
         • doing some CSS styling
         • subclassing and changing behavior
         • writing a custom delegate for item views
     3. If that’s not possible, I’ll write a widget from scratch


                                                                   8

Freitag, 25. November 2011
A customized TreeView


                                In order to navigate through contacts and
                                 numbers, we use an expanded tree view




                             A custom delegate will draw a
                                   special selection




                             But a customized QTreeView is still a
                             QTreeView and will always be.


                                                                            9

Freitag, 25. November 2011
A Problem with Toolbars




                                       This is a long distance!
                                     There’s no visual connection.




                                                                     10

Freitag, 25. November 2011
The Problems with Popups


                         That’s 0x0c (12) entries!




                    1

                    2
                                              We repeat the item Text

                    3


                    4

                    5
                    6


                    7
                    8

                    9

                    a


                    b
                    c


                    1



                                     +1 completely unrelated to the item



                                                                           11

Freitag, 25. November 2011
Using QMainWindow as a Dashboard

                                                             Everything is arranged around a
          Screen 1    2      3   4     5    6                 central widget that defines the
                                                            “main” functionality of each screen




                                     Resizing a Dockwidget influences
                                             other dockwidgets




                                                                                                  12

Freitag, 25. November 2011
Resizing a QMainWindow




                                            sm
                                              al
                                                  le
                                                    r


                                                           ol
                                                              d
                                                             si
                      Oh no! My lovely arranged Favorite
                                                                  ze
                         Views are totally messed up!




                                                                       13

Freitag, 25. November 2011
I have a certain feeling that we
                             need to do something about
                             this!




                                                                14

Freitag, 25. November 2011
So this is what our interface designer had in mind...




                                                                  15

Freitag, 25. November 2011
...and this was our programmer’s reaction:




                                 If I will have to code this with
                                 QWidgets and CSS styling
                                 I’m going to shoot myself.




                                                                    16

Freitag, 25. November 2011
Short Break for a commercial




                                                   17

Freitag, 25. November 2011
Whatever the future of Qt on mobile
                         phones will be...

                             Nokia gave us a precious gift:




                                                              18

Freitag, 25. November 2011
...so this is what we have built using QtQuick:




                                                            19

Freitag, 25. November 2011
* Live Demo of Version 5 *




                                       20

Freitag, 25. November 2011
A User Interface with Qml




                             This is a ListView with a delegate




                                                                  21

Freitag, 25. November 2011
A Contact Delegate
                                                 Column {
                                                   id: data
                                                   anchors.left: parent.left
                                                   anchors.leftMargin: 30
                                                   anchors.right: parent.right
                                                   spacing: 4
                                                   clip: true

                                                     Text {
                                                       visible: text.length > 0
                                                       width: data.width
                                                       color: "#efefef"
                                                       text: model.displayName
                      Not that exiting:
                                                       elide: Text.ElideMiddle
                                                       font.bold: true
              This could easily be done within
                                                       font.pixelSize: 14
                   QItemDelegate::paint
                                                     }
                                                     Text {
                                                       width: data.width
                                                       text: model.company
                                                       color: "#a7a07a"
                                                       font.pixelSize: model.displayName.length === 0 ? 14 : 10
                                                       elide: Text.ElideMiddle
                                                     }

                                                     Image { source: "images/contact_separator.png" }
                                                 }




                                                                                                        22

Freitag, 25. November 2011
Qml Delegates have a state
                                                       CtiExtensionStateProvider {
                                                         id: contactExtensionState
                                                         contactId: model.objectId
                                                       }

                                                       Rectangle {
                                                         anchors.fill: extensionNo
                                                         anchors.margins: -2
                                                         color: contactExtensionState.stateColor
         Now it’s getting more interesting:              opacity: 0.7
                                                         visible: contactExtensionState.extensionId != ""
     This is a custom C++ QObject based class          }
         that is created from within Qml and           Text {
              implements business logic.                 id: extensionNo
                                                         anchors.verticalCenter: parent.verticalCenter
                                                         x: 6
                                                         color: "white"
                                                         text: contactExtensionState.extensionNo
                                                       }
         In this case we display the status of a PBX
          extension (that’s a telephone) by binding
                  to properties of that object.




                             I need no longer put logic in a
                             model where it does not belong to.
                                                                                                            23

Freitag, 25. November 2011
Putting actions in context

                                                         ActionMenu {
                                                           id: actionMenu
                                                           anchors.right: parent.right
                                                           anchors.verticalCenter: parent.verticalCenter
                                                         }




           The ActionMenu item extends a Qml
                        ListView




                                                  This is the ActionMenu’s delegate




                                          So you can really have delegates in
                                          ListViews in delegates! How cool is
                                          that. And actually useful!
                                                                                                 24

Freitag, 25. November 2011
Qml based Dashboard



                                                                              #2
                                                                              #3
                               Repeater {

                                   model: QsltDashboardModel {
                                     id: dashboardModel
                                     canvasRect: Qt.rect(root.x, root.y, root.width, isMaximized ? maximizedSize : 10000)
                                     spacing: 10

                           #1      }

                                   delegate: DashboardDelegate {}
                               }


                                                                              #4
                                                                       This is the C++ model that cares
                                                                                 about the layout
 All these delegates are created by a
          Qml Repeater item



                                           This delegate implements all the
                                          animation and manages the content
                                                                                                                   25

Freitag, 25. November 2011
DashboardDelegate caption




     Rectangle {
       id: captionRect
       color: captionColor
       width: parent.width
       height: 28
       radius: 10

        Row {
          id: captionButtons
          anchors.verticalCenter: parent.verticalCenter
          anchors.right: parent.right
          DashboardCaptionButton {
            imageSource: trashIcon; visible: __settingsItem !== null; onClicked: { removeItem() } }
          DashboardCaptionButton {
            imageSource: showSettingsIcon; visible: __settingsItem === null; onClicked: { toggleSettings() } }
          DashboardCaptionButton {
            imageSource: hideSettingsIcon; visible: __settingsItem !== null; onClicked: { toggleSettings() } }
          DashboardCaptionButton {
            imageSource: maximizeIcon; onClicked: { toggleMaximize() } }
        }
     }
     Text { /* ... */ }

                                                                                                                 26

Freitag, 25. November 2011
Moving a DashboardDelegate around




         MouseArea {
           id: dragArea
           anchors.fill: captionRect

             onPressed: root.dragging = true

             onPositionChanged: {
               if (root.dragging) {
                 var p = mapToItem(root, mouse.x, mouse.y)
                 dashboardModel.moveTo(model.index, Qt.point(p.x, p.y))
               }
             }
         }



                                               We let our C++ model do all the hard work
                                                        of recalculating the layout.




                                                                                           27

Freitag, 25. November 2011
DashboardDelegate content




     Loader {
       id: content
       anchors.left: parent.left
       anchors.right: parent.right
       anchors.top: settingsContainer.bottom
       anchors.bottom: parent.bottom
       source: model.componentPath // the model will tell us which Qml file implements the DashboardItem
       opacity: dragArea.pressed && dragArea.pressedButton == Qt.LeftButton ? 0.3 : 1

         Behavior on opacity { NumberAnimation { duration: 200 } }

         /* ... */
     }
                                             I’m going to watch TV
                                             now.


                                                                                                           28

Freitag, 25. November 2011
Wireframing



          If time permits: Demo the Workspace Wireframe




                                                          29

Freitag, 25. November 2011
Best Practices with QtQuick
     • Use the power of Qt and C++ to implement
           – Business logic
           – Data models
           – Network communication
     • Use QObject and QAbstractItemModel to interface
       between C++ and Qml
     • Limit the use of Qml to implement
           – Data presentation
           – User Interaction
     • Don‘t forget to contact a Designer



                                                         30

Freitag, 25. November 2011
Thanks to QtQuick we can !nally
            develop state of the art cross platform
            User Interfaces.

            Thank your very much for your
            Attention and have fun at Qt
            DevDays 2011!
                                                      31

Freitag, 25. November 2011
Session Feedback
                    Session Feedback


                              Remember to send your session feedback
                              via the Qt Developer Days App.




                              Get the app by
                              -  Tapping one of the NFC tags on the event !oor
                              -  Downloading the ”Qt Developer Days” app from Nokia Store
                              -  Downloading it from qt.nokia.com/qtdevdays2011
                              -  Visiting m.qtdevdays2011.qt.nokia.com to use web version




                                                                                            32

Freitag, 25. November 2011

More Related Content

PPTX
Оптимизация высоконагруженных ASP.NET приложений, работающих с MS SQL Server ...
PDF
Future of user interface design
PPT
The Future Of User Interface
PDF
WPF - the future of GUI is near
PPTX
Intro to Facebook Presentation – Facebook, How to Get Started Safely
PPTX
Новые возможности поиска в SharePoint 2013
PDF
The Future of User Interfaces
PPTX
Facebook Powerpoint
Оптимизация высоконагруженных ASP.NET приложений, работающих с MS SQL Server ...
Future of user interface design
The Future Of User Interface
WPF - the future of GUI is near
Intro to Facebook Presentation – Facebook, How to Get Started Safely
Новые возможности поиска в SharePoint 2013
The Future of User Interfaces
Facebook Powerpoint

Similar to A Desktop UI with QtQuick (20)

PDF
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
PDF
How to-catch-a-chameleon-steven seeley-ruxcon-2012
PDF
Conquistando el Servidor con Node.JS
PDF
Caridy patino - node-js
PDF
JavaSE - The road forward
PDF
PPT
TWS zcentric Proof of Technology (from 2013 European Tour)
PDF
Responsive design @ bbc.co.uk
PDF
Node at artsy
PDF
Catch the 1% in iterative design (OSIDays 11)
PDF
rails_tutorial
PDF
rails_tutorial
PPTX
Gastcollege Silverlight KAHO SL 2011
PDF
Froscon2011: How i learned to use sql and then learned not to use it
PDF
And suddenly I see ... IDC IT Security Brussels 2011
PDF
Behavior Driven Development and Wordpress Plugins
PDF
Keeping Movies Running Amid Thunderstorms!
PDF
Symfony and eZ Publish
PDF
Experience in Corporate Training in Virtual Worlds
PDF
Big app design for Node.js
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
How to-catch-a-chameleon-steven seeley-ruxcon-2012
Conquistando el Servidor con Node.JS
Caridy patino - node-js
JavaSE - The road forward
TWS zcentric Proof of Technology (from 2013 European Tour)
Responsive design @ bbc.co.uk
Node at artsy
Catch the 1% in iterative design (OSIDays 11)
rails_tutorial
rails_tutorial
Gastcollege Silverlight KAHO SL 2011
Froscon2011: How i learned to use sql and then learned not to use it
And suddenly I see ... IDC IT Security Brussels 2011
Behavior Driven Development and Wordpress Plugins
Keeping Movies Running Amid Thunderstorms!
Symfony and eZ Publish
Experience in Corporate Training in Virtual Worlds
Big app design for Node.js
Ad

Recently uploaded (20)

PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Tartificialntelligence_presentation.pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
Five Habits of High-Impact Board Members
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
STKI Israel Market Study 2025 version august
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PPT
Geologic Time for studying geology for geologist
PPTX
Modernising the Digital Integration Hub
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
DOCX
search engine optimization ppt fir known well about this
Hindi spoken digit analysis for native and non-native speakers
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Tartificialntelligence_presentation.pptx
Final SEM Unit 1 for mit wpu at pune .pptx
O2C Customer Invoices to Receipt V15A.pptx
Five Habits of High-Impact Board Members
Getting started with AI Agents and Multi-Agent Systems
Developing a website for English-speaking practice to English as a foreign la...
STKI Israel Market Study 2025 version august
observCloud-Native Containerability and monitoring.pptx
A review of recent deep learning applications in wood surface defect identifi...
NewMind AI Weekly Chronicles – August ’25 Week III
DP Operators-handbook-extract for the Mautical Institute
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Web Crawler for Trend Tracking Gen Z Insights.pptx
Geologic Time for studying geology for geologist
Modernising the Digital Integration Hub
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
search engine optimization ppt fir known well about this
Ad

A Desktop UI with QtQuick

  • 1. A Desktop UI with QtQuick How QtQuick encouraged us to totally rethink a Desktop User Interface 1 Freitag, 25. November 2011
  • 2. my Qt mileage Nils Jeisecke saltation GmbH & Co. KG / Bielefeld / Germany http://www.saltation.de Qt developer > 10 years (since Qt 2) 2 Freitag, 25. November 2011
  • 3. The Use Case Computer Telephony Integration The Use Case is called „TK-Suite Client“, a CTI and PIM application for a PBX. Personal Information Management Business telephone system That Application went through nearly all Qt iterations: • Qt 2 used for prototype • Qt 3 used for 1.0, 2.0, 3.0 and the !rst Mac Version • Qt 4 used for 4.x 1st (!rst rewrite) 3 Freitag, 25. November 2011
  • 4. Evolution of TK-Suite Client Version 1 and 2 4 Freitag, 25. November 2011
  • 5. Evolution of TK-Suite Client Version 3 5 Freitag, 25. November 2011
  • 6. Evolution of TK-Suite Client Version 4 6 Freitag, 25. November 2011
  • 7. Highlighting some UI problems * Live Demo of Version 4 * 7 Freitag, 25. November 2011
  • 8. Building a UI with Qt Widgets What does a Qt programmer do if he must implement a UI? 1. I look for the widget that is the nearest match for the requirements 2. I tune the widget by • doing some CSS styling • subclassing and changing behavior • writing a custom delegate for item views 3. If that’s not possible, I’ll write a widget from scratch 8 Freitag, 25. November 2011
  • 9. A customized TreeView In order to navigate through contacts and numbers, we use an expanded tree view A custom delegate will draw a special selection But a customized QTreeView is still a QTreeView and will always be. 9 Freitag, 25. November 2011
  • 10. A Problem with Toolbars This is a long distance! There’s no visual connection. 10 Freitag, 25. November 2011
  • 11. The Problems with Popups That’s 0x0c (12) entries! 1 2 We repeat the item Text 3 4 5 6 7 8 9 a b c 1 +1 completely unrelated to the item 11 Freitag, 25. November 2011
  • 12. Using QMainWindow as a Dashboard Everything is arranged around a Screen 1 2 3 4 5 6 central widget that defines the “main” functionality of each screen Resizing a Dockwidget influences other dockwidgets 12 Freitag, 25. November 2011
  • 13. Resizing a QMainWindow sm al le r ol d si Oh no! My lovely arranged Favorite ze Views are totally messed up! 13 Freitag, 25. November 2011
  • 14. I have a certain feeling that we need to do something about this! 14 Freitag, 25. November 2011
  • 15. So this is what our interface designer had in mind... 15 Freitag, 25. November 2011
  • 16. ...and this was our programmer’s reaction: If I will have to code this with QWidgets and CSS styling I’m going to shoot myself. 16 Freitag, 25. November 2011
  • 17. Short Break for a commercial 17 Freitag, 25. November 2011
  • 18. Whatever the future of Qt on mobile phones will be... Nokia gave us a precious gift: 18 Freitag, 25. November 2011
  • 19. ...so this is what we have built using QtQuick: 19 Freitag, 25. November 2011
  • 20. * Live Demo of Version 5 * 20 Freitag, 25. November 2011
  • 21. A User Interface with Qml This is a ListView with a delegate 21 Freitag, 25. November 2011
  • 22. A Contact Delegate Column { id: data anchors.left: parent.left anchors.leftMargin: 30 anchors.right: parent.right spacing: 4 clip: true Text { visible: text.length > 0 width: data.width color: "#efefef" text: model.displayName Not that exiting: elide: Text.ElideMiddle font.bold: true This could easily be done within font.pixelSize: 14 QItemDelegate::paint } Text { width: data.width text: model.company color: "#a7a07a" font.pixelSize: model.displayName.length === 0 ? 14 : 10 elide: Text.ElideMiddle } Image { source: "images/contact_separator.png" } } 22 Freitag, 25. November 2011
  • 23. Qml Delegates have a state CtiExtensionStateProvider { id: contactExtensionState contactId: model.objectId } Rectangle { anchors.fill: extensionNo anchors.margins: -2 color: contactExtensionState.stateColor Now it’s getting more interesting: opacity: 0.7 visible: contactExtensionState.extensionId != "" This is a custom C++ QObject based class } that is created from within Qml and Text { implements business logic. id: extensionNo anchors.verticalCenter: parent.verticalCenter x: 6 color: "white" text: contactExtensionState.extensionNo } In this case we display the status of a PBX extension (that’s a telephone) by binding to properties of that object. I need no longer put logic in a model where it does not belong to. 23 Freitag, 25. November 2011
  • 24. Putting actions in context ActionMenu { id: actionMenu anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } The ActionMenu item extends a Qml ListView This is the ActionMenu’s delegate So you can really have delegates in ListViews in delegates! How cool is that. And actually useful! 24 Freitag, 25. November 2011
  • 25. Qml based Dashboard #2 #3 Repeater { model: QsltDashboardModel { id: dashboardModel canvasRect: Qt.rect(root.x, root.y, root.width, isMaximized ? maximizedSize : 10000) spacing: 10 #1 } delegate: DashboardDelegate {} } #4 This is the C++ model that cares about the layout All these delegates are created by a Qml Repeater item This delegate implements all the animation and manages the content 25 Freitag, 25. November 2011
  • 26. DashboardDelegate caption Rectangle { id: captionRect color: captionColor width: parent.width height: 28 radius: 10 Row { id: captionButtons anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right DashboardCaptionButton { imageSource: trashIcon; visible: __settingsItem !== null; onClicked: { removeItem() } } DashboardCaptionButton { imageSource: showSettingsIcon; visible: __settingsItem === null; onClicked: { toggleSettings() } } DashboardCaptionButton { imageSource: hideSettingsIcon; visible: __settingsItem !== null; onClicked: { toggleSettings() } } DashboardCaptionButton { imageSource: maximizeIcon; onClicked: { toggleMaximize() } } } } Text { /* ... */ } 26 Freitag, 25. November 2011
  • 27. Moving a DashboardDelegate around MouseArea { id: dragArea anchors.fill: captionRect onPressed: root.dragging = true onPositionChanged: { if (root.dragging) { var p = mapToItem(root, mouse.x, mouse.y) dashboardModel.moveTo(model.index, Qt.point(p.x, p.y)) } } } We let our C++ model do all the hard work of recalculating the layout. 27 Freitag, 25. November 2011
  • 28. DashboardDelegate content Loader { id: content anchors.left: parent.left anchors.right: parent.right anchors.top: settingsContainer.bottom anchors.bottom: parent.bottom source: model.componentPath // the model will tell us which Qml file implements the DashboardItem opacity: dragArea.pressed && dragArea.pressedButton == Qt.LeftButton ? 0.3 : 1 Behavior on opacity { NumberAnimation { duration: 200 } } /* ... */ } I’m going to watch TV now. 28 Freitag, 25. November 2011
  • 29. Wireframing If time permits: Demo the Workspace Wireframe 29 Freitag, 25. November 2011
  • 30. Best Practices with QtQuick • Use the power of Qt and C++ to implement – Business logic – Data models – Network communication • Use QObject and QAbstractItemModel to interface between C++ and Qml • Limit the use of Qml to implement – Data presentation – User Interaction • Don‘t forget to contact a Designer 30 Freitag, 25. November 2011
  • 31. Thanks to QtQuick we can !nally develop state of the art cross platform User Interfaces. Thank your very much for your Attention and have fun at Qt DevDays 2011! 31 Freitag, 25. November 2011
  • 32. Session Feedback Session Feedback Remember to send your session feedback via the Qt Developer Days App. Get the app by -  Tapping one of the NFC tags on the event !oor -  Downloading the ”Qt Developer Days” app from Nokia Store -  Downloading it from qt.nokia.com/qtdevdays2011 -  Visiting m.qtdevdays2011.qt.nokia.com to use web version 32 Freitag, 25. November 2011