mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-05 06:58:40 +00:00
feat: drag move for mac
This commit is contained in:
parent
b0d68c49a8
commit
a46693a931
1 changed files with 22 additions and 2 deletions
|
@ -4,7 +4,7 @@ import QtQuick.Window 2.12
|
||||||
Window {
|
Window {
|
||||||
id: root
|
id: root
|
||||||
visible: true
|
visible: true
|
||||||
flags: Qt.Window | Qt.FramelessWindowHint | Qt.WindowMaximizeButtonHint
|
flags: Qt.Window | Qt.WindowMaximizeButtonHint | (Qt.platform.os == "windows" ? Qt.FramelessWindowHint : 0)
|
||||||
width: 800
|
width: 800
|
||||||
height: 600
|
height: 600
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
@ -36,8 +36,28 @@ Window {
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
DragHandler {
|
DragHandler {
|
||||||
|
// startSystemMove only windows enabled
|
||||||
|
enabled: Qt.platform.os == "windows" ? true : false
|
||||||
grabPermissions: TapHandler.CanTakeOverFromAnything
|
grabPermissions: TapHandler.CanTakeOverFromAnything
|
||||||
onActiveChanged: if (active) {root.startSystemMove(); }
|
onActiveChanged: if (active) {root.startSystemMove(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// drag move for other system
|
||||||
|
MouseArea{
|
||||||
|
property real pressMouseX;
|
||||||
|
property real pressMouseY;
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: Qt.platform.os != "windows" ? true : false
|
||||||
|
|
||||||
|
onPressed: {
|
||||||
|
pressMouseX = mouse.x;
|
||||||
|
pressMouseY = mouse.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
onPositionChanged: {
|
||||||
|
root.x = root.x + (mouse.x - pressMouseX);
|
||||||
|
root.y = root.y + (mouse.y - pressMouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue