Commit graph

1514 commits

Author SHA1 Message Date
Olivier Goffart
3f54e6cbc1 Fix ScrollView on cupertino not showing the last few pixels
Within the cupertino's ScrollView, the Flickable is positioned
with a 2 pixel margin with the `x` and `y` properties
property, so the width and height should also account for that margin.

Fix the test_cpp_elements_listview in test-driver-cpp
2025-01-22 19:52:02 +01:00
Olivier Goffart
0ef44195f7 Add contextmenu syntax test 2025-01-21 15:41:25 +01:00
Olivier Goffart
2df0b8bf20 ListView: adapt the viewport's width based on the minimum-width of delegate
(Instead of their `width` property)
2025-01-21 14:31:55 +01:00
Olivier Goffart
7e37f19e2c ListView: fix continuous redraw with fluent style
Because we set the viewport-width several time to different value during
the layouting of the ListView, it will cause this property to always be
dirty. In particular, this causes permanent restart of the fluent's
scrollbar animation on the size of the handle, causing continous
repaints.
2025-01-21 14:31:55 +01:00
Simon Hausmann
0d723953f9 Add support for line caps in Path Strokes
ChangeLog: Added `Path::stroke-line-cap` property.

Fixes #4676
2025-01-20 22:28:45 +01:00
Olivier Goffart
4da79ac69a Fix layouting of huge ListView with millions of items
The problem is that the precision of f32 for coordinate wouldn't be
accurate enough with such big viewport to put the elements so that they
are next to eachother.
So put the elements relative to the Flickable instead of relative to the
created moving viewport Rectangle.

Fixes #3700

Note that the ListView still use f32 for the scrollbar value, meaning
that at some point, the wheel stops working as the wheel increment is
smaller than the f32 increment, and scrolling becomes somehow fuzzy.
But this only happens after one more billions pixels now, so one can
have more than 50 millions of elements without much problems
2025-01-20 17:41:38 +01:00
Olivier Goffart
387e4202ea Rust: one more fix for computations on big numbers 2025-01-20 16:47:49 +01:00
Olivier Goffart
90f5621985 Fix string formatting of big integer
Don't lower the precision to f32 for big enough numbers
2025-01-20 15:55:44 +01:00
Olivier Goffart
de80bb0a2c Rust: Fix comparison of big integers
Don't convert integer to f32 in the rust generated code
2025-01-20 15:55:44 +01:00
Olivier Goffart
0dc068524c Fix panic in the compiler when having a changed callback over a property that is not materlialized
Fixes #7316
2025-01-17 12:19:20 +01:00
Olivier Goffart
28e54175f6 Work on the ContextMenu
- Add the `entries` property in the ContextMenu
 - Make right click on the ContextMenu show the menu
 - Use the proper technique to register ContextMenu and MenuBar as
   experimental (same as ComponentContainer)
2025-01-16 20:21:06 +01:00
Olivier Goffart
f72e8a1c01 C++/Interpreter: Be consistant with rust in the order in which we create the window
Same as previous commit for Rust
2025-01-16 19:11:31 +01:00
Olivier Goffart
9d1be5209c Don't panic in the generated rust ComponentHandle::window()
It can panic if lazily constructing the window adapter.
Make sure it is actially not lasily constructed, we don't need lazy constructor when not embedding anyway.
2025-01-16 19:11:31 +01:00
Tasuku Suzuki
68b9dfc247 String: Add .is-empty and .character-count properties
Introduce two new properties for string in .slint:
- .is-empty: Checks if a string is empty.
- .character-count: Retrieves the number of grapheme clusters
  https://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries

These additions enhance functionality and improve convenience when working with string properties.
2025-01-14 19:29:05 +01:00
Olivier Goffart
8a5df27469
Update to Image 0.25 (#7365)
Added image-default-formats with all the format supported by image by
default, and enable that feature by default.
Also put that feature in compat-1-2 for compatibility with user that
have used image 0.24 with enabled features.
Make a new compat-1-10 feature that does not enable default format by
default

ChangeLog: upgraded image crate to 0.25, added a new cargo feature
to enable all image formats. (that feature is enabled by default with
compat-1-2, added compat-1-10 to disable it

Fixes https://github.com/slint-ui/slint/issues/7251
2025-01-14 16:31:05 +01:00
Simon Hausmann
53f2d572b1 Remove some uses of once_cell 2025-01-14 14:18:24 +01:00
Olivier Goffart
5cf9c6806e LSP: don't auto-compete private properties 2025-01-14 11:26:57 +01:00
Olivier Goffart
7056515f6c Detect binding loops when it involve the condition of a if in a layout
Fixes #7126
2025-01-13 14:40:18 +01:00
ogoffart
c83af3ca5c Bump version number to 1.10.0 2025-01-13 13:38:41 +00:00
Tasuku Suzuki
346d1c2df3 Fix typos
Ran `typos .` and fixed all typos that do make sense.
https://crates.io/crates/typos
2025-01-13 08:35:20 +01:00
Simon Hausmann
aa332202c5 Rename AccessibleRole.GroupBox to AccessibleRole.Groupbox
While unfortunate in casing, this is consistent with Checkbox, Combobox, and Spinbox.
2025-01-10 16:27:14 +01:00
Olivier Goffart
3e94bd2167 Janitor: Remove trailing whitespaces from all files
`git grep -I -l -O'sed -i "s/[[:space:]]*$//"' -e ''`
2025-01-10 13:23:22 +01:00
Simon Hausmann
c764da4aab
Add property to toggle anti-aliasing on Path elements (#7308)
This enables working around bugs in GPU drivers. Especially the GC7000UL
plus its driver on imx8mp has been observed to sometimes horribly degrade in
performance when Skia renders anti-aliased paths (when a function like
`gcoSURF_BlitCPU` shows up at the top of `perf` that's a bad sign).
2025-01-10 10:28:01 +01:00
Olivier Goffart
cfbcf0b1d7
Introduce Window::try_dispatch_event (#7313)
That is the same as Window::dispatch_event, but it reports an error
instead of panicking
2025-01-09 19:39:38 +01:00
Olivier Goffart
6b4c822a4a MenuBar: C++/Rust native menubar implementation
introduce a SetupMenuBar builtin function to ease C++/Rust lowering
2025-01-08 21:16:17 +01:00
Olivier Goffart
846664ad45 WIP: native menubar using muda
Only the interpreter is implemented so far

MacOs won't work yet because we don't disable the default winit menubar

The viewer don't support removing the MenuBar yet
2025-01-08 14:05:35 +01:00
Olivier Goffart
9685af865a MenuBar: error when MenuBar is repeated or conditional 2025-01-08 11:00:59 +01:00
Arnold Loubriat
f7b9da96d4 Set accessible-enabled on group box widgets 2025-01-07 23:08:03 +01:00
Arnold Loubriat
8b95752de7 Set accessible-label on group box widgets 2025-01-07 23:08:03 +01:00
Arnold Loubriat
49196728a7 Add AccessibleRole::GroupBox 2025-01-07 23:08:03 +01:00
Olivier Goffart
863a6fdebb Fix panic when inlining 0 children in a Row
The first inlining pass should inline any element that has children.
Row is going to be optimized out before the second inlining pass.
In that pass, we shouldn't care if there is no children while inlining
in a `@children`

Fixes #7284
2025-01-07 18:40:38 +01:00
Tobias Hunger
cfb2324526 lsp: Rename structs and enums
... but only when directly on the name of the struct
when it is declared.
2025-01-07 16:18:46 +01:00
Olivier Goffart
aedd04a3d8 Parser: skip UTF-8 BOM
Skip the byte order mark.
BOM is also allowed in .rs or Cargo.toml file.

Fixes #7291
2025-01-07 12:34:08 +01:00
Olivier Goffart
a942ed0852 Remove thiserror dependency
Uses derive_more instead
2025-01-06 17:25:08 +01:00
Olivier Goffart
58242676f6 Janitor: Update rowan dependency 2025-01-06 17:25:08 +01:00
Olivier Goffart
76332c5e16 Improve a bit the error when the base of an element is missing 2025-01-06 10:47:05 +01:00
Arnold Loubriat
9c25040b00 Set accessible-action-default on tabs 2025-01-06 09:30:11 +01:00
Arnold Loubriat
14466d1be6 Set accessible-label on tab panels 2025-01-06 09:30:11 +01:00
Arnold Loubriat
3304df0f82 Add AccessibleRole::TabPanel 2025-01-06 09:30:11 +01:00
Arnold Loubriat
60aacc8f82 Set accessible-item-selected on tabs 2025-01-06 09:30:11 +01:00
Arnold Loubriat
67f6e1a737 Set accessible-item-selectable on tabs 2025-01-06 09:30:11 +01:00
Arnold Loubriat
23e37ce4de Set accessible-item-index on tabs 2025-01-06 09:30:11 +01:00
Arnold Loubriat
38499962a9 Set accessible-item-count on tab bar widgets 2025-01-06 09:30:11 +01:00
Arnold Loubriat
c3cfa6044a Remove tab title label from the accessibility tree 2025-01-06 09:30:11 +01:00
Simon Hausmann
3bff12f092 Make i-slint-compiler widget library inclusion Bazel sandbox friendly
The cargo manifest path differs between the invocation of build.rs and rustc when compiling included_library.rs. Accomodate this by providing relative paths.
2025-01-04 12:48:10 +01:00
Simon Hausmann
251bf2332c Partial fix for bazel build when packaging the widgets library during i-slint-compiler build
When the build script runs within a sandbox, all files are symlinked. So checking for say widgets/fluent/button.slint to be a file with is_file() fails, because it's a symlink. Use !is_dir() instead.
2025-01-04 12:48:10 +01:00
Simon Hausmann
d0232782e0 Fix typo 2025-01-03 17:04:27 +01:00
Olivier Goffart
12c99f1c80 Add a warning when a component/type name overwrite another
Also fix the unused component warning when that happens
Fixes #7176

ChangeLog: Warning when a type name overwrite another
2025-01-03 09:29:27 +01:00
Olivier Goffart
3ea8be06e8
Make StandardButton focusable
Fixes #7230

ChangleLog: Fixed StandardButton not focusable
2024-12-30 13:33:15 +01:00
ogoffart
f309a551b5 Bump version number to 1.9.2 2024-12-30 10:18:16 +00:00