mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
Fix tab/backtab in launchers
This commit is contained in:
@@ -128,6 +128,7 @@ Item {
|
|||||||
enabled: parentModal ? parentModal.spotlightOpen : true
|
enabled: parentModal ? parentModal.spotlightOpen : true
|
||||||
placeholderText: ""
|
placeholderText: ""
|
||||||
ignoreLeftRightKeys: appLauncher.viewMode !== "list"
|
ignoreLeftRightKeys: appLauncher.viewMode !== "list"
|
||||||
|
ignoreTabKeys: true
|
||||||
keyForwardTargets: [spotlightKeyHandler]
|
keyForwardTargets: [spotlightKeyHandler]
|
||||||
text: appLauncher.searchQuery
|
text: appLauncher.searchQuery
|
||||||
onTextEdited: () => {
|
onTextEdited: () => {
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ DankPopout {
|
|||||||
mappings[Qt.Key_Up] = () => appLauncher.selectPrevious()
|
mappings[Qt.Key_Up] = () => appLauncher.selectPrevious()
|
||||||
mappings[Qt.Key_Return] = () => appLauncher.launchSelected()
|
mappings[Qt.Key_Return] = () => appLauncher.launchSelected()
|
||||||
mappings[Qt.Key_Enter] = () => appLauncher.launchSelected()
|
mappings[Qt.Key_Enter] = () => appLauncher.launchSelected()
|
||||||
|
mappings[Qt.Key_Tab] = () => appLauncher.viewMode === "grid" ? appLauncher.selectNextInRow() : appLauncher.selectNext()
|
||||||
|
mappings[Qt.Key_Backtab] = () => appLauncher.viewMode === "grid" ? appLauncher.selectPreviousInRow() : appLauncher.selectPrevious()
|
||||||
|
|
||||||
if (appLauncher.viewMode === "grid") {
|
if (appLauncher.viewMode === "grid") {
|
||||||
mappings[Qt.Key_Right] = () => appLauncher.selectNextInRow()
|
mappings[Qt.Key_Right] = () => appLauncher.selectNextInRow()
|
||||||
@@ -217,6 +219,7 @@ DankPopout {
|
|||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
enabled: appDrawerPopout.shouldBeVisible
|
enabled: appDrawerPopout.shouldBeVisible
|
||||||
ignoreLeftRightKeys: appLauncher.viewMode !== "list"
|
ignoreLeftRightKeys: appLauncher.viewMode !== "list"
|
||||||
|
ignoreTabKeys: true
|
||||||
keyForwardTargets: [keyHandler]
|
keyForwardTargets: [keyHandler]
|
||||||
onTextEdited: {
|
onTextEdited: {
|
||||||
appLauncher.searchQuery = text
|
appLauncher.searchQuery = text
|
||||||
@@ -241,7 +244,7 @@ DankPopout {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const navigationKeys = [Qt.Key_Down, Qt.Key_Up, Qt.Key_Left, Qt.Key_Right]
|
const navigationKeys = [Qt.Key_Down, Qt.Key_Up, Qt.Key_Left, Qt.Key_Right, Qt.Key_Tab, Qt.Key_Backtab]
|
||||||
const isNavigationKey = navigationKeys.includes(event.key)
|
const isNavigationKey = navigationKeys.includes(event.key)
|
||||||
const isEmptyEnter = isEnterKey && !hasText
|
const isEmptyEnter = isEnterKey && !hasText
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ StyledRect {
|
|||||||
property real topPadding: Theme.spacingM
|
property real topPadding: Theme.spacingM
|
||||||
property real bottomPadding: Theme.spacingM
|
property real bottomPadding: Theme.spacingM
|
||||||
property bool ignoreLeftRightKeys: false
|
property bool ignoreLeftRightKeys: false
|
||||||
|
property bool ignoreTabKeys: false
|
||||||
property var keyForwardTargets: []
|
property var keyForwardTargets: []
|
||||||
property Item keyNavigationTab: null
|
property Item keyNavigationTab: null
|
||||||
property Item keyNavigationBacktab: null
|
property Item keyNavigationBacktab: null
|
||||||
@@ -122,10 +123,19 @@ StyledRect {
|
|||||||
if (root.ignoreLeftRightKeys) {
|
if (root.ignoreLeftRightKeys) {
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
} else {
|
} else {
|
||||||
// Allow normal TextInput cursor movement
|
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
if (root.ignoreTabKeys && (event.key === Qt.Key_Tab || event.key === Qt.Key_Backtab)) {
|
||||||
|
event.accepted = false
|
||||||
|
for (var i = 0; i < root.keyForwardTargets.length; i++) {
|
||||||
|
if (root.keyForwardTargets[i]) {
|
||||||
|
root.keyForwardTargets[i].Keys.pressed(event)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
Reference in New Issue
Block a user