Fix homescreen includes, accessibility, and popup clamp

Remove duplicate KService include in favouritesmodel.cpp. Add
keyboard navigation and accessibility role to CategoryPanel
tiles. Clamp the FavouritesBar thumbnail popup position to
screen bounds so it does not overflow offscreen on edge items.
This commit is contained in:
Marco Allegretti 2026-04-18 20:25:05 +02:00
parent acecbcc86a
commit 9bf7b70d2b
3 changed files with 21 additions and 3 deletions

View file

@ -4,7 +4,6 @@
#include "favouritesmodel.h" #include "favouritesmodel.h"
#include "homescreenstate.h" #include "homescreenstate.h"
#include <KService>
#include <QByteArray> #include <QByteArray>
#include <QDebug> #include <QDebug>
#include <QJsonArray> #include <QJsonArray>

View file

@ -179,7 +179,26 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
activeFocusOnTab: true
onClicked: root.categorySelected(tile.catId) onClicked: root.categorySelected(tile.catId)
Keys.onPressed: (event) => {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space) {
root.categorySelected(tile.catId);
event.accepted = true;
}
}
Accessible.role: Accessible.Button
Accessible.name: tile.catName
Rectangle {
anchors.fill: parent
color: "transparent"
border.color: Kirigami.Theme.highlightColor
border.width: tileArea.activeFocus ? 2 : 0
radius: parent.parent.radius
}
} }
} }
} }

View file

@ -642,12 +642,12 @@ MouseArea {
x: { x: {
if (!targetDelegate) return 0 if (!targetDelegate) return 0
var delegateGlobal = targetDelegate.mapToGlobal(0, 0) var delegateGlobal = targetDelegate.mapToGlobal(0, 0)
return Math.max(0, delegateGlobal.x + (targetDelegate.width - width) / 2) return Math.max(0, Math.min(Screen.width - width, delegateGlobal.x + (targetDelegate.width - width) / 2))
} }
y: { y: {
if (!targetDelegate) return 0 if (!targetDelegate) return 0
var delegateGlobal = targetDelegate.mapToGlobal(0, 0) var delegateGlobal = targetDelegate.mapToGlobal(0, 0)
return delegateGlobal.y - height - Kirigami.Units.smallSpacing return Math.max(0, Math.min(Screen.height - height, delegateGlobal.y - height - Kirigami.Units.smallSpacing))
} }
onVisibleChanged: { onVisibleChanged: {