wallpaper selector: not reinvent MouseArea containsMouse

This commit is contained in:
end-4
2025-08-24 16:12:37 +07:00
parent 8277a2d942
commit ef4ae4480f
2 changed files with 11 additions and 30 deletions
@@ -10,12 +10,11 @@ import Qt5Compat.GraphicalEffects
import Quickshell
import Quickshell.Io
Item {
MouseArea {
id: root
required property var fileModelData
property bool isDirectory: fileModelData.fileIsDir
property bool useThumbnail: Images.isValidImageByName(fileModelData.fileName)
property bool isHovered: false
property alias colBackground: background.color
property alias colText: wallpaperItemName.color
@@ -24,6 +23,9 @@ Item {
signal activated
hoverEnabled: true
onClicked: root.activated()
Rectangle {
id: background
anchors {
@@ -130,23 +132,4 @@ Item {
}
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
for (let i = 0; i < grid.count; i++) {
const item = grid.itemAtIndex(i);
if (item && item !== parent) {
item.isHovered = false;
}
}
parent.isHovered = true;
grid.currentIndex = index;
}
onExited: {
parent.isHovered = false;
}
onClicked: root.activated()
}
}