1 QML Intro
1 QML Intro
Introduction to Qt Quick
Contents
2015
Objectives
Qt framework presentation
Qt Quick inside the Qt framework
2015
Cross-Platform
Class Library
One Technology for
All Platforms
Integrated
Development
Tools
Shorter Time-to-Market
Cross-Platform
IDE, Qt Creator
Productive development
environment
2015
Qt Quick
Qt Widgets
Web / Hybrid
2015
2015
2015
2015
2015
Qt / Windows
Qt / OSX
Windows GDI
Windows Kernel
PC HW
Cocoa
Mac Kernel
MacHW
Qt / Embedded
Qt / Android
10
Qt Application
QtGui
QtCore
QtNetwork
QtSql
QtMultimedia
etc.
Android NDK
Android Kernel
Android HW
2015
Qt Quick Requirements
11
2015
Qt Modules
12
2015
Meet Qt Quick
What is Qt Quick?
14
2015
Philosophy of Qt Quick
15
2015
Imperative Logic
Processes, Threads,
IPC, Containers,
I/O, Strings,
Etc.
HTTP
FTP
SSL
SQL
&
Oracle
Databases
Serial Port
Sql
NFC
Network
Positioning
Core
Bluetooth
Developer
XML
2015
Concepts
What Is QML?
18
2015
A Tree of Elements
19
2015
Viewing an Example
import QtQuick 2.4
Rectangle {
width: 400;
height: 400
color: "lightblue"
}
Demo: qml-intro/ex-concepts/rectangle.qml
20
2015
Elements
Non-visual elements:
States, transitions,...
Models, paths,
Gradients, timers, etc.
2015
Properties
22
Used for
2015
Property Examples
Text {
font.family: "Helvetica"
font.pixelSize: 24
// Prefferred syntax
// font { family: "Helvetica"; pixelSize: 24 }
}
23
2015
Property Examples
24
KeyNagivation.tab is not a
standard property of TextInput
Is a standard property that is attached
to elements
2015
Binding Properties
Item {
width: 400; height: 200
Rectangle {
x: 100; y: 50; width: height * 2; height: 100
color: "lightblue"
}
}
25
2015
Identifying Elements
2015
Using Identities
Item {
width: 300; height: 115
Text {
id: title
x: 50; y: 25 text: "Qt Quick"
font.family: "Helvetica"; font.pixelSize: 50
}
Rectangle {
x: 50; y: 75; height: 5
width: title.width
color: "green"
}
}
Demo: qml-intro/ex-concepts/identity.qml
27
2015
Viewing an Example
Text {
id: title
x: 50; y: 25 text: "Qt Quick"
font.family: "Helvetica"; font.pixelSize: 50
}
Rectangle {
x: 50; y: 75; height: 5
width: title.width
color: "green"
}
28
Basic Types
Lists:[...]
Scripts:
Other types:
2015
30
2015
Summary
31
2015
Questions
32
2015
Lab Items
The image on the right shows two items and two
child items inside a 400 400 rectangle.
1. Recreate the scene using Rectangle items.
2. Can items overlap? Experiment by moving the light
blue or green rectangles.
3. Can child items be displayed outside their parents?
Experiment by giving one of the child items negative
coordinates.
33
2015