Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PrintSetupHeaderButton.qml « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0a6c5c363a2477a49f18a824c2983ad2707af47f (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
// Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

// Button with a label-like appearance that displays different states (these can be displayed by setting the
// `valueError` or `valueWarning` properties). Mainly used within the `CustomConfiguration` component.

import QtQuick 2.1
import QtQuick.Controls 2.1

import Cura 1.0 as Cura
import UM 1.5 as UM

ToolButton
{
    id: base

    property alias tooltip: tooltip.text

    property bool valueError: false;
    property bool valueWarning: false;

    UM.ToolTip
    {
        id: tooltip
        visible: base.hovered
        targetPoint: Qt.point(parent.x, Math.round(parent.y + parent.height / 2))
    }

    states:
    [
        State
        {
            name: "disabled"
            when: !base.enabled;
            PropertyChanges
            {
                target: background
                color: UM.Theme.getColor("setting_control_disabled")
                liningColor: UM.Theme.getColor("setting_control_disabled_border")
            }
        },
        State
        {
            name: "value_error"
            when: base.enabled && base.valueError
            PropertyChanges
            {
                target: background
                color: UM.Theme.getColor("setting_validation_error_background")
                liningColor: UM.Theme.getColor("setting_validation_error")
            }
        },
        State
        {
            name: "value_warning"
            when: base.enabled && base.valueWarning
            PropertyChanges
            {
                target: background
                color: UM.Theme.getColor("setting_validation_warning_background")
                liningColor: UM.Theme.getColor("setting_validation_warning")
            }
        },
        State
        {
            name: "highlight"
            when: base.enabled && base.hovered
            PropertyChanges
            {
                target: background
                color: UM.Theme.getColor("setting_control")
                liningColor: UM.Theme.getColor("border_main")
            }
        },
        State
        {
            name: "neutral"
            when: base.enabled && !base.hovered && !base.valueWarning && !base.valueError
            PropertyChanges
            {
                target: background
                color: UM.Theme.getColor("setting_control")
                liningColor: UM.Theme.getColor("border_field_light")
            }
        }
    ]

    background: UM.UnderlineBackground
    {
        id: background

        UM.ColorImage
        {
            id: downArrow
            anchors.verticalCenter: parent.verticalCenter
            anchors.right: parent.right
            anchors.rightMargin: UM.Theme.getSize("default_margin").width
            width: UM.Theme.getSize("standard_arrow").width
            height: UM.Theme.getSize("standard_arrow").height
            color: base.enabled ? UM.Theme.getColor("setting_control_button") : UM.Theme.getColor("setting_category_disabled_text")
            source: UM.Theme.getIcon("ChevronSingleDown")
        }
    }

    contentItem: UM.Label
    {
        id: printSetupComboBoxLabel
        text: base.text
        elide: Text.ElideRight;
        anchors.left: parent.left;
        anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
        anchors.right: downArrow.lef
        anchors.rightMargin: base.rightMargin
        anchors.verticalCenter: parent.verticalCenter
    }
}