Repository navigation
Expand file tree
/
Copy pathMyToolButton.qml
More file actions
executable file
·66 lines (56 loc) · 1.73 KB
/
Copy pathMyToolButton.qml
File metadata and controls
executable file
·66 lines (56 loc) · 1.73 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
63
64
65
66
import QtQuick 2.0
/* 左边图标*/
Rectangle {
id: root
visible: true
width: 40
height: width
radius: cirFlag ? width/2 : width/10;
color: "transparent"
// border.color: "green"
// border.width: 1
property alias icon_code: icon.text
property alias icon_size: icon.font.pixelSize
property alias icon_color: icon.color
property color clr_backgroud: "transparent" //背景透明色
property color clr_entered: "darkgray"
property color clr_exited: clr_backgroud
property color clr_pressed: "greenyellow" //点击效果
property int offsetV: 0
property int offsetH: 0
property bool cirFlag: false //是矩形还是圆形标志位
property int margin: 10
signal clicked
Text {
id: icon
font.family: "FontAwesome"
font.pixelSize: 20
text: Define.iconCode_back //返回图标
color: "white"
opacity: 1.0 //不透明
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
anchors.verticalCenterOffset: offsetV
anchors.horizontalCenterOffset: offsetH
anchors.centerIn: root
}
MouseArea {
anchors.fill: root
acceptedButtons: Qt.LeftButton; //只接受左键
hoverEnabled: true
onClicked: root.clicked()
onEntered:
{
root.color = clr_entered
icon.scale = 1.3
}
onExited:
{
root.color = clr_exited
icon.scale = 1
}
onReleased: root.color = clr_entered
// onReleased: root.color = "transparent"
onPressed: root.color = clr_pressed;
}
}