Slint 0.3.1 Release
Last week we released Slint 0.3.1, with new features and some bug fixes. This release maintains backwards source compatibility. Applications developed with version 0.3.0 will continue to run with version 0.3.1.
Let's look at the highlights:
- Dark theme for our fluent style.
"fluent"style adapts the colors automatically based on the desktop settings. Use
"fluent-dark"as style names to explicitly select a theme variant.
- SortModel: Use this new model adapter in
to provide a sorted view of an existing model, which is updated on the fly when the model changes. You can use a pre-existing order or provide your own comparison function.
let string_model = VecModel::from(vec![ SharedString::from("Lorem"), SharedString::from("ipsum"), SharedString::from("dolor"), ]); let sorted_model = string_model .sort_by(|lhs, rhs| lhs.to_lowercase().cmp(&rhs.to_lowercase())); // Append to the string model, but will short up first // in the sorted model string_model.push("API rocks");
- C++: FilterModel & MapModel: Use these model adapters to provide a custom view of an existing model, which is updated on the fly when the model changes. These types already existed in our Rust API and are now also available for C++ developers.
- Skia Renderer Improvements: The Skia renderer is now feature complete. Select this renderer for improved performance on macOS, using Metal, and Windows, using Direct 3D.
- Input Method Support: We implemented initial support for operating system provided input methods (such as pinyin) for entering and editing complex text.
- Online editor: Outline and Properties tabs. We continued work on transforming our online editor into a design tool, by adding contextual controls.
Check out the ChangeLog for more details.
Window::is_visibleto the Rust API (#1788)
related to #325
This function returns the visibility state for the given window, as reported by the windowing system.
Thank you to David John for this pull request!
Add support for
These variants of the fluent style will use either the light or the dark color scheme, regardless of the system wide setting.
Changes to the
- New syntax: Allow to create component without base (#1775)
New syntax: Only allow children if the component has @children (#1793)
For compatibility reason, this is also allowed when inheriting
Fix crash when editing text that's rendered using the Skia renderer (#1786)
Olivier found the following steps that reproduce the crash with Skia:
1. Open the gallery and select the "Text Edit" tab. 2. In the first text edit widget, select the first three letters. 3. Click into the second text edit (while the first one shows the selected text) 4. At the beginning of the text, insert the letter "ù" a few times.
This sequence would result in the
cursor_positionproperty get out of sync. Since it represents a byte offset in the utf-8 text, it would point straight into a utf-8 sequence, resulting in a panic when the renderer would try to create a slice of the selected text.
As a remedy, this patch renames the
anchor_positionproperties and provides wrapper getter accessors for use within the TextInput to safely bound the stored offset.
Eventually we need to intercept changes to the text property and adjust the cursor and anchor position properties accordingly, so that they remain valid. However this requires that the compiler is aware that a property is not accessible directly but has a setter that needs to be called instead.
This likely/hopefully also fixes #1707.
SpinBox: set focus when buttons are clicked (#1795)
Thank you to Tasuku Suzuki for this pull request!
Fix flickable in flickable (#1787)
This is a regression caused by the introduced delay
- Fix the iot-dashboard rendering in dark mode (#1783)
Fix parsing the SLINT_BACKEND string (#1780)
SLINT_BACKEND="winit"wouldn't work. Make
femtovgbe possible value for the backend string
femtovg renderer: don't draw svg if they're empty (#1777)
Otherwise computing the
fit_sizewill lead to
NaNand then panic.
The size is empty in the WASM case when loading an HTML image and it isn't loaded yet. We will be called again because the HTML image has an internal property that will be changed when it's loaded
Fix the rendering size of svg (#1760)
- On the web, to return the image size, we need to use the natural size of the image, and not its dom size, as the later get modified since commit b727ab
- The target size did not take in account the image fit, that's because former version of resvg could only render by respecting the aspect ratio. But since the web don't have this limitation, we now need to take it into account. And new version of resvg can also scale with any aspect ratio
Use Property<LogicalLength> instead of Property<Coord> (#1731)
This removes the special code for the generated property getters and ensures type safety in the run-time library for property value setting.
In the Rust generated code we continue to do arithmetic on the scalar values, that means we extract the scalar, do arithmetic and rely on the compiler to only allow compatible units.
Danger zone alert: In the interpreter Value::Number can now be converted to LogicalLength as-is.
online editor: Allow to change property values (#1791, #1792)
This is a bare-bones implementation, but you can change properties with it and it shouldn't break too much and notice when you somehow had the properties editor go out of sync with the buffer context.
At least if it went out of sync after filling out the table of properties. If you go out of sync between the LSP being asked to
queryPropertiesand the properties editor filling in its table, then you are out of luck. I will need to improve the validation function to make sure we're somewhere in the expected property definition to catch that.
Default to the light fluent style in the online editor (#1779)
Until the online editor supports a dark color scheme, also default to the light fluent style, so that by default on a dark color scheme system the hello world example doesn't look out of place.
online editor: Add support for selecting the style (#1774)
Now that we've explicit dark/light variants of the fluent style, it makes sense to have a drop-down menu.
- syntax updater: Simplify updating to the new language + test in CI (#1766)
API changes for SortModel and FilterModel (rust and C++) (#1768)
Ffor consistency with
Add brief documentation for the
Fparameters (also for the other models)
sort: Add a public
PRs: #1767, #1770, #1771, #1773, #1776, #1778, #1781, #1782, #1794
50 patches committed in 28 pull requests by 6 authors.