KeyStrokes: Parameter "event" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
-
Hello...
in Qt5 I have used:
Rectangle { id: parentObject anchors.fill: parent focus: true Keys.onPressed: { console.log(event.key + " // " + event.text) } }
which now in Qt6 gives me error:
Parameter "event" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
How this shall be done correctly?
-
Hello...
in Qt5 I have used:
Rectangle { id: parentObject anchors.fill: parent focus: true Keys.onPressed: { console.log(event.key + " // " + event.text) } }
which now in Qt6 gives me error:
Parameter "event" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.
How this shall be done correctly?
-
yea i tried that before, but this does not work at all:
Rectangle { id: parentObject anchors.fill: parent focus: true Keys.onPressed: { event => { console.log(event.key + " /// " + event.text) } } }
@shokarta said in KeyStrokes: Parameter "event" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.:
Keys.onPressed: {
event => {
console.log(event.key + " /// " + event.text)
}
}This is not what was suggested
-
thank you,
this works perfect:
```
Keys.onPressed: event => {
console.log(event.key + " /// " + event.text)
//event.accepted = true
} -
Keys.onPressed: event => { console.log(event.key + " /// " + event.text) }
-
thank you,
this works perfect:
```
Keys.onPressed: event => {
console.log(event.key + " /// " + event.text)
//event.accepted = true
} -
yea i tried that before, but this does not work at all:
Rectangle { id: parentObject anchors.fill: parent focus: true Keys.onPressed: { event => { console.log(event.key + " /// " + event.text) } } }
@shokarta said in KeyStrokes: Parameter "event" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead.:
yea i tried that before, but this does not work at all
But what you chose to type is not what I wrote or quoted from, the idea is to copy what works not change it.
-
F fcarney referenced this topic on