Add flags that enable the Button to be used as a Toggle, e.g. for use in toolbars or similar places.
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
I want to track component structure changes in the window without
generating more code. So use a more generic name for the init_*_items
functions, so that I can add the functionality I need in there.
Also add a register_component to PlatformWindow and call that.
I want a more generic name as I want to do to track component structure
changes in addition to resource freeing and I do not want to add another
call into the generated code.
The borrow logic in ItemCache<T>::get_or_update_cache_entry requires us
to take the per-item cache dirty tracker out of the cache entry, so that
we can drop the ref and allow the update_fn to access the cache for
other items during evaluation.
However in order for the cache to work by not re-evaluating the
update_fn next time if nothing rendering related change, we must put the
tracker back after the check/evaluation, otherwise take() will always
return none.
This is a regression from commit
6cbf2c0609 that changed the call from
get_or_update() - which puts the tracker back - to
get_or_update_cache_entry(), which doesn't. Since the former is now
unused, this commit also removes it.
This ensures that the partial renderer updates correctly and this also
fixes a panic in the printer demo on the stm32h7 when opening the format
combobox in the scan page:
We would attempt to render the word "JPEG" with a font size of 12 pixels.
The letter J has a height of 12 pixels, like the font ascender reported, but it's
y coordinate is negative.
That would also result in a negative text item relative origin for the glyph (target
rect in physical pixels),
which fails to convert to an usize and panics.
When concatenating two fragment, we should account for the trailing whitespace
in the previous fragment in the total width.
This fixes the "l" of "Ink level" not beoing drawn properly in the printer
demo with the partial renderer if the Text item (which is too small as a result
of this bug) does not overlap the dirty region, but part of the text still
need to be drawn outside before it overflows
When computing the dirty regions, the call to geometry() might end up
querying a value that's computed by the layout. For the layout
computation we might end up calling ensure_updated() on a repeater,
which then might destroy components. The destruction involves freeing
cached dirty rectangles (via free_graphics_resources), and that also
requires a write access to the cache. So after retrieving the property
tracker for the dirty geometry, drop access to the cache before calling
geometry().
When using repeaters - like in the slide puzzle - and during renderer a component
gets deleted, we call free_graphics_resources and try to free
the dirty rectangle list in the partial renderer cache. At that point the cache is
already mutably borrowed, which causes a panic.
As remedy, apply the mutable borrow more fine grained and not right when calling
render().
Implement basic accessibility (a11y) support, using the Qt backend.
_This should get us started, but accessibility support is an additional way to interact with UIs that is very different from the "graphical way" most users will interact with the UI. No single PR will "make a toolkit accessibility", this needs to be an ongoing effort!_
Parts of this PR:
* Add functions to access a11y-related properties to Component
* Add helper functions to Item struct
* Handle accessible- properties in the compiler
* Add documentation, add description, enforce some basic rules
* Make the Text element accessible by default
* Don't optimize away accessibility property in the LLR
* Ensure that accessibility property are marked as used
* Add some accessibility properties to the native style widgets
* Support for bool and integer `accessible` properties
* Implement basic support for accessibility
* Make basic widgets accessible by default
* Make slider focus-able and interactable with keyboard
* Tell a11y layer about value changes
* Generate QAccessible constants using bindgen
* Don't expose the `accessible` properties when using the MCU backend: There is no backend to make use of them
* Handle focus change based on keyboard focus of the window
* Report accessible widgets at correct positions
* Allow for (virtual) focus delegation at the a11y level
* Calculate value step size dynamically
* Make sure to not send notifications to a11y backend about dead objects
The mcu simulator builds i-slint-core with the std feature, but debug_log maybe
used in #[no_std] contexts, so we need to use a re-export rather than rely on std
being present
The loop was skipping one of the stop to interpolate
because when one iterator was returning None, the other
one had also advenced and its result discared.
We can just unwrap the value instead from the longer chain.
For the radial gradiant, we need to interpolate the last
colors to avoid a flash at the beginning for all the area
"outside" the circle.
We changed the MSRV in the last release because some dependency depended on
Rust 1.59. But that did not concern the C++ build, for example.
Now that we rely on rust 1.59 in our own code, we should make it explicit
so that the compilation error show the proper error