* 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)
The operator== reference the struct name, so if there is a
field with the same name, we should disambiguate
Fix tests/cases/issues/name_conflicts.slint that was added in last
commit
As outlined in #2199, there may be ways to trigger text layout code
through forward-focus before embedded fonts are registered. To fix this,
this patch replaces the init_code vector, which had the SetFocusItem
code before the font registration, with three explicit vectors for focus
setup code, code from init callbacks, and initial focus, and defines the
order in one central place in the copmiler (iter()).
Fixes#2199
The const detection for two way binding was not detecting change if one
of the property was set to a const value in a component using it.
This would cause the compiler to generate call set_content on one of the
property in a two way bindings, and later, the "const sentinel" be
present in the dependency list, causing crash.
To avoid segfault for similar bug in the future, added added an assert!
in the property system to detect that.
Fixes#2185