-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLedButton.qml
More file actions
61 lines (58 loc) · 1.96 KB
/
Copy pathLedButton.qml
File metadata and controls
61 lines (58 loc) · 1.96 KB
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
import QtQuick 2.4
LedButtonForm {
id: button
property string name
property int no // Número do led
property double leftMarginModifier: 0
property double topMarginModifier: 0
// Configurando parâmetros de posicionamento na imagem do óculos
anchors.left: parent.left
anchors.top: parent.top
anchors.leftMargin: (parent.width - parent.paintedWidth)/2 + leftMarginModifier * parent.paintedWidth - width/2
anchors.topMargin: (parent.height - parent.paintedHeight)/2 + topMarginModifier * parent.paintedHeight - height/2
width: 16/640 * parent.paintedWidth
height: width
//internalButton.onClicked: {chosen();}
//define a scale animation
Behavior on scale {
NumberAnimation {
duration: 100
easing.type: Easing.InOutQuad
}
}
//define transmission for the states
transitions: [
Transition {
from: "*"; to: "Hovering"
ColorAnimation { duration: 200 }
},
Transition {
from: "*"; to: "Pressed"
ColorAnimation { duration: 10 }
}
]
//Mouse area to react on click events
MouseArea {
hoverEnabled: true
anchors.fill: button
onEntered: {
// Mudando a cor para uma cor desaturada no evento de Hover
if (button.color != "#ffffff"){
hoverColor = button.color;
hoverColor.hslSaturation *= 0.7;
}
else hoverColor = "#aaaaaa"
button.state='Hovering'
}
//onEntered: { var col = []; col[0] = button.color; col[0].hslSaturation *= 0.8; hoverColor = col[0]; button.state='Hovering'}
onExited: { button.state=''}
onClicked: { button.chosen(button); button.clicked()}
onPressed: { button.state="Pressed" }
onReleased: {
if (containsMouse)
button.state="Hovering";
else
button.state="";
}
}
}