blob: b56291e6144c557e064f7aa43764f6dbc47d0c0f (
plain)
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
|
import QtQuick
Item {
id: root
readonly property real edgeSize: 8
required property var targetWindow
property bool supported: typeof targetWindow.startSystemMove === "function"
readonly property bool canMaximize: targetWindow.minimumSize.width !== targetWindow.maximumSize.width || targetWindow.minimumSize.height !== targetWindow.maximumSize.height
anchors.fill: parent
function tryStartMove() {
if (!supported)
return;
targetWindow.startSystemMove();
}
function tryStartResize(edges) {
if (!supported || !canMaximize)
return;
targetWindow.startSystemResize(edges);
}
function tryToggleMaximize() {
if (!supported || !canMaximize)
return;
targetWindow.maximized = !targetWindow.maximized;
}
MouseArea {
visible: root.supported && root.canMaximize
height: root.edgeSize
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.leftMargin: 6
anchors.rightMargin: 6
cursorShape: Qt.SizeVerCursor
onPressed: root.tryStartResize(Qt.TopEdge)
}
MouseArea {
visible: root.supported && root.canMaximize
width: root.edgeSize
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 6
anchors.bottomMargin: 6
cursorShape: Qt.SizeHorCursor
onPressed: root.tryStartResize(Qt.LeftEdge)
}
MouseArea {
visible: root.supported && root.canMaximize
width: root.edgeSize
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 6
anchors.bottomMargin: 6
cursorShape: Qt.SizeHorCursor
onPressed: root.tryStartResize(Qt.RightEdge)
}
MouseArea {
visible: root.supported && root.canMaximize
width: root.edgeSize
height: root.edgeSize
anchors.left: parent.left
anchors.top: parent.top
cursorShape: Qt.SizeFDiagCursor
onPressed: root.tryStartResize(Qt.LeftEdge | Qt.TopEdge)
}
MouseArea {
visible: root.supported && root.canMaximize
width: root.edgeSize
height: root.edgeSize
anchors.right: parent.right
anchors.top: parent.top
cursorShape: Qt.SizeBDiagCursor
onPressed: root.tryStartResize(Qt.RightEdge | Qt.TopEdge)
}
MouseArea {
visible: root.supported && root.canMaximize
height: root.edgeSize
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: 6
anchors.rightMargin: 6
cursorShape: Qt.SizeVerCursor
onPressed: root.tryStartResize(Qt.BottomEdge)
}
MouseArea {
visible: root.supported && root.canMaximize
width: root.edgeSize
height: root.edgeSize
anchors.left: parent.left
anchors.bottom: parent.bottom
cursorShape: Qt.SizeBDiagCursor
onPressed: root.tryStartResize(Qt.LeftEdge | Qt.BottomEdge)
}
MouseArea {
visible: root.supported && root.canMaximize
width: root.edgeSize
height: root.edgeSize
anchors.right: parent.right
anchors.bottom: parent.bottom
cursorShape: Qt.SizeFDiagCursor
onPressed: root.tryStartResize(Qt.RightEdge | Qt.BottomEdge)
}
}
|