SlideShare a Scribd company logo
1 of 27
Download to read offline
© Integrated Computer Solutions, Inc. All Rights Reserved
Webinar: QML by Design
Mark Decker, Senior Qt Engineer
Integrated Computer Solutions
www.ics.com
Copyright 2017, Integrated Computers Solutions, Inc.
This work may not be reproduced in whole or in part without the express written consent of Integrated
Computer Solutions, Inc. Material based on Qt 5.9.1, last updated July 2017
1
© Integrated Computer Solutions, Inc. All Rights Reserved
Introduction
2
Introduction
Mark Decker
● Senior Qt Engineer at ICS
● Software Engineer for many years
● Worked closely with artists at Dreamworks Animation
for 13 years
● Developed multiple commercial products using QML
© Integrated Computer Solutions, Inc. All Rights Reserved
Why This Class?
QML was created, in part, to be accessible to artists
● But nobody was teaching it that way!
● In 2016 ICS was asked to develop a class
○ Design it from the ground up for artists
○ Don’t assume any programming knowledge
● I spent 4 months developing it
○ Approach material visually
○ Taught it 3 times, refining it each time
● Result was a 3 day class
○ What you see today is the very first part
3
Introduction
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt and QML
Qt
● Cross platform framework for programmers
○ Desktops: Mac, Windows, Linux
○ Mobile: iOS, Android
○ Various embedded devices
● Created in the 90s, and widely used
● C++
QML (Qt Meta Language)
● Declarative layer on top of C++
● Created in 2010
4
Introduction
© Integrated Computer Solutions, Inc. All Rights Reserved
How Does QML Fit In?
5
QML
C++
Touch Display
Signals Data
Underlying System
Data
© Integrated Computer Solutions, Inc. All Rights Reserved
What is QML?
● A declarative language for UI
● An effective tool for prototyping modern,
responsive UI
● A means to a clean separation between UI and
business logic
● What it’s not:
○ Efficient for an entire program
○ A good place to store data
6
Introduction
© Integrated Computer Solutions, Inc. All Rights Reserved
● More effective communications between
designers & programmers
● Common terms and concepts
● Reduce need for documentation
● Easier design revisions
● Better understanding of QML capabilities
● Rapid prototypes
Goals of Teaching QML
to Designers
7
Introduction
© Integrated Computer Solutions, Inc. All Rights Reserved
Designer’s Role in writing QML
● Everything you already do
○ Make it beautiful
○ Make it easy to use
● Break down the layout
● Create Components to populate it
● Provide sample data
● Design for ease of modification
● UX prototyping
8
Introduction
© Integrated Computer Solutions, Inc. All Rights Reserved
Qt Creator - New Project
● Click + New Project
● Select Other Project, then Qt Quick UI, click Choose..
● Name the project QMLclass
○ Choose a directory to store the project dir
○ Click Next
● Choose the most recent Qt Version
○ Do NOT check With ui.qml file
○ Click Next
● Click Finish
● Click Green triangle to run
9
Introduction
© Integrated Computer Solutions, Inc. All Rights Reserved
Simplest QML Program
Rectangles
10
● Start even simpler.
○ Delete all text except for the import line
○ Type the following:
Rectangle {
width: 500
height: 400
}
● This is the simplest QML program possible
● Set color:
color: "gray"
© Integrated Computer Solutions, Inc. All Rights Reserved
Rectangle
● Rectangle, basic visual unit
○ This outermost one also doubles as our window
● Create a new Rectangle inside the first
Rectangle {
width: 200
height: 100
color: "red"
}
● Because it is inside, the new Rectangle is a child of
the first
● Add another Rectangle colored blue
11
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
Rectangle
● Objects drawn last appear on top
● Position by using x: y: properties
● All positions are relative to parent
● Children can draw outside parent
○ clip: true to prevent that
○ Clipping is expensive, so don’t use it unless you
really need it
● Add a yellow rectangle inside the red one.
12
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
QML Coordinate System
13
© Integrated Computer Solutions, Inc. All Rights Reserved
● Draw outline with border
○ Width of border is inside the rectangle
border.width: 4
border.color: "black"
● Rounded corners
○ Set radius: 10
○ Makes a circle if radius equals half the width
14
Rectangles
Rectangle
© Integrated Computer Solutions, Inc. All Rights Reserved
Color Constants
● Always quoted, unlike CSS
● SVG color names:
http://www.december.com/html/spec/colorsvg.html
● Possible values for hexadecimal include:
○ #rgb
○ #rrggbb
○ #aarrggbb - alpha comes first
15
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
Basic QML Object Structure
● Every QML object has the same basic structure
QMLType {
}
● It begins with the object type
○ Types always begin with a capital letter
● Followed by open and close curly braces
16
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
QML Object Contents
● Inside the curly braces, there can be properties and/or
nested child objects
Rectangle {
width: 300
color: "gray"
Rectangle {
}
}
● The order of properties does not matter
● The order of child objects determines overlap
○ 1st object painted first
○ 2nd object painted on top of it
17
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
QML File Structure
● QML files also have a consistent structure
import QtQuick 2.8
Rectangle {
width: 300
color: "gray"
}
● All begin by importing a version of QtQuick
○ Contains definitions of the basic QML objects
● Followed by exactly one QML object
○ All other objects must be nested inside that
outermost root object as children of it
18
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
Creating a QML File
● In the Projects list, Right click your project name
(QMLclass) and choose Add New…
● Select Qt from the list on the left
● Select QML File (Qt Quick 2) from the list on the right
● Click Choose
● Name the file (call this one GreenSquare)
○ Must begin with a capital letter
● Click Next button, then Finish button on the next page.
● It creates the file, adds it to the project, adds the
import and opens it for editing.
19
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
Creating a Component File
● Every QML file in the project with a capitalized name
is automatically available as a component.
● Replace the Item and its curly braces with this:
Rectangle {
width: 100
height: width
color: "green"
}
● Save the file.
20
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
Using a Component
● From the Open Documents list, click QMLclass to go
back to your main file.
● At the end of the file, just before the final closing curly
brace, add this:
GreenSquare {}
● Can Override properties
○ Change it’s width: 300
● Add another GreenSquare with x: 200
21
Rectangles
© Integrated Computer Solutions, Inc. All Rights Reserved
Image
Images and Text
Use Image item to load pictures
Image {
width: 300
height: 200
source: "images/icon_close.svg"
}
● Path to image file source:
● Size isn’t necessary
● sourceSize.width: width fixes .svg resolution
22
© Integrated Computer Solutions, Inc. All Rights Reserved
Image
● fillMode can be used to fill the size of a parent
○ Image.PreserveAspectFit
○ Image.PreserveAspectCrop
○ fillMode changes the scale
● Use rotation to rotate image
23
Images and Text
© Integrated Computer Solutions, Inc. All Rights Reserved
Image
● Supported Formats
○ .png - Best
○ .jpg - No support for transparency
○ .svg - Resolution independent
24
Images and Text
© Integrated Computer Solutions, Inc. All Rights Reserved
Text
● Use the Text item to display text of any size
Text {
text: "Hi!"
color: "white"
}
● Change font properties
font {
pixelSize: 40
family: "Times New Roman"
bold: true
}
25
Images and Text
© Integrated Computer Solutions, Inc. All Rights Reserved
Text Alignment
● Like everything else, text defaults to top left of parent
● horizontalAlignment: Text.AlignHCenter
Text.AlignLeft, Text.AlignRight
● verticalAlignment: Text.AlignVCenter
Text.AlignTop, Text.AlignBottom
26
Images and Text
© Integrated Computer Solutions, Inc. All Rights Reserved 27
QML by Design
September 13 - 15
Sunnyvale, CA
https://www.ics.com/learning/training/qml-design-sept

More Related Content

More from ICS

Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up ICS
 
Cybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdfCybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdfICS
 
MDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical DevicesMDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical DevicesICS
 
How to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management SolutionHow to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management SolutionICS
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsICS
 
IoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with AzureIoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with AzureICS
 
Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt UsersICS
 
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...ICS
 
Qt Installer Framework
Qt Installer FrameworkQt Installer Framework
Qt Installer FrameworkICS
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsICS
 
Overcome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case StudyOvercome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case StudyICS
 
User Experience Design for IoT
User Experience Design for IoTUser Experience Design for IoT
User Experience Design for IoTICS
 
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdfSoftware Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdfICS
 
5 Key Considerations at the Start of SaMD Development
5 Key Considerations at the Start of SaMD Development5 Key Considerations at the Start of SaMD Development
5 Key Considerations at the Start of SaMD DevelopmentICS
 
An In-Depth Look Into Microcontrollers
An In-Depth Look Into MicrocontrollersAn In-Depth Look Into Microcontrollers
An In-Depth Look Into MicrocontrollersICS
 
Introduction to the Qt State Machine Framework using Qt 6
Introduction to the Qt State Machine Framework using Qt 6Introduction to the Qt State Machine Framework using Qt 6
Introduction to the Qt State Machine Framework using Qt 6ICS
 
Leveraging Open Standards to Build Highly Extensible Autonomous Systems
Leveraging Open Standards to Build Highly Extensible Autonomous SystemsLeveraging Open Standards to Build Highly Extensible Autonomous Systems
Leveraging Open Standards to Build Highly Extensible Autonomous SystemsICS
 
Creating Advanced GUIs for Low-power MCUs with Qt
Creating Advanced GUIs for Low-power MCUs with QtCreating Advanced GUIs for Low-power MCUs with Qt
Creating Advanced GUIs for Low-power MCUs with QtICS
 
Safeguard Your Medical Devices from Cyber Threats
Safeguard Your Medical Devices from Cyber ThreatsSafeguard Your Medical Devices from Cyber Threats
Safeguard Your Medical Devices from Cyber ThreatsICS
 
Improving User Experience with Ubiquitous QuickBoot
 Improving User Experience with Ubiquitous QuickBoot Improving User Experience with Ubiquitous QuickBoot
Improving User Experience with Ubiquitous QuickBootICS
 

More from ICS (20)

Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up Secure Your Medical Devices From the Ground Up
Secure Your Medical Devices From the Ground Up
 
Cybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdfCybersecurity and Software Updates in Medical Devices.pdf
Cybersecurity and Software Updates in Medical Devices.pdf
 
MDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical DevicesMDG Panel - Creating Expert Level GUIs for Complex Medical Devices
MDG Panel - Creating Expert Level GUIs for Complex Medical Devices
 
How to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management SolutionHow to Craft a Winning IOT Device Management Solution
How to Craft a Winning IOT Device Management Solution
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory Teams
 
IoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with AzureIoT Device Fleet Management: Create a Robust Solution with Azure
IoT Device Fleet Management: Create a Robust Solution with Azure
 
Basic Cmake for Qt Users
Basic Cmake for Qt UsersBasic Cmake for Qt Users
Basic Cmake for Qt Users
 
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
 
Qt Installer Framework
Qt Installer FrameworkQt Installer Framework
Qt Installer Framework
 
Bridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory TeamsBridging the Gap Between Development and Regulatory Teams
Bridging the Gap Between Development and Regulatory Teams
 
Overcome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case StudyOvercome Hardware And Software Challenges - Medical Device Case Study
Overcome Hardware And Software Challenges - Medical Device Case Study
 
User Experience Design for IoT
User Experience Design for IoTUser Experience Design for IoT
User Experience Design for IoT
 
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdfSoftware Bill of Materials - Accelerating Your Secure Embedded Development.pdf
Software Bill of Materials - Accelerating Your Secure Embedded Development.pdf
 
5 Key Considerations at the Start of SaMD Development
5 Key Considerations at the Start of SaMD Development5 Key Considerations at the Start of SaMD Development
5 Key Considerations at the Start of SaMD Development
 
An In-Depth Look Into Microcontrollers
An In-Depth Look Into MicrocontrollersAn In-Depth Look Into Microcontrollers
An In-Depth Look Into Microcontrollers
 
Introduction to the Qt State Machine Framework using Qt 6
Introduction to the Qt State Machine Framework using Qt 6Introduction to the Qt State Machine Framework using Qt 6
Introduction to the Qt State Machine Framework using Qt 6
 
Leveraging Open Standards to Build Highly Extensible Autonomous Systems
Leveraging Open Standards to Build Highly Extensible Autonomous SystemsLeveraging Open Standards to Build Highly Extensible Autonomous Systems
Leveraging Open Standards to Build Highly Extensible Autonomous Systems
 
Creating Advanced GUIs for Low-power MCUs with Qt
Creating Advanced GUIs for Low-power MCUs with QtCreating Advanced GUIs for Low-power MCUs with Qt
Creating Advanced GUIs for Low-power MCUs with Qt
 
Safeguard Your Medical Devices from Cyber Threats
Safeguard Your Medical Devices from Cyber ThreatsSafeguard Your Medical Devices from Cyber Threats
Safeguard Your Medical Devices from Cyber Threats
 
Improving User Experience with Ubiquitous QuickBoot
 Improving User Experience with Ubiquitous QuickBoot Improving User Experience with Ubiquitous QuickBoot
Improving User Experience with Ubiquitous QuickBoot
 

Recently uploaded

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 

Recently uploaded (20)

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 

QML by Design Webinar

  • 1. © Integrated Computer Solutions, Inc. All Rights Reserved Webinar: QML by Design Mark Decker, Senior Qt Engineer Integrated Computer Solutions www.ics.com Copyright 2017, Integrated Computers Solutions, Inc. This work may not be reproduced in whole or in part without the express written consent of Integrated Computer Solutions, Inc. Material based on Qt 5.9.1, last updated July 2017 1
  • 2. © Integrated Computer Solutions, Inc. All Rights Reserved Introduction 2 Introduction Mark Decker ● Senior Qt Engineer at ICS ● Software Engineer for many years ● Worked closely with artists at Dreamworks Animation for 13 years ● Developed multiple commercial products using QML
  • 3. © Integrated Computer Solutions, Inc. All Rights Reserved Why This Class? QML was created, in part, to be accessible to artists ● But nobody was teaching it that way! ● In 2016 ICS was asked to develop a class ○ Design it from the ground up for artists ○ Don’t assume any programming knowledge ● I spent 4 months developing it ○ Approach material visually ○ Taught it 3 times, refining it each time ● Result was a 3 day class ○ What you see today is the very first part 3 Introduction
  • 4. © Integrated Computer Solutions, Inc. All Rights Reserved Qt and QML Qt ● Cross platform framework for programmers ○ Desktops: Mac, Windows, Linux ○ Mobile: iOS, Android ○ Various embedded devices ● Created in the 90s, and widely used ● C++ QML (Qt Meta Language) ● Declarative layer on top of C++ ● Created in 2010 4 Introduction
  • 5. © Integrated Computer Solutions, Inc. All Rights Reserved How Does QML Fit In? 5 QML C++ Touch Display Signals Data Underlying System Data
  • 6. © Integrated Computer Solutions, Inc. All Rights Reserved What is QML? ● A declarative language for UI ● An effective tool for prototyping modern, responsive UI ● A means to a clean separation between UI and business logic ● What it’s not: ○ Efficient for an entire program ○ A good place to store data 6 Introduction
  • 7. © Integrated Computer Solutions, Inc. All Rights Reserved ● More effective communications between designers & programmers ● Common terms and concepts ● Reduce need for documentation ● Easier design revisions ● Better understanding of QML capabilities ● Rapid prototypes Goals of Teaching QML to Designers 7 Introduction
  • 8. © Integrated Computer Solutions, Inc. All Rights Reserved Designer’s Role in writing QML ● Everything you already do ○ Make it beautiful ○ Make it easy to use ● Break down the layout ● Create Components to populate it ● Provide sample data ● Design for ease of modification ● UX prototyping 8 Introduction
  • 9. © Integrated Computer Solutions, Inc. All Rights Reserved Qt Creator - New Project ● Click + New Project ● Select Other Project, then Qt Quick UI, click Choose.. ● Name the project QMLclass ○ Choose a directory to store the project dir ○ Click Next ● Choose the most recent Qt Version ○ Do NOT check With ui.qml file ○ Click Next ● Click Finish ● Click Green triangle to run 9 Introduction
  • 10. © Integrated Computer Solutions, Inc. All Rights Reserved Simplest QML Program Rectangles 10 ● Start even simpler. ○ Delete all text except for the import line ○ Type the following: Rectangle { width: 500 height: 400 } ● This is the simplest QML program possible ● Set color: color: "gray"
  • 11. © Integrated Computer Solutions, Inc. All Rights Reserved Rectangle ● Rectangle, basic visual unit ○ This outermost one also doubles as our window ● Create a new Rectangle inside the first Rectangle { width: 200 height: 100 color: "red" } ● Because it is inside, the new Rectangle is a child of the first ● Add another Rectangle colored blue 11 Rectangles
  • 12. © Integrated Computer Solutions, Inc. All Rights Reserved Rectangle ● Objects drawn last appear on top ● Position by using x: y: properties ● All positions are relative to parent ● Children can draw outside parent ○ clip: true to prevent that ○ Clipping is expensive, so don’t use it unless you really need it ● Add a yellow rectangle inside the red one. 12 Rectangles
  • 13. © Integrated Computer Solutions, Inc. All Rights Reserved QML Coordinate System 13
  • 14. © Integrated Computer Solutions, Inc. All Rights Reserved ● Draw outline with border ○ Width of border is inside the rectangle border.width: 4 border.color: "black" ● Rounded corners ○ Set radius: 10 ○ Makes a circle if radius equals half the width 14 Rectangles Rectangle
  • 15. © Integrated Computer Solutions, Inc. All Rights Reserved Color Constants ● Always quoted, unlike CSS ● SVG color names: http://www.december.com/html/spec/colorsvg.html ● Possible values for hexadecimal include: ○ #rgb ○ #rrggbb ○ #aarrggbb - alpha comes first 15 Rectangles
  • 16. © Integrated Computer Solutions, Inc. All Rights Reserved Basic QML Object Structure ● Every QML object has the same basic structure QMLType { } ● It begins with the object type ○ Types always begin with a capital letter ● Followed by open and close curly braces 16 Rectangles
  • 17. © Integrated Computer Solutions, Inc. All Rights Reserved QML Object Contents ● Inside the curly braces, there can be properties and/or nested child objects Rectangle { width: 300 color: "gray" Rectangle { } } ● The order of properties does not matter ● The order of child objects determines overlap ○ 1st object painted first ○ 2nd object painted on top of it 17 Rectangles
  • 18. © Integrated Computer Solutions, Inc. All Rights Reserved QML File Structure ● QML files also have a consistent structure import QtQuick 2.8 Rectangle { width: 300 color: "gray" } ● All begin by importing a version of QtQuick ○ Contains definitions of the basic QML objects ● Followed by exactly one QML object ○ All other objects must be nested inside that outermost root object as children of it 18 Rectangles
  • 19. © Integrated Computer Solutions, Inc. All Rights Reserved Creating a QML File ● In the Projects list, Right click your project name (QMLclass) and choose Add New… ● Select Qt from the list on the left ● Select QML File (Qt Quick 2) from the list on the right ● Click Choose ● Name the file (call this one GreenSquare) ○ Must begin with a capital letter ● Click Next button, then Finish button on the next page. ● It creates the file, adds it to the project, adds the import and opens it for editing. 19 Rectangles
  • 20. © Integrated Computer Solutions, Inc. All Rights Reserved Creating a Component File ● Every QML file in the project with a capitalized name is automatically available as a component. ● Replace the Item and its curly braces with this: Rectangle { width: 100 height: width color: "green" } ● Save the file. 20 Rectangles
  • 21. © Integrated Computer Solutions, Inc. All Rights Reserved Using a Component ● From the Open Documents list, click QMLclass to go back to your main file. ● At the end of the file, just before the final closing curly brace, add this: GreenSquare {} ● Can Override properties ○ Change it’s width: 300 ● Add another GreenSquare with x: 200 21 Rectangles
  • 22. © Integrated Computer Solutions, Inc. All Rights Reserved Image Images and Text Use Image item to load pictures Image { width: 300 height: 200 source: "images/icon_close.svg" } ● Path to image file source: ● Size isn’t necessary ● sourceSize.width: width fixes .svg resolution 22
  • 23. © Integrated Computer Solutions, Inc. All Rights Reserved Image ● fillMode can be used to fill the size of a parent ○ Image.PreserveAspectFit ○ Image.PreserveAspectCrop ○ fillMode changes the scale ● Use rotation to rotate image 23 Images and Text
  • 24. © Integrated Computer Solutions, Inc. All Rights Reserved Image ● Supported Formats ○ .png - Best ○ .jpg - No support for transparency ○ .svg - Resolution independent 24 Images and Text
  • 25. © Integrated Computer Solutions, Inc. All Rights Reserved Text ● Use the Text item to display text of any size Text { text: "Hi!" color: "white" } ● Change font properties font { pixelSize: 40 family: "Times New Roman" bold: true } 25 Images and Text
  • 26. © Integrated Computer Solutions, Inc. All Rights Reserved Text Alignment ● Like everything else, text defaults to top left of parent ● horizontalAlignment: Text.AlignHCenter Text.AlignLeft, Text.AlignRight ● verticalAlignment: Text.AlignVCenter Text.AlignTop, Text.AlignBottom 26 Images and Text
  • 27. © Integrated Computer Solutions, Inc. All Rights Reserved 27 QML by Design September 13 - 15 Sunnyvale, CA https://www.ics.com/learning/training/qml-design-sept