mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/halcyon: Fix list highlight within folder
This commit is contained in:
parent
c6ec8606c5
commit
2603f461e6
1 changed files with 39 additions and 38 deletions
|
|
@ -1,12 +1,13 @@
|
|||
// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick as QQ
|
||||
import QtQuick
|
||||
|
||||
import org.kde.plasma.extras as PlasmaExtras
|
||||
|
||||
QQ.GridView {
|
||||
GridView {
|
||||
id: root
|
||||
currentIndex: -1
|
||||
|
||||
maximumFlickVelocity: 5000
|
||||
|
||||
|
|
@ -20,42 +21,42 @@ QQ.GridView {
|
|||
property var leftEdgeCallback: null
|
||||
property var rightEdgeCallback: null
|
||||
|
||||
QQ.Keys.onPressed: event => {
|
||||
if (!currentItem) {
|
||||
return;
|
||||
}
|
||||
Keys.onPressed: event => {
|
||||
if (!currentItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(event.key){
|
||||
case Qt.Key_Left: {
|
||||
if (currentItem.x === 0
|
||||
&& leftEdgeCallback) {
|
||||
leftEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt.Key_Right: {
|
||||
if (indexAt(currentItem.x + cellWidth, currentItem.y) === -1
|
||||
&& rightEdgeCallback) {
|
||||
rightEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt.Key_Up: {
|
||||
if (currentItem.y === 0
|
||||
&& topEdgeCallback) {
|
||||
topEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt.Key_Down: {
|
||||
if (indexAt(currentItem.x, currentItem.y + cellHeight) === -1
|
||||
&& bottomEdgeCallback) {
|
||||
bottomEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(event.key) {
|
||||
case Qt.Key_Left: {
|
||||
if (currentItem.x === 0
|
||||
&& leftEdgeCallback) {
|
||||
leftEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt.Key_Right: {
|
||||
if (indexAt(currentItem.x + cellWidth, currentItem.y) === -1
|
||||
&& rightEdgeCallback) {
|
||||
rightEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt.Key_Up: {
|
||||
if (currentItem.y === 0
|
||||
&& topEdgeCallback) {
|
||||
topEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt.Key_Down: {
|
||||
if (indexAt(currentItem.x, currentItem.y + cellHeight) === -1
|
||||
&& bottomEdgeCallback) {
|
||||
bottomEdgeCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onActiveFocusChanged: {
|
||||
if (!activeFocus) {
|
||||
|
|
@ -69,7 +70,7 @@ QQ.GridView {
|
|||
}
|
||||
}
|
||||
|
||||
QQ.Component {
|
||||
Component {
|
||||
id: highlightComponent
|
||||
|
||||
PlasmaExtras.Highlight {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue