mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 15:32:50 -05:00
Update more sidebar settings nav
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Modals.Settings
|
||||
import qs.Widgets
|
||||
|
||||
FocusScope {
|
||||
Rectangle {
|
||||
id: sidebarContainer
|
||||
|
||||
property int currentIndex: 0
|
||||
property var parentModal: null
|
||||
|
||||
activeFocusOnTab: true
|
||||
readonly property var sidebarItems: [{
|
||||
"text": I18n.tr("Personalization"),
|
||||
"icon": "person"
|
||||
@@ -55,56 +55,8 @@ FocusScope {
|
||||
|
||||
width: 270
|
||||
height: parent.height
|
||||
|
||||
Component.onCompleted: {
|
||||
forceActiveFocus()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: refocusTimer
|
||||
interval: 50
|
||||
onTriggered: sidebarContainer.forceActiveFocus()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: parentModal
|
||||
function onOpened() {
|
||||
refocusTimer.restart()
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onPressed: event => {
|
||||
if (event.key === Qt.Key_Down) {
|
||||
navigateNext()
|
||||
Qt.callLater(() => sidebarContainer.forceActiveFocus())
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Up) {
|
||||
navigatePrevious()
|
||||
Qt.callLater(() => sidebarContainer.forceActiveFocus())
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Tab && !event.modifiers) {
|
||||
navigateNext()
|
||||
Qt.callLater(() => sidebarContainer.forceActiveFocus())
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Backtab || (event.key === Qt.Key_Tab && event.modifiers & Qt.ShiftModifier)) {
|
||||
navigatePrevious()
|
||||
Qt.callLater(() => sidebarContainer.forceActiveFocus())
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.surfaceContainer
|
||||
radius: Theme.cornerRadius
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: mouse => {
|
||||
sidebarContainer.forceActiveFocus()
|
||||
mouse.accepted = false
|
||||
}
|
||||
}
|
||||
color: Theme.surfaceContainer
|
||||
radius: Theme.cornerRadius
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
@@ -135,7 +87,10 @@ FocusScope {
|
||||
|
||||
model: sidebarContainer.sidebarItems
|
||||
|
||||
Rectangle {
|
||||
delegate: Rectangle {
|
||||
required property int index
|
||||
required property var modelData
|
||||
|
||||
property bool isActive: sidebarContainer.currentIndex === index
|
||||
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
@@ -191,6 +146,4 @@ FocusScope {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user