If the property was not used, it was optimized out and the compiler
would panic
Fixes#6331
ChangeLog: compiler: Fix changed callback of an unused property
The origin of this proposal is the name of the `swipe-left`, etc.
directional, boolean properties. They're missing another verb in their
name. In principle the right choice would be "recognize". That is what
the type name suggests, that's the term the documentation uses, so the
code should read `recognize-swipe-left: true;`. However that is a long
word. "Handle" is a verb that's simpler. It's also more generic (that's
a downside), but it's otherwise short enough to make things look
"right":
```
SwipeGestureHandler {
handle-swipe-left: true;
swiped => { something.naviate-left(); }
}
```
Therefore this patch proposes to rename the type to SwipeGestureHandler
and prefixes the boolean directional properties with "handle".
Don't return an Option, just return 0 when the timer is not started.
As discussed in the API review, the rational is that the interval is
just like a field in a struct and when the struct is default
constructed, it is initialized to 0
* Select text on SpinBox on double click
* Update CHANGELOG.md
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
* Code review feedback
---------
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
* Fixed button of cup. ComboBox not centered on bigger height
* Update CHANGELOG.md
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
---------
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
This is consistant so that `width: 100%` is the same as `width: parent.width`
This basically revert the previous commit that was just working around
the debug_assert to actually fix the behavior
ChangeLog: width and height expressed in `%` unit for an element in a
Flickable now refer to the size of the Flickable instead of that of
the viewport
The viewport of a flickable is of ElementType::Native, and `lookup_property`
don't query the builtin reserved properties in that case.
This commit fix the assert by allowing Type::Invalid as well.
Fixes#4163
We need to skip the generation of the local property so it directly
forward to the alias in the public property
Fixes#5855
ChangeLog: Fixed generated getter and setter of alias properties in globals
eg, don't report an error for each callback or animation or changed
event that the the property doesn't exist or such.
Also reword the message when an element doesn't exist. Use "element"
rather than "type" as it is more accurate.
We need to give unique name to optimized item as well, otherwise the
properties ends up the same.
Also fix the optimized element and timer when inlining
Fixes#5977Fixes#5976
If a property is only used once, we can inline it with a bigger
threshold.
But this require to first compute the use, and then do the inlining
while adjusting the usages
Because f64 has too much precision, so limit to f32 so that we don't
have extra precision we don't need and would be wrong as all our float
as in f32
(Also avoid double allocation in rust generated code)
We wouldn't detect percent as a unit product in
43c7f57b0f/internal/compiler/generator/rust.rs (L2418-L2422)
Percent is not strictly of percent unit because that unit doesn't
combine with other unit (as per the comment in `default_unit`)
But since it converts to number, it is then an unitless value. (scalar)
Fixes#5887
code like so:
```slint
callback foo();
if true : Button {
clicked => {
true ? foo() : foo();
}
}
```
the code like foo() use the `option.map()` to get to the parent, but then it
needs to still be wrapped in a `{...}` to convert that to a `()` expression
Fixes#5883
Instead of having all style duplicated and re-using a base, we just hack
into the funciton that queries the dark/light theme based on the style
suffix known at compile time.
This removes one of the problem that happens when trying to work on the
widget style with the extension, as it relies on include path hacks