How to prevent using key sequences in TextArea
-
Hello, everyone! Now, I'd like to prevent users from using Ctrl+Z in TextArea and I'm doing like this:
TextArea{
Keys.onPressed: {
if(event.matches(StandardKey.Undo)){
event.accepted = false
console.log("prevent undo:")
}
}
}
Although I've received "prevent undo" in the console, the key sequences still works. Does anyone know the answer ? Thanks in advance. -
Hello, everyone! Now, I'd like to prevent users from using Ctrl+Z in TextArea and I'm doing like this:
TextArea{
Keys.onPressed: {
if(event.matches(StandardKey.Undo)){
event.accepted = false
console.log("prevent undo:")
}
}
}
Although I've received "prevent undo" in the console, the key sequences still works. Does anyone know the answer ? Thanks in advance.@AlexChris said in How to prevent using key sequences in TextArea:
event.accepted = false
Shouldn't you set it to true to signal that you want to process it on your own without propagating it further?