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

better fuzzy search, sweeping clean and qmlfmt of Widgets

This commit is contained in:
bbedward
2025-09-03 12:52:03 -04:00
parent 886c6877d5
commit d4db8a01fe
50 changed files with 2112 additions and 2010 deletions

View File

@@ -69,11 +69,8 @@ PanelWindow {
anchors.fill: parent
enabled: shouldBeVisible
onClicked: mouse => {
var localPos = mapToItem(contentContainer,
mouse.x, mouse.y)
if (localPos.x < 0 || localPos.x > contentContainer.width
|| localPos.y < 0
|| localPos.y > contentContainer.height) {
var localPos = mapToItem(contentContainer, mouse.x, mouse.y)
if (localPos.x < 0 || localPos.x > contentContainer.width || localPos.y < 0 || localPos.y > contentContainer.height) {
backgroundClicked()
close()
}
@@ -88,23 +85,11 @@ PanelWindow {
readonly property real calculatedX: {
if (positioning === "center") {
var centerX = triggerX + (triggerWidth / 2) - (popupWidth / 2)
if (centerX >= Theme.spacingM
&& centerX + popupWidth <= screenWidth - Theme.spacingM)
return centerX
if (centerX < Theme.spacingM)
return Theme.spacingM
if (centerX + popupWidth > screenWidth - Theme.spacingM)
return screenWidth - popupWidth - Theme.spacingM
return centerX
return Math.max(Theme.spacingM, Math.min(screenWidth - popupWidth - Theme.spacingM, centerX))
} else if (positioning === "left") {
return Math.max(Theme.spacingM, triggerX)
} else if (positioning === "right") {
return Math.min(screenWidth - popupWidth - Theme.spacingM,
triggerX + triggerWidth - popupWidth)
return Math.min(screenWidth - popupWidth - Theme.spacingM, triggerX + triggerWidth - popupWidth)
}
return triggerX
}
@@ -141,25 +126,15 @@ PanelWindow {
Item {
anchors.fill: parent
focus: true
Keys.onPressed: event => {
if (event.key === Qt.Key_Escape) {
close()
event.accepted = true
} else {
event.accepted = false
}
}
Component.onCompleted: {
forceActiveFocus()
}
onVisibleChanged: {
if (visible) {
forceActiveFocus()
}
}
if (event.key === Qt.Key_Escape) {
close()
event.accepted = true
}
}
Component.onCompleted: forceActiveFocus()
onVisibleChanged: if (visible)
forceActiveFocus()
}
}
}