slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.93k stars 566 forks source link

LineEdit API Deprecated #2037

Closed saturn77 closed 1 year ago

saturn77 commented 1 year ago

This is a minor issue.

The LineEdit documentation is out of date with the latest API and the LSP / parser in VSCode lets you know.

As an aside, it is possible to set the text color of the text in a LineEdit ? I do not see a property for that.

image

ogoffart commented 1 year ago

Thanks for submitting an issue.

If you look at the warning message, what is deprecated is not the property itself, but it is assigning to a property that is an "output" property.

It is true that this information is not in the documentation. We should generate the documentation automatically ideally. ( https://github.com/slint-ui/slint/issues/793 )

ogoffart commented 1 year ago

To elaborate, the has-focus cannot be set in slint, this has not the effect you would assume. You need to to use the forward-focus property to the component root to tell which widget should have the focus. Or you can call display.focus() to set the focus in a callback handler,

saturn77 commented 1 year ago

Thanks for the explanation here, that is helpful. Will look to use display.focus() in a callback going forward.

ogoffart commented 1 year ago

The current documentation now say that the properties are in or out.