SettingsPanel: added keyboard navigation (Tab, Vim, Up/Down) to change active tab.
This commit is contained in:
parent
b00f058eac
commit
be1643c5b8
1 changed files with 52 additions and 0 deletions
|
|
@ -217,11 +217,63 @@ NPanel {
|
||||||
root.currentTabIndex = initialIndex
|
root.currentTabIndex = initialIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add navigation functions
|
||||||
|
function selectNextTab() {
|
||||||
|
if (tabsModel.length > 0) {
|
||||||
|
currentTabIndex = (currentTabIndex + 1) % tabsModel.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectPreviousTab() {
|
||||||
|
if (tabsModel.length > 0) {
|
||||||
|
currentTabIndex = (currentTabIndex - 1 + tabsModel.length) % tabsModel.length
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
panelContent: Rectangle {
|
panelContent: Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginL * scaling
|
anchors.margins: Style.marginL * scaling
|
||||||
color: Color.transparent
|
color: Color.transparent
|
||||||
|
|
||||||
|
// Add shortcuts at the panel level
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Ctrl+J"
|
||||||
|
onActivated: root.selectNextTab()
|
||||||
|
enabled: root.opened
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Ctrl+K"
|
||||||
|
onActivated: root.selectPreviousTab()
|
||||||
|
enabled: root.opened
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional: Add more navigation shortcuts
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Down"
|
||||||
|
onActivated: root.selectNextTab()
|
||||||
|
enabled: root.opened
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Up"
|
||||||
|
onActivated: root.selectPreviousTab()
|
||||||
|
enabled: root.opened
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional: Tab/Shift+Tab navigation
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Tab"
|
||||||
|
onActivated: root.selectNextTab()
|
||||||
|
enabled: root.opened
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Shift+Tab"
|
||||||
|
onActivated: root.selectPreviousTab()
|
||||||
|
enabled: root.opened
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue