-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMButton.qml
More file actions
56 lines (51 loc) · 1.47 KB
/
MButton.qml
File metadata and controls
56 lines (51 loc) · 1.47 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
import QtQuick 2.7
import QtQuick.Controls 2.2
Item {
property string _text: "my button"
property bool _isActive: false
property int _width: 100
property int _height: 50
property Rectangle _background: _backgroundRect
signal btnClick()
signal btnPress()
signal btnReleased
// Resource
// {
// id:rsc
// }
width: _width
height: _height
Button {
id: control
anchors {
top: parent.top
topMargin: -5
}
text: qsTr(_text)
contentItem: Text {
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
//color: control.down ? "#046380" : "#EFECCA"
color: _isActive ? "#046380" : "#EFECCA"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
id: _backgroundRect
implicitWidth: _width
implicitHeight: _height
opacity: enabled ? 1 : 0.3
border.color: control.down ? "#046380" : "#EFECCA"
//border.color: control.down ? "#A7A37E" : "#EFECCA"
//color: _isActive ? "#C5E1A5" : "white"
color: _isActive ? "#E6E2AF" : "#046380"
//border.width: 1
//radius: 2
}
onClicked: btnClick()
onReleased: btnReleased()
onPressed: btnPress()
}
}