blob: 71cec068684d191180b6d90c390784f50ded63dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Layouts
Item {
// Height, width and any other size related properties containing odd looking float or other dividers
// that do not seem to have any logical origin are just arbitrary and based on original design
// and/or personal preference on what looks nice.
id: root
property alias cappuccinoButton: cappuccino.button
property alias latteButton: latte.button
property alias espressoButton: espresso.button
property alias macchiatoButton: macchiato.button
property alias cards: cards
property alias cappuccino: cappuccino
property alias macchiato: macchiato
property alias espresso: espresso
property alias latte: latte
states: [
State {
name: "portrait"
PropertyChanges {
target: cards
flow: GridLayout.TopToBottom
rows: 2
}
},
State {
name: "landscape"
PropertyChanges {
target: cards
flow: GridLayout.LeftToRight
columns: 4
}
}
]
//! [Coffees]
GridLayout {
id: cards
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
rowSpacing: 20
columnSpacing: 20
CoffeeCard {
id: cappuccino
coffeeName: "Cappuccino"
ingredients: "Milk, Espresso, Foam"
time: 2
cupsLeft: applicationFlow.cappuccinos
}
CoffeeCard {
id: latte
coffeeName: "Latte"
ingredients: "Coffee, Foam"
time: 3
cupsLeft: applicationFlow.lattes
}
CoffeeCard {
id: espresso
coffeeName: "Espresso"
ingredients: "Milk, Espresso"
time: 2
cupsLeft: applicationFlow.espressos
}
CoffeeCard {
id: macchiato
coffeeName: "Macchiato"
ingredients: "Milk foam, Espresso"
time: 4
cupsLeft: applicationFlow.macchiatos
}
}
//! [Coffees]
}
|