Skip to content
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

Make out properties public to the native language #6967

Open
LeonMatthesKDAB opened this issue Dec 2, 2024 · 2 comments
Open

Make out properties public to the native language #6967

LeonMatthesKDAB opened this issue Dec 2, 2024 · 2 comments
Labels
a:language-rust Rust API and codegen (mO,mS) enhancement New feature or request

Comments

@LeonMatthesKDAB
Copy link

Feature Description

@ogoffart @tronical this issue was one of the "low hanging fruits" we identified in our recent chat.
Again, let me know if I misunderstood anything.

When implement the backend for a given component or global, it would be quite useful to have access to the out properties of the slint component from the native backend.
To quote the docs:

out: An output property that can only be set by the component. It’s read-only for the users of the components.

In my opinion, a native backend that is tightly coupled to a global (or once #2031 is implemented a component), should count as "part of the component" as far as .slint code is concerned.
The backend should be able to entirely drive the properties from native code.
By marking them as out, instead of in-out, the properties are protected from accidental overwrites in other slint code.
This ensures that the native backend always has control over the property content.

However, at the moment this is not possible, as an out property does not have a setter in native code.
Simply generating the setter for out properties would solve the issue.

Product Impact

No response

@LeonMatthesKDAB LeonMatthesKDAB added enhancement New feature or request need triaging Issue that the owner of the area still need to triage labels Dec 2, 2024
@tronical tronical added a:language-rust Rust API and codegen (mO,mS) and removed need triaging Issue that the owner of the area still need to triage labels Dec 5, 2024
@tronical
Copy link
Member

tronical commented Dec 5, 2024

So this only affects exported components/globals, for which we'd make out properties accessible via the API.

@LeonMatthesKDAB
Copy link
Author

LeonMatthesKDAB commented Dec 5, 2024

Yes, this should not include any changes for the slint language itself, only for the API generated in the native language.
(Which of course is only generated for exported components/globals)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:language-rust Rust API and codegen (mO,mS) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants