Key Handling Overview
To handle keyboard input in Slint, use the FocusScope or individual key-pressed and key-released callbacks in various elements. Keyboard
input is delivered via KeyEvent data structures. The primary field of this data structure is the text property, which holds all affected keys
encoded in a string. Use the Key namespace to identify known named keys.
KeyEvent
Section titled “KeyEvent”This structure is generated and passed to the key press and release callbacks of the FocusScope element.
text(string): The unicode representation of the key pressed.modifiers(KeyboardModifiers): The keyboard modifiers active at the time of the key press event.repeat(bool): This field is set to true for key press events that are repeated, i.e. the key is held down. It’s always false for key release events.
Key Namespace
Section titled “Key Namespace”Use the constants in the Key namespace to handle pressing of keys that don’t have a printable character.
BackspaceTabReturnEscapeBacktabDeleteShiftControlAltAltGrCapsLockShiftRControlRMetaMetaRSpaceUpArrowDownArrowLeftArrowRightArrowF1F2F3F4F5F6F7F8F9F10F11F12F13F14F15F16F17F18F19F20F21F22F23F24InsertHomeEndPageUpPageDownScrollLockPauseSysReqStopMenu
© 2025 SixtyFPS GmbH