Fix shortcut focus issue?
This commit is contained in:
parent
6f7695ad22
commit
af17151c11
|
@ -5,6 +5,7 @@ Popup {
|
||||||
id: popup
|
id: popup
|
||||||
anchors.centerIn: Overlay.overlay
|
anchors.centerIn: Overlay.overlay
|
||||||
modal: true
|
modal: true
|
||||||
|
focus: true
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,16 @@ Item {
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
let shortcut = match(event)
|
let shortcut = match(event)
|
||||||
if (! shortcut) return
|
if (! shortcut) return
|
||||||
|
|
||||||
|
event.accepted = true
|
||||||
event.isAutoRepeat ? shortcut.held(event) : shortcut.pressed(event)
|
event.isAutoRepeat ? shortcut.held(event) : shortcut.pressed(event)
|
||||||
}
|
}
|
||||||
Keys.onReleased: {
|
Keys.onReleased: {
|
||||||
|
if (event.isAutoRepeat) return
|
||||||
let shortcut = match(event)
|
let shortcut = match(event)
|
||||||
|
if (! shortcut) return
|
||||||
|
|
||||||
|
event.accepted = true
|
||||||
if (shortcut && ! event.isAutoRepeat) shortcut.released(event)
|
if (shortcut && ! event.isAutoRepeat) shortcut.released(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@ import "SidePane"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: mainUI
|
id: mainUI
|
||||||
|
focus: true
|
||||||
Component.onCompleted: window.mainUI = mainUI
|
Component.onCompleted: window.mainUI = mainUI
|
||||||
|
Keys.forwardTo: [shortcuts]
|
||||||
|
|
||||||
property alias shortcuts: shortcuts
|
property alias shortcuts: shortcuts
|
||||||
property alias sidePane: sidePane
|
property alias sidePane: sidePane
|
||||||
|
|
|
@ -49,6 +49,7 @@ ApplicationWindow {
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
scale: py.ready ? 1 : 0.5
|
scale: py.ready ? 1 : 0.5
|
||||||
source: py.ready ? (Qt.application.arguments[1] || "UI.qml") : ""
|
source: py.ready ? (Qt.application.arguments[1] || "UI.qml") : ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user