Add a clear-focus()function on all elements that have a focus() function

This is the counter-part, which removes focus from the element if it's currently focused. The window - if focused - may still be focused towards the windowing system.
This commit is contained in:
Simon Hausmann 2024-04-24 16:45:47 +02:00 committed by Simon Hausmann
parent e10e97c944
commit 31767eb6ab
21 changed files with 268 additions and 23 deletions

View file

@ -216,6 +216,7 @@ or it will be mapped to a private unicode character. The mapping of these non-pr
- **`focus()`** Call this function to transfer keyboard focus to this `FocusScope`,
to receive future [`KeyEvent`](structs.md#keyevent)s.
- **`clear-focus()`** Call this function to remove keyboard focus from this `FocusScope` if it currently has the focus.
### Callbacks
@ -680,6 +681,7 @@ When not part of a layout, its width or height defaults to 100% of the parent el
### Functions
- **`focus()`** Call this function to focus the text input and make it receive future keyboard events.
- **`clear-focus()`** Call this function to remove keyboard focus from this `TextInput` if it currently has the focus.
- **`set-selection-offsets(int, int)`** Selects the text between two UTF-8 offsets.
- **`select-all()`** Selects all text.
- **`clear-selection()`** Clears the selection.

View file

@ -19,6 +19,7 @@ a widget able to handle several lines of text.
### Functions
- **`focus()`** Call this function to focus the LineEdit and make it receive future keyboard events.
- **`clear-focus()`** Call this function to remove keyboard focus from this `LineEdit` if it currently has the focus.
- **`set-selection-offsets(int, int)`** Selects the text between two UTF-8 offsets.
- **`select-all()`** Selects all text.
- **`clear-selection()`** Clears the selection.

View file

@ -19,6 +19,7 @@ shortcut will be implemented in a future version: <https://github.com/slint-ui/s
### Functions
- **`focus()`** Call this function to focus the TextEdit and make it receive future keyboard events.
- **`clear-focus()`** Call this function to remove keyboard focus from this `TextEdit` if it currently has the focus.
- **`set-selection-offsets(int, int)`** Selects the text between two UTF-8 offsets.
- **`select-all()`** Selects all text.
- **`clear-selection()`** Clears the selection.