mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
Support for enums is three-fold:
- Enums are dynamically created by invoking `enum.Enum("NameOfEnum",
[("Variant1", "Variant1"), ("Variant2", "Variant2"), ...])` and the
exposed in the module (next to structs).
- They're converted back to `Value::EnumerationValue(enum_name,
enum_value)` by checking if a supplied value is an instance of
`enum.Enum` and then querying the name and `__class__.name` fields.
- When coverting a `Value::EnumerationValue` to Python, the hard work
begins: We now pass along a TypeCollection through all phases of the
type conversion, which knows about the enums created earlier and tries
to locate the correct type class and then variant.
Fixes #5828
|
||
|---|---|---|
| .. | ||
| cpp | ||
| node | ||
| python | ||
| rs | ||
| wasm-interpreter | ||