-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.qml
More file actions
104 lines (88 loc) · 2.61 KB
/
main.qml
File metadata and controls
104 lines (88 loc) · 2.61 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
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
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.1
import FramelessWindowHelper 1.0
Window {
id: root
visible: true
minimumWidth: 600
minimumHeight: 400
maximumWidth: 1000
maximumHeight: 700
width: 640
height: 480
title: qsTr("Hello World")
flags: Qt.FramelessWindowHint | Qt.Window | Qt.WindowMinimizeButtonHint
FramelessWindowHelper {
}
function updateWindow() {
var opacity = root.opacity
root.opacity = opacity - 0.01
root.opacity = opacity
}
onVisibilityChanged: updateWindow()
Rectangle {
id: titleBar
color: 'blue'
width: parent.width
height: closeButton.height
objectName: "titleBar"
MouseArea {
anchors.fill: parent
cursorShape: Qt.BusyCursor
property point pressPos
onPressed: pressPos = Qt.point(mouse.x, mouse.y)
onPositionChanged: {
if (root.visibility == Window.Windowed) {
root.x += mouse.x - pressPos.x
root.y += mouse.y - pressPos.y
}
}
onDoubleClicked: maxButton.clicked()
}
Row {
spacing: 6
anchors.right: parent.right
anchors.rightMargin: 6
Rectangle {
color: 'yellow'
width: 100
height: parent.height
MouseArea {
anchors.fill: parent
cursorShape: Qt.ArrowCursor
}
}
Button {
text: "最小化"
onClicked: root.visibility = Window.Minimized
}
Button {
id: maxButton
text: root.visibility == Window.Windowed ? "最大化" : "恢复"
onClicked: root.visibility = root.visibility == Window.Windowed ?
Window.Maximized : Window.Windowed
}
Button {
id: closeButton
text: "关闭"
onClicked: root.close()
}
}
}
Rectangle {
anchors.fill: parent
anchors.margins: 5
color: 'transparent'
border.color: 'red'
border.width: 1
}
Button {
anchors.centerIn: parent
onClicked: testLoader.source = "Test.qml"
}
Loader {
id: testLoader
onStatusChanged: if (status == Loader.Ready) item.show()
}
}