1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
import QtQuick 2.10
Item {
width: 320
height: 200
property string who : "nobody"
Shortcut {
sequence: "Esc"
onActivated: who = "Shortcut"
}
TextEdit {
id: txt
x: 100
text: "enter text"
Keys.onShortcutOverride: {
who = "TextEdit"
event.accepted = (event.key === Qt.Key_Escape)
}
}
Rectangle {
objectName: "rectangle"
width: 90
height: width
focus: true
color: focus ? "red" : "gray"
Keys.onShortcutOverride: {
who = "Rectangle"
event.accepted = (event.key === Qt.Key_Escape)
}
}
}
|