mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat(desktop-widgets): Added a way to move the DesktopSettingsDialog popup by dragging
This commit is contained in:
@@ -136,6 +136,40 @@ Popup {
|
||||
}
|
||||
}
|
||||
|
||||
// Mouse area for a draggable popup
|
||||
MouseArea {
|
||||
x: titleRow.x
|
||||
y: titleRow.y
|
||||
width: titleRow.width
|
||||
height: titleRow.height
|
||||
z: -1
|
||||
|
||||
cursorShape: Qt.OpenHandCursor
|
||||
|
||||
property real pressX: 0
|
||||
property real pressY: 0
|
||||
|
||||
onPressed: (mouse) => {
|
||||
pressX = mouse.x;
|
||||
pressY = mouse.y;
|
||||
cursorShape = Qt.ClosedHandCursor
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
cursorShape = Qt.OpenHandCursor
|
||||
}
|
||||
|
||||
onPositionChanged: (mouse) => {
|
||||
if (pressed) {
|
||||
var deltaX = mouse.x - pressX;
|
||||
var deltaY = mouse.y - pressY;
|
||||
|
||||
root.x += deltaX;
|
||||
root.y += deltaY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: saveTimer
|
||||
running: false
|
||||
|
||||
Reference in New Issue
Block a user