summaryrefslogtreecommitdiffstats
path: root/examples/demos/coffee/InsertForm.ui.qml
blob: 9977c584cc3053ad242884e4fef882ca65033625 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Layouts
import QtQuick.Effects

Item {
    id: root
    property alias continueButton: continueButton
    property alias cancelButton: cancelButton
    property alias dialog: dialog
    property string coffeeName: ""

    states: [
        State {
            name: "portrait"
            PropertyChanges {
                target: grid
                flow: GridLayout.TopToBottom
                rowSpacing: 20
                columns: 1
                rows: 4
            }
            PropertyChanges {
                target: cup
                Layout.alignment: Qt.AlignCenter
                Layout.preferredWidth: height / 1.16
                Layout.preferredHeight: root.height / 3
                Layout.row: 0
            }
            PropertyChanges {
                target: dialog
                Layout.row: 1
                Layout.alignment: Qt.AlignCenter
                Layout.preferredWidth: root.width / 1.12
                Layout.preferredHeight: root.height / 7
            }
            PropertyChanges {
                target: continueButton
                Layout.row: 2
                Layout.preferredWidth: root.width / 2.2
                Layout.preferredHeight: root.height / 14
            }
            PropertyChanges {
                target: cancelButton
                Layout.row: 3
                Layout.preferredWidth: root.width / 2.2
                Layout.preferredHeight: root.height / 14
            }
        },
        State {
            name: "landscape"
            PropertyChanges {
                target: grid
                flow: GridLayout.LeftToRight
                columns: 3
                rows: 3
                rowSpacing: 20
            }
            PropertyChanges {
                target: cup
                Layout.alignment: Qt.AlignCenter
                Layout.preferredHeight: root.height / 1.5
                Layout.preferredWidth: root.width / 5
                Layout.column: 2
                Layout.row: 0
            }
            PropertyChanges {
                target: dialog
                Layout.preferredWidth: root.width / 4
                Layout.preferredHeight: parent.height / 4
                Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
                Layout.column: 0
                Layout.row: 0
                Layout.columnSpan: 2
            }
            PropertyChanges {
                target: continueButton
                Layout.column: 2
                Layout.row: 2
                Layout.preferredWidth: root.width / 4
                Layout.preferredHeight: root.height / 8
            }
            PropertyChanges {
                target: cancelButton
                Layout.column: 0
                Layout.row: 2
                Layout.preferredWidth: root.width / 4
                Layout.preferredHeight: root.height / 8
            }
        }
    ]
    GridLayout {
        id: grid
        flow: GridLayout.TopToBottom
        anchors.horizontalCenter: parent.horizontalCenter
        Cup {
            id: cup
        }
        Rectangle {
            id: dialog
            radius: 8
            Layout.minimumHeight: 70
            Layout.minimumWidth: 180
            gradient: Colors.greenBorder
            Rectangle {
                id: rectangle
                width: parent.width - 2
                height: parent.height - 2
                radius: 8
                anchors.verticalCenter: parent.verticalCenter
                anchors.horizontalCenter: parent.horizontalCenter
                color: Colors.currentTheme.cardColor
                Text {
                    text: "Please insert your cup."
                    color: Colors.currentTheme.textColor
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.verticalCenter: parent.verticalCenter
                }
            }
            MultiEffect {
                source: rectangle
                anchors.fill: rectangle
                shadowEnabled: true
                shadowColor: Colors.shadow
                shadowOpacity: 0.5
            }
        }
        CustomButton {
            id: continueButton
            Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
            Layout.minimumWidth: 150
            Layout.minimumHeight: 40
            showIcon: false
            buttonText: "Continue"
            buttonColor: "green"
        }
        CustomButton {
            id: cancelButton
            Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
            Layout.minimumWidth: 150
            Layout.minimumHeight: 40
            showIcon: false
            buttonText: "Cancel"
        }
    }
}