Verified Commit d0dd5044 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

applets/timer: add keyboard navigation support in TimerEdit

parent ba011368
Pipeline #213607 passed with stage
in 3 minutes and 14 seconds
......@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.5
import QtQuick 2.15
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
......@@ -38,9 +38,41 @@ Row {
readonly property int mouseWheelAngleThreshold: 5
width: internal.digitW
height: internal.digitH
activeFocusOnTab: true
svg: timerSvg
elementId: num + internal.digitSuffix
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Return:
case Qt.Key_Enter:
case Qt.Key_Space:
case Qt.Key_Select:
root.toggleTimer();
break;
case Qt.Key_Up:
if (value + meaning < 24*60*60) {
timerEdit.digitModified(meaning)
}
break;
case Qt.Key_Down:
if (value - meaning >= 0) {
timerEdit.digitModified(-meaning)
}
break;
case Qt.Key_Left:
nextItemInFocusChain(false).forceActiveFocus(Qt.BacktabFocusReason);
break;
case Qt.Key_Right:
nextItemInFocusChain(true).forceActiveFocus(Qt.TabFocusReason);
break;
default:
return;
}
event.accepted = true;
}
MouseArea {
anchors.fill: parent
enabled: editable
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment