The call to load the image already prints a message to stderr, so don't
panic but return a null image instead - neither when calling load_from_path
nor when decoding embedded image data.
cc #4846
Semi-random selection of clippy topics that were
uncontroversial before:-).
Leaves about 84 deduplicated issues in the code base
according to clippy from nightly.
As per API review:
- In the Rust and C++ API we use `set_nine_slice_edges` because the getter couldn't start with 9
- in english we spell number less than 10 with letters and this is a name
Slpit up `lookup_type_for_child_elemnt` (in the compiler) into the
part that looks at the element itself only (called `accepts_child_element`)
and the part that looks at the child.
When deciding whether we can drop something into another element in
the live preview, we know the child type is going to be OK, even when
the `TypeRegister` does not contain it yet (as it is not imported yet).
Fixes#4741
This commit move the property_binding_and_analysis from the inlining
pass to an associated funciton in the context.
Then re-use that from the rust and c++ generator to actually get the
right animation
Refactor the code in the compiler a bit to allow using the
`TypeLoader` for the root document itself and use that in the
interpreter.
You need to run passes *before* the `TypeLoader` takes ownership
of the Document, so the `load_file` in `TypeLoader` needed a bit of
changing.
This enables us to find all layouts e.g. in
```slint
component MyLayout inherits GridLayout { @children }
component FooBar {
my-layout := MyLayout {
Rectangle {
}
}
}
```
As requested in #1462, I've added a `flicked`-Callback that gets
triggered when the `viewport_x`- or `viewport_y` -Properties are changed
by a mouse drag or mouse wheel movement.
The problem is that we were taking the whole `repeated` field and as a
result we wouldn't see that the element was being repeated and that we
shouldn't have to lookup id within it
Fix#4683
```
error: casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused
--> internal/core/item_tree.rs:1035:32
|
1035 | Pin::new_unchecked(&*(&**component as *const Dyn as *const u8)),
| ^^^^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| backing allocation comes from here
|
= note: casting from `vtable::Dyn` (0 bytes) to `u8` (1 bytes)
= note: `#[deny(invalid_reference_casting)]` on by default
```
Since commit 6fefe75a1c the handling
of forward-focus bindings happens before the resolve_expressions pass,
which means that we cannot rely on type mismatch
error handling yet.
Fixes#4475
* Don't require inlining if an animated property is private and local
This avoids inlining Button elements from our widget set.
This is covered by tests/cases/properties/animation_merging.slint
Achieve this by generating a `focus()` function for such components
and call it from the outside.
This replaces the previous focus handling with what should be cleaner:
- Any `forward-focus: some-element;` is basically syntactic sugar for
`public function focus() { some-element.focus(); }`.
- The init code gets simplified to calling focus() on the root, if it's
available.
Since the `focus()` functions are now generated in the imports pass,
they become visible in the style checker. That means the checker
requires consistent focus handling between the styles.