-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDetailHistoryPageView.qml
79 lines (71 loc) · 1.73 KB
/
DetailHistoryPageView.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
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Layouts
import Qt.labs.platform
import Qt.labs.settings
import QtQml
ColumnLayout{
Rectangle{
Layout.fillWidth: true
width: parent.width
height: 60
color:"#00000000"
Text{
x:10
verticalAlignment: Text.AlignBottom
text:"历史播放"
font.family: window.mFontFamily
font.pointSize: 25
color: "#eeffffff"
}
}
RowLayout{
height: 80
Item {
width: 10
}
MusicTextButton{
btnText: "刷新记录"
btnHeight: 50
btnWidth: 120
onClicked: {
getHistoryLit()
}
}
MusicTextButton{
btnText: "清空记录"
btnHeight: 50
btnWidth: 120
onClicked: {
saveHistoryLit("")
}
}
}
MusicListView{
id: historyListView
onDeleteItem:function(index){
deleteHistory(index)
}
}
Component.onCompleted: {
getHistoryLit()
}
function deleteHistory(index){
historyListView.musicList.splice(index,1)
saveHistoryLit(JSON.stringify(historyListView.musicList))
}
function getHistoryLit(){
var list= historySttings.value("history","")
console.log("getHistoryLit= "+list)
if(list.length>0){
historyListView.musicList=JSON.parse(list)
}else{
historyListView.musicList=[]
}
}
function saveHistoryLit(list){
console.log("saveHistoryLit= "+list)
historySttings.setValue("history",list)
getHistoryLit()
}
}