summaryrefslogtreecommitdiffstats
path: root/examples/demos/coffee/Settings.qml
blob: 90790e290bc7eeef3af519a1a524f3cb7cb241dd (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick

SettingsForm {
    rectangle.states: [
        State {
            name: "smallerFont"
            when: ((Screen.height * Screen.devicePixelRatio)
                   + (Screen.width * Screen.devicePixelRatio)) < 2000
            PropertyChanges {
                target: rectangle
                textPixelSize: 14
            }
        }
    ]
    sugarSlider.states: State {
        name: "pressed"
        when: sugarSlider.pressed
        PropertyChanges {
            target: handle
            scale: 1.1
        }
    }
    handle.states: [
        State {
            name: "small"
            when: ((Screen.height * Screen.devicePixelRatio)
                   + (Screen.width
                      * Screen.devicePixelRatio)) < 2000
            PropertyChanges {
                target: handle
                width: 10
            }
        }
    ]
    box.states: [
        State {
            name: "small"
            when: ((Screen.height * Screen.devicePixelRatio)
                   + (Screen.width
                      * Screen.devicePixelRatio)) < 2000
            PropertyChanges {
                target: box
                implicitWidth: sugarText.width + 4
                implicitHeight: sugarText.height + 2
            }
        }
    ]
    sugarText.states: [
        State {
            name: "small"
            when: ((Screen.height * Screen.devicePixelRatio) + (Screen.width * Screen.devicePixelRatio)) < 2000
            PropertyChanges {
                target: sugarText
                font.pixelSize: 8
            }
        }
    ]
    sugarSlider.onMoved: {
        sugarText.sugarAmount = sugarSlider.position * 4
    }
    confirmButton.onClicked: applicationFlow.confirmButton()
    //! [Value changed]
    coffeeSlider.onValueChanged: {
        applicationFlow.coffeeAmount = coffeeSlider.value
    }
    //! [Value changed]
    milkSlider.onValueChanged: {
        applicationFlow.milkAmount = milkSlider.value
    }
    foamSlider.onValueChanged: {
        applicationFlow.foamAmount = foamSlider.value
    }
    sugarSlider.onValueChanged: {
        applicationFlow.sugarAmount = sugarSlider.value
    }
}