This patch merges the changes from #2344 and #2491 and do some cleanup
In particular, this visit the init code expression when visiting the
root element expression
Closes#2344Closes#2491Fixes#2487
* Add "slintpad" to cspell white list for all languages
* Mention online_editor to slintpad rename in CHANGELOG
* Move tools/online_editor into tools/slintpad
* Update github actions accordingly
Co-authored-by: Olivier Goffart <olivier@woboq.com>
If one declare a `property <int> foo;` in Slint, it will be private by
default, and the getter/setter won't be generated, and it may be
confusing as to why
With this change, it still generate private getter and setter so this
gives a better hint to the developer what the problem is.
Replaces #2170
- Don't publicly inherit from Rectangle - let's keep that as an
implementation detail
- Provide a minimum height for the image, to avoid that it becomes
invisible (for example in `export component Example { VerticalLayout { AboutSlint { } } }`
We cast the result of the body of functions or binding expressions to
the target type via `as _`. When the code contains a return expression,
that works fine, because `return`'s type is the never type, which can be
coerced to a value of any type. However when the return statement is
inside a sub-block, the type becomes `()`, for which the `as _` cast
fails.
Work around this by attempting to detect the situation (return produces
Type::Invalid) and omit the trailing cast.
This disabled about 70 clippy warnings like this one:
```
warning: redundant clone
--> target\debug\build\energy-monitor-7b0492feb1633656\out\desktop_window.rs:44279:37
|
44279 | (if (((r#state . clone ()) . r#previous_state as f64) == (1f64 as f64)) {
| ^^^^^^^^^^^ help: remove this
|
note: cloned value is neither consumed nor mutated
--> target\debug\build\energy-monitor-7b0492feb1633656\out\desktop_window.rs:44279:28
|
44279 | (if (((r#state . clone ()) . r#previous_state as f64) == (1f64 as f64)) {
| ^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
```
I get the following clippy errors in the energy monitor:
error: equal expressions as operands to `-`
--> C:\src\slint\target\debug\build\energy-monitor-7b0492feb1633656\out\desktop_window.rs:47254:94
|
47254 | ... (slint :: private_unstable_api :: re_exports :: LogicalLength :: new (((((0f64 as f64) - (0f64 as f64)) as f64) * (((1f64 as f64) *...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
error: equal expressions as operands to `==`
--> C:\src\slint\target\debug\build\energy-monitor-7b0492feb1633656\out\desktop_window.rs:45382:18
|
45382 | (((0f64 as f64) == (0f64 as f64))) as bool }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
I am not surprised that the generated code sometimes produces code like
this (even though the other demos do not!), so I went ahead and silenced
these errors.
States are never constant because the generated state binding depend on
the time as it register the time it was set for the pottential animation
Also adjust the assert so it assert correctly which the right message
Fixes: #2274
The logic was inverted: Setting to true should embed everything, while
false should be the same as if it's not set: Only embed built-in
resources (as always).
An element with children must be fully inlined or the children array
can't be easily computed.
But the code wouldn't work if the base of a component was not inlined
Just like opacity and other properties, it needs to prevent inlining.
And also add the same warning as for opacity if it is used on the root
(the Window)