summaryrefslogtreecommitdiffstats
path: root/src/qml/assets/UIButton.qml
blob: 3a65c12dd0537cbb3657173ceac7889cd2d93e29 (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
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.2


ToolButton {
    id: root
    implicitHeight: toolBarSize
    implicitWidth: toolBarSize

    property string source: ""
    property real radius: 0.0
    property string color: uiColor
    property string highlightColor: buttonPressedColor
    style: ButtonStyle {
        background: Rectangle {
            opacity: root.enabled ? 1.0 : 0.3
            color: root.pressed || root.checked ? root.highlightColor : root.color
            radius: root.radius
            Image {
                source: root.source
                width: Math.min(sourceSize.width, root.width)
                height: Math.min(sourceSize.height, root.height)
                anchors.centerIn: parent
            }
        }
    }
}