The added functions enable mixing colors and manipulating the opacity
of colors and brushes.
They enable the behavior of some of the available functions from SASS and are
added for future use for adding the Adwaita style (future PR).
In the compiler this is still very primitive, but an attempt to start a
generic interface. The basic assumption is that all item functions will
eventually need access to the window adapter and itemrc. Support for
additional arguments is still missing.
Also missing is support for the function access via rtti in the
interpreter, hence the hardcoding at the moment.
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
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
Make sure that we return an unsigned for row_count() in C++ and Rust by ensuring an unsigned int model at creation time.
For the interpreter this "worked" by chance as casting a negative floating
number to usize automatically caps at zero, and all values are stored as f64. For safety this patch
applies the same fix though, to be on the safe side.
Fixes#2005
(Unfortunately, we can't make a driver test for this becasue the
behavior with the interpreter is different than with the compilers.
The interpreter errors out, while the compiler should just generate
nothing)
Limit the dependency tree of things like the interpreter or the C++ compiler that
doesn't support it anyway.
It is still enabled inconditionally in slint-build though
These are two different concept, and it is confusing to keep them in the
same enum
We want to support component without any base element, and Void is
already used for global component, so do this refactoring before
One key difference to the Rust way is what `slint::Window` means. In
Rust that holds the `WindowInner` and `slint::Window` is only exposed as
`&slint::Window`. This is possible because the component owns the
`Rc<dyn PlatformWindow>`, which has a function to return the
`&slint::Window`.
In C++ `slint::Window` is also exposed as `slint::Window&` in the
`window()` getter, but there's no way to get a reference to a C++
wrapper for the Rust `&slint::Window` that the `PlatformWindow` trait
returns. Therefore in C++ `slint::Window` wraps `Rc<dyn
PlatformWindow>`.
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.
state info properties are special and cannot simply be inlined or set
(because we need to record the time it was changed and stuff)
So disable the optimization for now.
In fact, what could be done is to remove the state entirely if the state property
is constant. But that change is a bit more involved
This patch does:
- Don't inline const state property
- Don't generate a call to .set in the generated code
- Also allowed to debug the expression with a context from the generator
(added T generic parameter to the pretty printer)
Fix panic reported in https://github.com/slint-ui/slint/issues/1327#issuecomment-1151244049
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
Remove the `parent_item` function. After the recent changes that did not
return an item anymore and since the item tree is exposed, this function
was only used to find the repeater a component was created by.
So replace the old function with a new one that only returns the parent
node in the parent component.
This saves a few lines of generated code that is not used anymore.
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
This avoid repeating the enums both in the compiler and in
the runtime library, and register them in a bunch of other places.
So it should be easier to add enums and enum values
Since cbindgen doesn't see through the macro, generate the enum
manually
* Make sure that the compiler don't panic if the parent of a PopupWindow
is optimized (by not optiizing such element)
* Ensure that we can call popup.show() from within a deeper repeater
* Ensure that the parent element of the popup is the right one in case of
repeater (and not the node in the parent component)
This partially revert ad5991f8fa and
6c7a7aed0e because we must do the lower_popup
adter the repeater pass, because otherwise the parent element of the
created component for the PopupWindow might be wrong and it is not easy to
adjust (we would have to make Component::parent_element a RefCell or duplicate
it again.
Fixes#1132