SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
© 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

Contenu connexe

Plus de 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
 

Plus de 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
 

Dernier

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%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
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Dernier (20)

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

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