Commit graph

3804 commits

Author SHA1 Message Date
Olivier Goffart
70c7fd1b49 Fix @children next to Timer or PopupWindow
Fixes #7887
2025-03-21 15:58:55 +01:00
szecket
ed47d1e70a
matching the math for skia and femtovg renders for radial gradient (#7899) 2025-03-21 10:53:04 -04:00
Olivier Goffart
51523e981f Compiler: Fix when one branch of a void condition is not void
Fix panic or warning in the generated code

Fixes #7864
2025-03-21 14:37:10 +01:00
Simon Hausmann
6aff60b38f
doc: minor polish to the timer docs (#7905) 2025-03-21 12:34:40 +01:00
Olivier Goffart
d63168d51b Fix change handler with callback
Don't merge a property with a global property if it has a change handler
as we can't mobe the change handler in the global
Fixes #7784

If two property are merged that each have a change handler, we must
merge the change handler. (Note that the order in which they are being
called is not deterministic)
Fixes #7747
2025-03-20 21:34:52 +01:00
Simon Hausmann
ce2cd01383 Separate the stm32 independent part of the slint::platform::Platform impl from stm32 specific bits
... by moving them into an embassy backend to be shared in the future
with other board support packages.
2025-03-20 13:51:47 +01:00
Olivier Goffart
bcd8c5d7be Fix compiler warning with nightly rust
```
error: unused `ControlFlow` that must be used
   --> internal/compiler/passes/infer_aliases_types.rs:185:5
    |
185 |     recurse(&root, element, &mut scope);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
```
2025-03-19 13:00:42 +01:00
Simon Hausmann
cc932fceb9
Improve font embedding for MCUs when bundling translations (#7875)
Include messages from bundled translations into the character set used for deciding which glyphs to embed.
2025-03-18 11:54:28 +01:00
crai0
14b04678b1 Remove unnecessary unsafe 2025-03-18 11:44:28 +01:00
crai0
1cde5bc5b0 Use f64::log10 2025-03-18 11:44:28 +01:00
crai0
7ac315c72b Allow unused num_traits::Float 2025-03-18 11:44:28 +01:00
crai0
a8eb44b739 Promote float to double in cpp code gen 2025-03-18 11:44:28 +01:00
crai0
424b12ee36 Use num_traits::Float 2025-03-18 11:44:28 +01:00
crai0
e6e7b4e3df Fix cpp code gen 2025-03-18 11:44:28 +01:00
crai0
39e7ba554f Avoid using f64::fract and f64::trunc 2025-03-18 11:44:28 +01:00
crai0
4bb7412460 ChangeLog: Add float.to-fixed and float.to-precision
Add two new float to string conversion methods that mimic
JavaScript's Number.toFixed() and Number.toPrecision().

They are implemented as no_mangle functions similar to the already
existing float to shared string conversion.

Closes #5822
2025-03-18 11:44:28 +01:00
ogoffart
178cf21c2e Bump version number to 1.11.0 2025-03-18 09:48:22 +00:00
Arnold Loubriat
615be362b2 Disable built-in TextInput accessibility for Spinbox 2025-03-17 14:27:08 +01:00
Arnold Loubriat
6aa7744868 Expose more kinds of text edit widgets to AccessKit 2025-03-17 14:27:08 +01:00
Olivier Goffart
a3ab90d4fc compiler: Fix infinite recursion trying to inline function argument
We can't use `body.visit_recursive_mut` because it will recurse on the
newly replaced argument. Implement recursion manually instead.
2025-03-06 23:24:08 +01:00
Olivier Goffart
754a6bfdef swrenderer: make sure small functions in fixed point are inlined
`cargo bench -p printerdemo_mcu`

Before
```
bench                fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ full                            │               │               │               │         │
│  ├─ Rgb565Pixel    2.919 ms      │ 8.155 ms      │ 4.279 ms      │ 4.326 ms      │ 100     │ 100
│  ╰─ Rgb<u8>        6.139 ms      │ 10.49 ms      │ 7.729 ms      │ 7.826 ms      │ 100     │ 100
╰─ render_only                     │               │               │               │         │
   ├─ Rgb565Pixel                  │               │               │               │         │
   │  ├─ FullBuffer  1.439 ms      │ 4.138 ms      │ 1.597 ms      │ 1.635 ms      │ 100     │ 100
   │  ╰─ LineByLine  1.576 ms      │ 1.765 ms      │ 1.636 ms      │ 1.642 ms      │ 100     │ 100
   ╰─ Rgb<u8>                      │               │               │               │         │
      ├─ FullBuffer  2.016 ms      │ 2.872 ms      │ 2.111 ms      │ 2.128 ms      │ 100     │ 100
      ╰─ LineByLine  2.122 ms      │ 2.995 ms      │ 2.21 ms       │ 2.245 ms      │ 100     │ 100
```

After
```
bench                fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ full                            │               │               │               │         │
│  ├─ Rgb565Pixel    2.187 ms      │ 4.913 ms      │ 3.48 ms       │ 3.505 ms      │ 100     │ 100
│  ╰─ Rgb<u8>        5.489 ms      │ 8.193 ms      │ 6.713 ms      │ 6.723 ms      │ 100     │ 100
╰─ render_only                     │               │               │               │         │
   ├─ Rgb565Pixel                  │               │               │               │         │
   │  ├─ FullBuffer  1.105 ms      │ 1.932 ms      │ 1.225 ms      │ 1.278 ms      │ 100     │ 100
   │  ╰─ LineByLine  1.188 ms      │ 2.052 ms      │ 1.289 ms      │ 1.352 ms      │ 100     │ 100
   ╰─ Rgb<u8>                      │               │               │               │         │
      ├─ FullBuffer  1.505 ms      │ 2.643 ms      │ 1.599 ms      │ 1.669 ms      │ 100     │ 100
      ╰─ LineByLine  1.539 ms      │ 2.058 ms      │ 1.641 ms      │ 1.652 ms      │ 100     │ 100
```
2025-03-06 12:24:54 +01:00
Olivier Goffart
36a89aeff8 Software renderer: fix drawing background of rotated screen
We need to draw the background over the rotated rectangle otherwise we
don't fill the whole background.

Regression from https://github.com/slint-ui/slint/pull/7685

(also cleanup a useless blend that was leftover from the same change)

Adapt the screenshot test to have at least one non-square "window" so
that we catch the problem in the future
2025-03-06 00:09:35 +01:00
FloVanGH
390f8aaf50
scrollview: fixed scrollthumb size on small sizes (#7809)
* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-05 16:46:45 +01:00
Olivier Goffart
ea17eee5fd Interpreter: Fix enabling only the Qt backend
when compiling, for example, the viewer with
`--no-default-features --features=backend-qt` in order to avoid
compiling winit, we would still not enable the qt backend because it
didn't enable the backed-qt feature in the selector that toggle the
`enable` feature in i-slint-backend-qt
2025-03-05 12:18:26 +01:00
Olivier Goffart
a6a142f9c8 C++: fix a bug in which a substraction could overflow
There was an image like this:
```slint
height: 40px
Image {
     width: parent.width;
     height: self.source.height * 1px;
     source: @image-url("....");
}
```

The `y` propery ended inlined like so:
`(40 - the_image.source.get().size().height)/float(2)`
but since height was `unsigned` the C++ rules means that the operation
happens as unsigned and we have an overflow. and `y` turned out to be
very big instead of slightly negative (for image whose height was larger
than 40)
2025-03-05 08:25:45 +01:00
Olivier Goffart
7cb903aa77
janitor: Fix comment in items.rs 2025-03-05 08:16:32 +01:00
FloVanGH
5cfac949d9 material: fix horizontal tab stretch 2025-03-04 12:37:06 +01:00
FloVanGH
ac1a0f9f76 material: cleanup tabwidget.slint code 2025-03-04 12:37:06 +01:00
Olivier Goffart
5ab791416b Implement Property::set_constant in C++ 2025-03-03 00:50:09 +01:00
Olivier Goffart
79b31153c5 C++: implement the ItemTreeVTable::window_adapter
This is required to fix closing popup with the Qt backend, as we use the
window_adapter as a hack to get the root window_adapter (as opposed to
the popup one)

(That function was only used for the ComponentContainer and was not
implemented for C++ before)

Note that this reinterpret a
`Option<slint::private_api::WindowAdapterRc>` to just a `WindowAdapterRc`
This is because `Option` is only forward declared in C++ as it is not
generaly `#[repr(C)]`,  but we assume (and assert) the usage of a niche.

As reported in https://chat.slint.dev/public/pl/ihnwtdgp7fb75k4aj5ou3p4idc
2025-02-28 00:34:14 +01:00
autofix-ci[bot]
617aa386bc [autofix.ci] apply automated fixes 2025-02-27 12:13:44 +01:00
FloVanGH
f6cec29fed menu: finished cupertino style 2025-02-27 12:13:44 +01:00
Simon Hausmann
83115e7a90 doc: Separate out the MenuBar element docs into a dedicated element under Window
This way it's easier to find without search.
2025-02-26 16:46:36 +01:00
Olivier Goffart
185d49e238
Fix possible panic when ContextMenuArea gets destroyed when the menu is visible 2025-02-25 21:38:13 +01:00
FloVanGH
dcb7c065d6 menu: cosmic style 2025-02-25 16:31:31 +01:00
Simon Hausmann
d79689984e Upgrade muda 2025-02-25 16:08:48 +01:00
FloVanGH
5019ff7df4
menu: adjusted for material style (#7731) 2025-02-25 07:25:31 +00:00
Olivier Goffart
11accc190a Fix panic when inlining into clip during the second phase of inlining
During the second phase, anything that involve @children should already
have been processed, so there shouldn't be anything left to inline.
But the children insertion point may be pointing to the wrong location
if some items were moved around (eg because of the `clip`).
So work it around by not accessing the children array at that indax that
might be out of range.

Fixes #7724
2025-02-24 19:15:39 +01:00
Olivier Goffart
7390df1b47
ContextMenuArea: Intercept long press on Android 2025-02-24 18:27:25 +01:00
Simon Hausmann
bd80829a44 Clean up and speed up rectangle fill fallback
Match on the composition mode only once per call and compute the fill color only once.
2025-02-24 17:02:10 +01:00
Simon Hausmann
16dce125ca Simplify y range iteration 2025-02-24 17:02:10 +01:00
Simon Hausmann
b6721e172a Simplify foreach_ranges by re-using foreach_region 2025-02-24 17:02:10 +01:00
Simon Hausmann
aced301f4d Simplify RenderToBuffer declaration 2025-02-24 17:02:10 +01:00
Simon Hausmann
f114ff28dd Rename TargetPixelBuffer::Pixel to ::TargetPixel 2025-02-24 17:02:10 +01:00
Simon Hausmann
910d45a01f Fix window background fill
Don't blend the background but fill it when going through ProcessScene.
2025-02-24 17:02:10 +01:00
Simon Hausmann
4c1b7762bd Separate the target pixel buffer trait and related types into a separate module 2025-02-24 17:02:10 +01:00
Simon Hausmann
247074b5e7 Simplify accelerated texture and rectangle fills
There's no need to split the areas to span lines.
2025-02-24 17:02:10 +01:00
Simon Hausmann
dde0ebe201 Fix build for C++ generated code for embedded textures 2025-02-24 17:02:10 +01:00
Simon Hausmann
5518720391 Fix docs about fixed point format for source texture offsets 2025-02-24 17:02:10 +01:00
Simon Hausmann
9e515710ed Expose screen rotation in the TargetPixelBuffer's draw_texture as integral angle 2025-02-24 17:02:10 +01:00