forked from zynthian/zynthian-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckIndicator.qml
65 lines (58 loc) · 1.6 KB
/
CheckIndicator.qml
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
/*
SPDX-FileCopyrightText: 2016 Marco Martin <[email protected]>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick 2.6
import org.kde.plasma.core 2.0 as PlasmaCore
import "private" as Private
PlasmaCore.FrameSvgItem {
id: root
property Item control
imagePath: "widgets/button"
prefix: "normal"
implicitWidth: PlasmaCore.Units.iconSizes.small
implicitHeight: implicitWidth
opacity: control.enabled ? 1 : 0.6
Private.ButtonShadow {
anchors.fill: parent
showShadow: !control.pressed
}
PlasmaCore.SvgItem {
svg: PlasmaCore.Svg {
id: checkmarkSvg
imagePath: "widgets/checkmarks"
}
elementId: "checkbox"
opacity: {
if (typeof control.checkState !== "undefined") {
switch (control.checkState) {
case Qt.Checked:
return 1;
case Qt.PartiallyChecked:
return 0.5;
default:
return 0;
}
} else {
return control.checked ? 1 : 0;
}
}
anchors {
fill: parent
}
Behavior on opacity {
NumberAnimation {
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
}
}
}
Private.ButtonFocus {
anchors.fill: parent
showFocus: control.activeFocus && !control.pressed
}
Private.ButtonHover {
anchors.fill: parent
showHover: control.hovered && !control.pressed
}
}