Add FocusEventReason to FocusEvent and add a select all on keyboard focus for TextInput (#8523)

Closes #5992

Adds the enum FocusEventReason and makes it an argument for FocusEvent. This reason could eventually be exposed in Slint to solve #8387.

Using the focus reason tracking, I also added a select all on keyboard focus for TextInputs (except on macOS), which should close #5992.

ChangeLog: TextInput selects its content when focused with the keyboard on Windows and Linux
This commit is contained in:
Avery Townsend 2025-05-27 01:56:13 -04:00 committed by GitHub
parent 370f72a15d
commit c41d4a4df3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 225 additions and 86 deletions

View file

@ -135,10 +135,11 @@ public:
items, &inner);
}
void set_focus_item(const ItemTreeRc &component_rc, uint32_t item_index, bool set_focus)
void set_focus_item(const ItemTreeRc &component_rc, uint32_t item_index, bool set_focus,
cbindgen_private::FocusEventReason reason)
{
cbindgen_private::ItemRc item_rc { component_rc, item_index };
cbindgen_private::slint_windowrc_set_focus_item(&inner, &item_rc, set_focus);
cbindgen_private::slint_windowrc_set_focus_item(&inner, &item_rc, set_focus, reason);
}
void set_component(const cbindgen_private::ItemTreeWeak &weak) const