Struct i_slint_core::items::KeyEvent
source · #[repr(C)]pub struct KeyEvent {
pub text: SharedString,
pub modifiers: KeyboardModifiers,
pub repeat: bool,
pub event_type: KeyEventType,
pub replacement_range: Option<Range<i32>>,
pub preedit_text: SharedString,
pub preedit_selection: Option<Range<i32>>,
pub cursor_position: Option<i32>,
pub anchor_position: Option<i32>,
}
Expand description
This structure is generated and passed to the key press and release callbacks of the FocusScope
element.
Fields§
§text: SharedString
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.
event_type: KeyEventType
Indicates whether the key was pressed or released
replacement_range: Option<Range<i32>>
If the event type is KeyEventType::UpdateComposition or KeyEventType::CommitComposition, then this field specifies what part of the current text to replace. Relative to the offset of the pre-edit text within the text input element’s text.
preedit_text: SharedString
If the event type is KeyEventType::UpdateComposition, this is the new pre-edit text
preedit_selection: Option<Range<i32>>
The selection within the preedit_text
cursor_position: Option<i32>
The new cursor position, when None, the cursor is put after the text that was just inserted
anchor_position: Option<i32>
Implementations§
source§impl KeyEvent
impl KeyEvent
sourcepub fn shortcut(&self) -> Option<StandardShortcut>
pub fn shortcut(&self) -> Option<StandardShortcut>
If a shortcut was pressed, this function returns Some(StandardShortcut)
.
Otherwise it returns None.
sourcepub fn text_shortcut(&self) -> Option<TextShortcut>
pub fn text_shortcut(&self) -> Option<TextShortcut>
If a shortcut concerning text editing was pressed, this function
returns Some(TextShortcut)
. Otherwise it returns None.
Trait Implementations§
impl StructuralPartialEq for KeyEvent
Auto Trait Implementations§
impl Freeze for KeyEvent
impl RefUnwindSafe for KeyEvent
impl Send for KeyEvent
impl !Sync for KeyEvent
impl Unpin for KeyEvent
impl UnwindSafe for KeyEvent
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)