1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

refactor: mega refactoring of a bunch of things

This commit is contained in:
bbedward
2025-07-23 11:56:18 -04:00
parent 14eef59c9f
commit 19adcf3578
52 changed files with 4260 additions and 3879 deletions

View File

@@ -19,6 +19,12 @@ Rectangle {
height: 60
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)
// Global keyboard handler for escape key
Keys.onEscapePressed: {
if (dropdownMenu.visible)
dropdownMenu.visible = false;
}
Column {
anchors.left: parent.left
@@ -43,11 +49,12 @@ Rectangle {
wrapMode: Text.WordWrap
width: parent.width
}
}
Rectangle {
id: dropdown
width: 180
height: 36
anchors.right: parent.right
@@ -80,10 +87,12 @@ Rectangle {
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
id: dropdownArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
@@ -97,34 +106,35 @@ Rectangle {
}
}
}
}
// Integrated dropdown menu with full-screen overlay
PanelWindow {
id: dropdownMenu
property int targetX: 0
property int targetY: 0
function updatePosition() {
var globalPos = dropdown.mapToGlobal(0, 0);
targetX = globalPos.x;
targetY = globalPos.y + dropdown.height + 4;
}
visible: false
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
color: "transparent"
anchors {
top: true
left: true
right: true
bottom: true
}
color: "transparent"
function updatePosition() {
var globalPos = dropdown.mapToGlobal(0, 0);
targetX = globalPos.x;
targetY = globalPos.y + dropdown.height + 4;
}
// Background click interceptor (invisible)
MouseArea {
anchors.fill: parent
@@ -133,7 +143,7 @@ Rectangle {
dropdownMenu.visible = false;
}
}
// Dropdown menu content
Rectangle {
x: dropdownMenu.targetX
@@ -141,25 +151,25 @@ Rectangle {
width: 180
height: Math.min(200, root.options.length * 36 + 16)
radius: Theme.cornerRadiusSmall
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 1.0)
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 1)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3)
border.width: 1
ScrollView {
anchors.fill: parent
anchors.margins: Theme.spacingS
clip: true
ListView {
model: root.options
spacing: 2
delegate: Rectangle {
width: ListView.view.width
height: 32
radius: Theme.cornerRadiusSmall
color: optionArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
Text {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
@@ -169,9 +179,10 @@ Rectangle {
color: root.currentValue === modelData ? Theme.primary : Theme.surfaceText
font.weight: root.currentValue === modelData ? Font.Medium : Font.Normal
}
MouseArea {
id: optionArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
@@ -181,16 +192,15 @@ Rectangle {
dropdownMenu.visible = false;
}
}
}
}
}
}
}
// Global keyboard handler for escape key
Keys.onEscapePressed: {
if (dropdownMenu.visible) {
dropdownMenu.visible = false;
}
}
}
}