summaryrefslogtreecommitdiffstats
path: root/src/gui/qml/ImageButton.qml
blob: 3e673fd70b0fcad38f22a4a6a61ce3df48045667 (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
import QtQuick 2.0

Rectangle {

    property alias image: img.source
    signal clicked

    color: "transparent"
    z: 2

    MouseArea {
        id: mouseArea
        anchors.fill: parent
        onClicked: parent.clicked()
    }

    Image {
        id: img
        smooth: true
        anchors.fill: parent
    }

    states: State {
        name: "pressed"; when: mouseArea.pressed
        PropertyChanges { target: img; anchors.topMargin: 2; anchors.bottomMargin: -2 }
    }
}