summaryrefslogtreecommitdiff
path: root/src/components/styles/default/ChoiceListStyle.qml
blob: 12b10ffd5fb3ae205225c123ce9fbcde38ffb606 (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
import QtQuick 1.0

QtObject {
    property int minimumWidth: 200
    property int minimumHeight: 32

    property int leftMargin: 8
    property int topMargin: 8
    property int rightMargin: 34
    property int bottomMargin: 8

    property Component background: Component {
        Item {
            opacity: enabled ? 1 : 0.8
            Rectangle { // Background center fill
                anchors.fill: parent
                anchors.margins: 1
                color: backgroundColor
                radius: 5
            }
            BorderImage {
                anchors.fill: parent
                id: backgroundimage
                smooth: true
                source: styledItem.pressed ? "images/button_pressed.png" : "images/button_normal.png"
                width: 80; height: 24
                border.left: 3; border.top: 3
                border.right: 3; border.bottom: 3
                Image {
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.right: parent.right
                    anchors.rightMargin: 10
                    opacity: enabled ? 1 : 0.3
                    source:"images/spinbox_down.png"
                }
            }
        }
    }

    property Component label: Component {
        Text {
            id:t
            color: textColor
            text: model && currentIndex >= 0 ? model.get(currentIndex).text : ""
            opacity: enabled ? 1 : 0.5
        }
    }

    // Popout styling

    property Component popupFrame: Component {
        Item {
            Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 250 } }

            anchors.leftMargin: 6
            anchors.topMargin: 6
            anchors.rightMargin: 7
            anchors.bottomMargin: 6

            Rectangle { // Background center fill
                anchors.fill: parent
                anchors.margins: 1
                color: backgroundColor
                radius: 5
            }
            BorderImage {
                anchors.fill: parent
                id: backgroundimage
                smooth: true
                source: "images/button_normal.png"
                width: 80; height: 24
                border.left: 5; border.top: 5
                border.right: 5; border.bottom: 5
            }
        }
    }

    property Component listItem: Component {
        Rectangle {
            width: styledItem.width
            height: Math.max(itemText.height, 28)
            color: highlighted ? "#556699" : "transparent"
	    radius:2
	    border.width:1
	    border.color:Qt.darker(color)
	    clip:true
            Text {
                id: itemText
                anchors.verticalCenter: parent.verticalCenter
                anchors.left: parent.left
                anchors.leftMargin: 6

                font.bold: index == currentIndex
                color: highlighted ? "white" : styledItem.textColor
                anchors.margins: 10
                text: model ? model.get(index).text : ""  // list properties can't be automatically be added to the scope, so use get()
            }
        }
    }
}