Class Keys

Class Documentation

class Keys

A Keys is created by the @keys(…) macro in Slint and defines which key event(s) activate a KeyBinding.

Public Functions

Keys() = default

Returns an empty keys instance, which never matches any key event.

Keys(const Keys&) = default

Copy constructor.

Keys(Keys&&) = default

Move constructor.

slint::Keys &operator=(const Keys&) = default

Copy assignment operator.

slint::Keys &operator=(Keys&&) = default

Move assignment operator.

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: ⌃⌘A

  • Windows: Win+Ctrl+A

  • Linux: 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!

Friends

inline friend bool operator==(const Keys &a, const Keys &b)

Equality operator, returns true if the two Keys instances are equal, i.e. they match the same key events.

inline friend bool operator!=(const Keys &a, const Keys &b)

Inequality operator, returns true if the two Keys instances are not equal, i.e. they match different key events.