QtQuick Training Day2
QtQuick Training Day2
Contents Day 2
User interaction
Mouse and key Interactive containers
Contents Day 2
QML components
Component files
Script files
JavaScript
Can import files, not directories Must have the as qualifier
Property scopes
child components
But, considered bad practice
RedRect.qml Main.qml
Property scopes
10
Script scopes
11
JavaScript scoping
12
Inline components
13
Dynamic loading
15
Animations overview
16
Animation basics
component
Basic properties (just like Item for GUI)
17
Animation types
Behavioral
Standalone Signal handlers State transitions
18
Animation types
19
Animation types
Behavioral animation
Default animation that is run when property
changes
20
Animation types
21
Animation types
standalone animation
Start is triggered by the signal Otherwise same rules
Needs to be bound to target and property from optional, to mandatory
22
Animation types
directory
Uses NumberAnimation for various scenarios
23
Animation objects
animation objects
PropertyAnimation and its derivatives
NumberAnimation, SmoothedAnimation,
ColorAnimation, RotationAnimation, SpringAnimation
24
Animation grouping
complex scenarios
SequentialAnimation is a list of animations that
is run one at a time
25
Animation grouping
nested
For example, a parallel animation may contain
multiple sequential animations
26
27
GUI states
GUI states
29
30
GUI states
31
State transitions
32
State transitions
33
State examples
SequentialTransition directory
Transitions quizz
34
35
Layout animations
36
Layout animations
37
39
Easing curves
an easing curve
Results in non-linear property change Quite a lot of pre-defined curves
Check PropertyAnimation.easing.type for details
Quick task:
Open AnimationGrouping example and add
some easing curves
40
Script hooks
entered
Before state transitions are run
41
Animation actions
42
Animation notes
43
USER INTERACTION
44
Mouse input
pressed property
Any mouse button (pressedButtons for filtering) Finger-press on touch screen
Position of events:
mouseX and mouseY properties mouse signal parameter
46
Mouse drag
Draggable items may contain children with mouse handling of their own
The child items must be children of the
MouseArea that declares dragging
MouseArea inherits Item, so may contain child items drag.filterChildren property
Keyboard input
48
Keyboard input
groups
Needed for re-usable components
Internals of component are not visible
49
Flickable element
contentWidth
height width
contentHeight
50
Flickable element
51
Flipable element
52
DISPLAYING DATA
53
Data elements
54
Data models
55
Data models
56
Data models
Data views
58
Path view
(10,10)
(110,10)
(60,80)
59
60
Data views
61
GUI delegates
62
GUI delegates
roles by name
If role name is ambiguous, use model attached
property
63
View selection
65
66
67
68
69
70