mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
C++ API for KeyEvent.repeat
Add a new dispatch_key_press_repeat_event function to dispatch auto-repeated key events.
This commit is contained in:
parent
82916bc2ec
commit
678c7678e9
3 changed files with 21 additions and 3 deletions
|
@ -329,7 +329,19 @@ public:
|
|||
{
|
||||
private_api::assert_main_thread();
|
||||
cbindgen_private::slint_windowrc_dispatch_key_event(
|
||||
&inner.handle(), cbindgen_private::KeyEventType::KeyPressed, &text);
|
||||
&inner.handle(), cbindgen_private::KeyEventType::KeyPressed, &text, false);
|
||||
}
|
||||
|
||||
/// Dispatch an auto-repeated key press event to the scene.
|
||||
///
|
||||
/// Use this when you're implementing your own backend and want to forward user input events.
|
||||
///
|
||||
/// The \a text is the unicode representation of the key.
|
||||
void dispatch_key_press_repeat_event(const SharedString &text)
|
||||
{
|
||||
private_api::assert_main_thread();
|
||||
cbindgen_private::slint_windowrc_dispatch_key_event(
|
||||
&inner.handle(), cbindgen_private::KeyEventType::KeyPressed, &text, true);
|
||||
}
|
||||
|
||||
/// Dispatch a key release event to the scene.
|
||||
|
@ -341,7 +353,7 @@ public:
|
|||
{
|
||||
private_api::assert_main_thread();
|
||||
cbindgen_private::slint_windowrc_dispatch_key_event(
|
||||
&inner.handle(), cbindgen_private::KeyEventType::KeyReleased, &text);
|
||||
&inner.handle(), cbindgen_private::KeyEventType::KeyReleased, &text, false);
|
||||
}
|
||||
|
||||
/// Dispatches a pointer or mouse press event to the scene.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue