summaryrefslogtreecommitdiff
path: root/components/custom/styles/default/RadioButtonStyle.qml
blob: 0381993e40578578e8cd00bdb51631f7a3f4f557 (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
import QtQuick 1.1
import "tools" as StyleTools

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

    property Component background: Component {
        Item {
            width: styledItem.implicitWidth; height: styledItem.implicitHeight
            Rectangle { // Background center fill
                anchors.fill: parent
                anchors.margins: 1
                radius: width/2
                color: backgroundColor
            }
            Image {
                opacity: enabled ? 1 : 0.7
                source: "images/radiobutton_normal.png"
                fillMode: Image.Stretch
                anchors.centerIn: parent
            }
        }
    }

    property Component checkmark: Component {
        Image {
            StyleTools.ColorConverter { id: cc; color: backgroundColor }
            source: cc.grayValue() < 70? "images/radiobutton_check_white.png" : "images/radiobutton_check.png"
            opacity: (!enabled && checked) || pressed == true ? 0.5 : (!checked ? 0 : 1)
            Behavior on opacity { NumberAnimation { duration: 150; easing.type: Easing.OutCubic } }
        }
    }
}