Class Keys¶
Defined in File slint_keys.h
Class Documentation¶
-
class Keys¶
A
Keysis created by the @keys(…) macro in Slint and defines which key event(s) activate a KeyBinding.Public Functions
-
Keys() = default¶
Returns an empty
keysinstance, which never matches any key event.
-
inline SharedString to_string() const¶
Returns a string that looks native on the current platform.
For example, the shortcut created with @keys(Meta + Control + A) will be converted like this:
macOS:
⌃⌘AWindows:
Win+Ctrl+ALinux:
Super+Ctrl+A
Note that this functions output is best-effort and may be adjusted/improved at any time, do not rely on this output to be stable!
Public Static Functions
-
static inline std::optional<Keys> from_parts(std::span<const std::string_view> parts)¶
Create a
Keysfrom a span of string parts, e.g.{"Control", "Shift?", "Z"}.Each element is either a modifier (
Control,Shift,Alt,Meta,Shift?,Alt?) or a key name from the Key namespace (case-sensitive). If not found, it is treated as a string literal (must be a single lowercase grapheme cluster).Returns
std::nullopton parse failure.
-
Keys() = default¶