-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLyricWindow.qml
96 lines (74 loc) · 1.98 KB
/
LyricWindow.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
88
89
90
91
92
93
94
95
96
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtWebEngine 1.5
import QtWebChannel 1.0
import com.mplayer 1.0
Rectangle {
id:myLyricWindow;
visible: true;
width:843;
height: 624;
function reload(){
console.log("reload");
mainHtml.reload();
}
//需要注册一个WebChannel对象
WebChannel{
id:changedId
registeredObjects:[myObject]
}
WebEngineView {
id:mainHtml
anchors.fill: parent
url: "qrc:/res/lyric.html"
webChannel:changedId
onContextMenuRequested: function(request) {
request.accepted = true
}
}
MLyric{
id: myObject
WebChannel.id: "mPlayer" //这个id可在html中使用
signal signal_setScorll(int time);
//c++ -->Qml
onSignalSendToQml: {
//console.log("onSignalSendToQml" + nTime);
signal_setScorll(nTime);
}
//c++ -->Qml
onSignalReloadLyric: {
console.log("onSignalReloadLyric");
myLyricWindow.reload();
}
//扩展的函数
function hideLyric(){
console.log("hideLyric");
lyricModel.sig_HideLyric();
}
function getLyric(){
console.log("getLyric1234");
var d = lyricModel.getLyric();
return d
}
function getSonger(){
console.log("getSonger");
var d = lyricModel.getSonger();
return d
}
function getAlbumName(){
console.log("getAlbumName");
var d = lyricModel.getAlbumName();
return d
}
function getSongName(){
console.log("getSongName");
var d = lyricModel.getSongName();
return d
}
}
}