summaryrefslogtreecommitdiffstats
path: root/experimental/Media Player/ImageButton.qml
blob: 274efd565b5a02af7e3f17be164a53bbe91656d1 (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

import QtQuick 2.0

Item {
    id: root

    property alias enabled: mouseArea.enabled
    property alias imageSource: image.source

    property bool checkable: false
    property bool checked: false
    property alias hover: mouseArea.containsMouse
    property alias pressed: mouseArea.pressed

    opacity: enabled ? 1.0 : 0.3
    signal clicked

    width: image.width
    height: image.height

    Image {
        id: image
        anchors.centerIn: parent
        visible: true
        opacity: pressed ? 0.6 : 1
        smooth: true
    }

//    ColorOverlay {
//        id: glowEffect
//        anchors.fill: image
//        source: image
//        color: pressed ? "#22000000" : checked ? "orange" : "white"
//        visible: checked || hover || pressed
//    }

    MouseArea {
        id: mouseArea
        hoverEnabled: true
        anchors.fill: root
        onPositionChanged: applicationWindow.resetTimer()
        onClicked: root.clicked();
    }
}