From fedec450cb38693d71fa879d1144ca61247a57cb Mon Sep 17 00:00:00 2001 From: bbedward Date: Fri, 3 Oct 2025 17:16:34 -0400 Subject: [PATCH] Keep the modal, but relatively positioned --- Modals/PowerMenuModal.qml | 10 ++++++++++ Modules/ControlCenter/ControlCenterPopout.qml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Modals/PowerMenuModal.qml b/Modals/PowerMenuModal.qml index 66418c3e..e6846965 100644 --- a/Modals/PowerMenuModal.qml +++ b/Modals/PowerMenuModal.qml @@ -9,6 +9,7 @@ DankModal { property int selectedIndex: 0 property int optionCount: SessionService.hibernateSupported ? 5 : 4 + property rect parentBounds: Qt.rect(0, 0, 0, 0) signal powerActionRequested(string action, string title, string message) @@ -47,6 +48,15 @@ DankModal { width: 320 height: contentLoader.item ? contentLoader.item.implicitHeight : 300 enableShadow: true + positioning: parentBounds.width > 0 ? "custom" : "center" + customPosition: { + if (parentBounds.width > 0) { + const centerX = parentBounds.x + (parentBounds.width - width) / 2 + const centerY = parentBounds.y + (parentBounds.height - height) / 2 + return Qt.point(centerX, centerY) + } + return Qt.point(0, 0) + } onBackgroundClicked: () => { return close(); } diff --git a/Modules/ControlCenter/ControlCenterPopout.qml b/Modules/ControlCenter/ControlCenterPopout.qml index 6de41227..951d56fb 100644 --- a/Modules/ControlCenter/ControlCenterPopout.qml +++ b/Modules/ControlCenter/ControlCenterPopout.qml @@ -126,6 +126,8 @@ DankPopout { if (powerMenuModalLoader) { powerMenuModalLoader.active = true if (powerMenuModalLoader.item) { + const globalPos = controlContent.mapToGlobal(0, 0) + powerMenuModalLoader.item.parentBounds = Qt.rect(globalPos.x, globalPos.y, controlContent.width, controlContent.height) powerMenuModalLoader.item.open() } }