Qt 6.12 LTS is out! See what's new in the release
blog
QML - detecting "key combinations"
QML and Qt Quick
5
Posts
2
Posters
3.9k
Views
1
Watching
-
Hello, I'm trying to detect a key combination - for example when the user presses the right arrow + enter.
At the moment I've looked at the docs and seen how to do it with event modifiers but that doesn't offer the key combination that I'd like
What I have at the moment:
@
if(event.key===Qt.Key_Return && (event.modifiers & Qt.ShiftModifier)){
//code
}@Thanks in advance for any help anyone can offer to point me in the right direction!
-
You can try moving this code to C++ and using QKeySequence class.
-
I'll look in to this, thank you! Is there no way to do it in QML/JS?
-
I don't know, probably not. The issue I had was slightly different and I remember that the QKeySequence was the only way I found.
-
Alright! Thanks a lot for your help.