-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMusicControllerButton.qml
More file actions
62 lines (54 loc) · 1.4 KB
/
Copy pathMusicControllerButton.qml
File metadata and controls
62 lines (54 loc) · 1.4 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
62
import QtQuick 2.0
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.12
MouseArea {
id: root
property int size: 30
property bool imgVisible: true
property string imgSource: ""
property string buttonText: ""
anchors.verticalCenter: parent.verticalCenter
width: size
height: size
Rectangle {
id: bgColor
anchors.fill: parent
color: _themeColor
radius: width / 2
opacity: 0.8
visible: false
}
Image {
enabled: imgVisible
id: icon
width: 20
height: 20
anchors.centerIn: parent
source: imgSource
visible: false
}
ColorOverlay {
id: coloredIcon
visible: imgVisible
anchors.fill: icon
source: icon
color: _textColor
}
Text {
enabled: !imgVisible
visible: !imgVisible
text: buttonText
font.pixelSize: Qt.application.font.pixelSize * 1.2
color: _textColor
anchors.centerIn: parent
}
hoverEnabled: true
onEntered: { bgColor.color = _hoverColor; bgColor.visible = true }
onPressed: { bgColor.color = _backGroundColor }
onReleased: {
if (root.containsMouse) bgColor.color = _hoverColor
else bgColor.color = _themeColor
}
onPositionChanged: { xMouse = mouse.x }
onExited: { bgColor.color = _themeColor; bgColor.visible = false }
}