-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMenu.qml
87 lines (76 loc) · 2.03 KB
/
Menu.qml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import QtQuick 2.0
Item {
id: itemMenu
width: parent.width
height: parent.height
z: 1000
visible: false
property int m_menuX: 0
property int m_menuY: 0
property int m_menuH: 60/800*itemMenu.height*5+10
property int m_curVal: -1
property string m_curText: "全部区域"
//property string m_menuArr: []
function clearAll() {
lmMenu.clear()
}
function addItem(menuText, menuId) {
//for(var i=0;i<m_menuArr.length;i++) {
lmMenu.append({"menuText":menuText, "menuId":menuId})
//}
}
MouseArea {
anchors.fill: parent
onClicked: {
itemMenu.visible = false
}
}
ListView {
id: lvMenu
z: 1001
x: m_menuX
y: m_menuY
width: 120/480*itemMenu.width
height: m_menuH
Component {
id: dgMenu
Rectangle {
id: rectItem
color: "#ffffff"
height: 60/800*itemMenu.height
width: 120/480*itemMenu.width
MouseArea {
anchors.fill: parent
onClicked: {
m_curText = txtMenuText.text
m_curVal = txtMenuId.text
itemMenu.visible = false
}
}
Text {
id: txtMenuId
text: menuId
visible: false
}
Text {
id: txtMenuText
text: menuText
anchors.centerIn: parent
font.pointSize: 15
color: "#333333"
}
Rectangle {
anchors.bottom: parent.bottom
height: 2
width: parent.width
color: "#e8e8e7"
}
}
}
delegate: dgMenu
model: lmMenu
ListModel {
id: lmMenu
}
}
}