Power menu is out of SidePanel
This commit is contained in:
parent
a91c0978c0
commit
1fc717f354
1 changed files with 13 additions and 64 deletions
|
|
@ -10,45 +10,23 @@ import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
import qs.Modules.LockScreen
|
import qs.Modules.LockScreen
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
|
|
||||||
|
NPanel {
|
||||||
id: root
|
id: root
|
||||||
readonly property real scaling: ScalingService.scale(screen)
|
|
||||||
|
panelWidth: 500 * scaling
|
||||||
|
panelHeight: 300 * scaling
|
||||||
|
panelAnchorCentered: true
|
||||||
|
|
||||||
|
|
||||||
anchors.top: true
|
property var entriesCount: 5
|
||||||
anchors.left: true
|
property var entryHeight: Style.baseWidgetSize * scaling
|
||||||
anchors.right: true
|
|
||||||
anchors.bottom: true
|
|
||||||
visible: false
|
|
||||||
color: "#3300FF00"
|
|
||||||
screen: screen
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
panelContent: Rectangle {
|
||||||
if (visible) {
|
color: Color.transparent
|
||||||
console.log("Oh Yeah")
|
|
||||||
// Focus the menu rectangle instead of root
|
|
||||||
menuRect.forceActiveFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function open() {
|
// ----------------------------------
|
||||||
visible = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function close() {
|
|
||||||
visible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// // Clicking outside of the rectangle to close
|
|
||||||
// MouseArea {
|
|
||||||
// anchors.fill: parent
|
|
||||||
// onClicked: root.close()
|
|
||||||
// // Prevent this MouseArea from interfering with child elements
|
|
||||||
// propagateComposedEvents: true
|
|
||||||
// z: -1 // Put it behind the menu
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ----------------------------------
|
|
||||||
// System functions
|
// System functions
|
||||||
function logout() {
|
function logout() {
|
||||||
CompositorService.logout()
|
CompositorService.logout()
|
||||||
|
|
@ -90,34 +68,6 @@ PanelWindow {
|
||||||
running: false
|
running: false
|
||||||
}
|
}
|
||||||
|
|
||||||
property var entriesCount: 5
|
|
||||||
property var entryHeight: Style.baseWidgetSize * scaling
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: menuRect
|
|
||||||
width: 160 * scaling
|
|
||||||
height: (entryHeight * entriesCount) + (Style.marginS * entriesCount * scaling)
|
|
||||||
radius: Style.radiusM * scaling
|
|
||||||
border.color: Color.mOutline
|
|
||||||
border.width: Math.max(1, Style.borderS * scaling)
|
|
||||||
color: Color.mSurface
|
|
||||||
visible: true
|
|
||||||
z: 9999
|
|
||||||
|
|
||||||
// Add focus properties
|
|
||||||
focus: true
|
|
||||||
activeFocusOnTab: true
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Style.marginL * scaling
|
|
||||||
anchors.topMargin: 86 * scaling
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
console.log("oncompleted")
|
|
||||||
forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginS * scaling
|
anchors.margins: Style.marginS * scaling
|
||||||
|
|
@ -172,9 +122,8 @@ PanelWindow {
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Logger.log("PowerMenu", "Lock screen requested")
|
// Lock the screen
|
||||||
// // Lock the screen
|
lockScreen.isLoaded = true
|
||||||
// lockScreen.isLoaded = true
|
|
||||||
root.close()
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue