-
Notifications
You must be signed in to change notification settings - Fork 0
/
LayoutHeaderView.qml
178 lines (164 loc) · 4.94 KB
/
LayoutHeaderView.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import QtQuick.Window 2.12
ToolBar{
padding: 0
background: Rectangle{
color: "#E0E0E0"
}
width: parent.width
Layout.fillWidth: true
RowLayout{
anchors.fill: parent
spacing: 0
MusicToolButton{
icon.source: "qrc:/images/music"
toolTip: "空名"
}
MusicToolButton{
icon.source: "qrc:/images/about"
toolTip: "关于"
onClicked: {
aboutPop.open()
}
}
MusicToolButton{
id:smallWindow
icon.source: "qrc:/images/small-window"
toolTip: "小窗播放"
onClicked: {
setWindowSize(350, 500)
normalWindow.visible = true
smallWindow.visible = false
}
}
MusicToolButton{
id:normalWindow
icon.source: "qrc:/images/exit-small-window"
toolTip: "退出小窗"
visible : false
onClicked: {
setWindowSize()
normalWindow.visible = false
smallWindow.visible = true
}
}
Rectangle{
x: -1
color: "#efefef"
}
Text{
Layout.fillWidth: true
text: qsTr("空名的音乐播放器")
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "微软雅黑"
font.pointSize: 14
}
MusicToolButton{
icon.source: "qrc:/images/minimize-screen"
toolTip: "最小化"
onClicked: {
window.visibility = Window.Minimized
}
}
MusicToolButton{
id:fullWindow
icon.source: "qrc:/images/full-screen"
toolTip: "全屏播放"
onClicked: {
window.visibility = Window.Maximized
fullWindow.visible = false
exitFullWindow.visible = true
}
}
MusicToolButton{
id:exitFullWindow
icon.source: "qrc:/images/small-window"
toolTip: "退出全屏"
visible: false
onClicked: {
window.visibility = Window.Windowed
fullWindow.visible = true
exitFullWindow.visible = false
}
}
MusicToolButton{
icon.source: "qrc:/images/power"
toolTip: "退出"
onClicked: {
window.close()
}
}
}
Popup{
id: aboutPop
parent: overlay
x: (parent.width-width)/2
y: (parent.height-height)/2
width: 400
height: 360
background: Rectangle{
color:"#6080CBC4"
radius: 10
}
contentItem: ColumnLayout{
Text {
text: qsTr("关于")
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 30
font.bold: true
}
Image {
Layout.preferredHeight: 100
Layout.fillWidth: true
source: "qrc:/images/Pika"
fillMode: Image.PreserveAspectFit
}
Text {
text: qsTr("空名的音乐播放器")
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
font.bold: true
}
Text {
text: qsTr("QML简单学习项目")
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
font.bold: true
}
Text {
text: qsTr("作者:NonamePika(空名)")
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
font.bold: true
}
Text {
text: qsTr("参考B站UP续加仪的教学视频制作完成")
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 20
font.bold: true
}
Text {
text: qsTr("(点击其他地方关闭此界面)")
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 12
font.bold: true
}
}
}
function setWindowSize(width=window.mWINDOW_WIDTH, height=window.mWINDOW_HEIGHT){
window.height = height
window.width = width
window.x=(Screen.desktopAvailableWidth-window.width)/2
window.y=(Screen.desktopAvailableHeight-window.height)/2
}
}