-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomButton.qml
More file actions
40 lines (33 loc) · 909 Bytes
/
Copy pathCustomButton.qml
File metadata and controls
40 lines (33 loc) · 909 Bytes
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
import QtQuick 2.0
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.12
MouseArea {
id: root
width: parent.width
height: 40
property int size: 30
property int xMouse: 0
property string buttonText: ""
Rectangle {
id: bgColor
anchors.fill: parent
color: _themeColor
opacity: 0.8
visible: false
CustomGradient { xxMouse: xMouse }
}
CustomText {
textSize: 1.5
text: buttonText
anchors.horizontalCenter: parent.horizontalCenter
}
hoverEnabled: true
onEntered: { 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 }
}