-
Notifications
You must be signed in to change notification settings - Fork 738
compiler: Have a key-sequence
type
#8906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
internal/compiler/builtin_macros.rs
Outdated
| Type::Image | ||
| Type::Easing | ||
| Type::Array(_) | ||
| Type::KeyboardShortcut => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tired to return a String that contains the stringified definition, but that causes infinite recursion... I need to check out why that happens in detail.
/// @keys(ctrl +shift + alt+meta+a) | ||
/// @keys(control +shift + alt+meta+a) | ||
/// ``` | ||
fn parse_keys(p: &mut impl Parser) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should allow ,
separated lists of elements.
The logic to decide on the actual key being uses is also a bit simplistic: We should (in addition?) accept the keys from our Keys
namespace. But So I should probably let all unknown identifiers through here and match them to the Keys namespace (or the single character).
78e44e2
to
7b8e4d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry i haven't took the time to review this before my vacations.
I've had a quick look at it and didn't see anything wrong.
I'm thinking we shouldn't merge this to master (stabilize) unless this is used. Would it be easy to gate this as an experimental feature? (the new type and the @keys
)
} | ||
|
||
#[derive(Clone, Debug, Default)] | ||
pub struct KeyboardModifiers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we already have such a type somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do. But I can not get to it from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have this type in i_slint_core
, but that is not listed in the compiler's Cargo.toml. I did not want to add it, as there is probably a reason for not having that.
I wanted to keep this unmerged for the time being and build on top of this PR. |
7b8e4d0
to
55ab234
Compare
Newest version now accepts keys from the |
55ab234
to
443c344
Compare
... which is lowered to a string for now.
Language Suppord: * Rust: :check: * C++: :fail: * Python: ❓ * JS: ❓
443c344
to
116e72f
Compare
A bit of progress was made:
|
... which is lowered to a string for now.
Add a new type
keyboard-shortcut
, that is parsed from@keys(shift + control + a)
and gets lowered to a string in Rust and C++ and the interpreter for now.