Commit graph

441 commits

Author SHA1 Message Date
Olivier Goffart
c0cac46009 Add --generate-link-to-definition in the docs of all our published crate
This is a nice nightly rustdoc feature and we should make use of it
2025-06-06 21:47:36 +02:00
Olivier Goffart
7b4d2fd3d3 Renames after the API review
CC #8631
2025-06-06 12:31:50 +02:00
Avery Townsend
8c4ccabf7d
Expose FocusReason to .slint as an argument in focus-event-changed and add focus-gained and focus-lost callbacks (#8569)
This exposes FocusReason to .slint, and adds it as an argument to focus-event-changed callback on FocusScope to close #8387. It also adds two new callbacks, focus-gained and focus-lost, which are identical to focus-event-changed but are only invoked on focus gain or loss respectively.

In addition to this, it removes the FocusEventReason::AccessKit variant, replacing it with the mouse variant to hopefully make AccessKit more compatible with any Slint code that will use FocusEventReason.

Finally, I added two tests based on focus_change_event.slint, one for testing the FocusEventReason argument and another for testing the new callbacks.

close #8387

ChangeLog: Added `focus-gained` and `focus-lost` callback to FocusScope.  Pass an `FocusReason` enum to the FocusScope callbacks
2025-06-04 09:51:26 +02:00
Olivier Goffart
4cfd2ae272 Qt: Fix text_input_byte_offset_for_position when pos is exactly at the end of a line
This can happen when pressing the "up" arrow if two lines are identical

Fixes #8551
2025-05-27 11:29:41 +02:00
Avery Townsend
c41d4a4df3
Add FocusEventReason to FocusEvent and add a select all on keyboard focus for TextInput (#8523)
Closes #5992

Adds the enum FocusEventReason and makes it an argument for FocusEvent. This reason could eventually be exposed in Slint to solve #8387.

Using the focus reason tracking, I also added a select all on keyboard focus for TextInputs (except on macOS), which should close #5992.

ChangeLog: TextInput selects its content when focused with the keyboard on Windows and Linux
2025-05-27 07:56:13 +02:00
Olivier Goffart
23962b3e25
Upgrade cbindgen and use unsafe(no_mangle) attributes (#8539)
To be compatible with the 2024 edition, we need to wrap the
`no_mangle` attribute in `unsafe()`.

The parsing for that in cbindgen was only added in the version 0.28,
but we couldn't upgrade cbindgen before because of a regression in
cbindgen 0.27 that prevented us from upgrading.
Now that cbindgen 0.29 is released with a fix, we can prepare for the
2024 edition
2025-05-26 11:21:33 +02:00
omahs
74232eae8d
Fix typos (#8421) 2025-05-12 13:03:59 +02:00
Simon Hausmann
f4cab86d43 qt backend: Fix mouse up not being sent when pressing multiple buttons
Detect if a button is still pressed before deciding that no button is down.

Fixes #8335
2025-05-05 12:03:05 +02:00
npwoods
80cde76e2a
Qt backend: Created an accessor for the Qt backend to access a window's QWidget
This is a hook for the Qt backend that provides the ability to access the `QWidget` for a window, similar to how the `winit` back end supports accessing the `winit` `Window` object
2025-04-28 16:47:03 +02:00
Simon Hausmann
b098bccc32 Propagate default font properties into PopupWindow 2025-04-24 09:18:45 +02:00
Simon Hausmann
eb825f2e95 Support default-font-* properties in Live-Preview
... by changing the resolution for the `WindowItem` to traverse the
item tree from the current item, instead of going to the window.

This doesn't quite fix #4298 because `rem` resolution is still missing.
That requires the built-in default font size function to be fixed as
well, which is non-trivial.

cc #4298
2025-04-24 09:18:45 +02:00
Simon Hausmann
8761eaadeb
Move Palette.style-name to internal protected StyleMetrics.style-name (#8200)
This is only exposed when internal types are exposed (such as in the lsp).

The plan is to make this public under a new name/global after the release.

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-04-19 10:20:52 +02:00
Nigel Breslaw
62c5ff943e
Palette.style_name was missing from the Rust struct (#8157) 2025-04-15 16:41:10 +03:00
Olivier Goffart
409413b835 Qt: re-arm the timer after callback from invoke_from_event_loop
This fixes the preview window not showing with the Qt backend,
because the preview uses a timer to show the window, but we would not
start the Qt timer and so the window was never shown
2025-04-11 12:41:10 +02:00
Olivier Goffart
78a3757b7f
Remormat all the toml file again to fix npm upload
Commit cd6f2e2 reformated the .toml, but the 80 char width column is
judged too small to be practical

Add a .taplo.toml file

Also do not split feature array
2025-04-09 15:06:00 +02:00
Tobias Hunger
cd6f2e2cf2 ci: Format toml files
... using taplo with default settings

I tried this with 4 spaces indentation, but the patch is almost as
big as this one, so I went with default settings instead as that
is just easier:-)
2025-04-02 11:03:41 +02: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
97fdda5c09 Qt: Fix processing of the mouse release event in popup menu
We really need to dispatch the release event otherwise the wrong
item keeps the drag and this breaks the behavior.

This is not perfect yet as if the release is done on the wrong popup,
then we'll still not get the release event.

We should probably remove the grab when a popup open. But that's
slightly more complicated
2025-02-24 12:02:38 +01:00
Arnold Loubriat
cc91de2d38 Add the accessible-read-only property 2025-02-19 09:16:41 +01:00
Arnold Loubriat
90c337f1d1
Add AccessibleRole::Image and use it in the AboutSlint widget (#7593)
* Add `AccessibleRole::Image`

* Improve accessibility of the `AboutSlint` widget

* Filter out some images from the accessibility tree
2025-02-18 09:43:53 +01:00
Olivier Goffart
ce7a785138
Qt: don't clear selection when the window gain focus
(or popup menu gets closed)

We receive an empty `QInputMethodEvent` when the window gets active
and we should not have a replacement range if there is nothing to
replace, otherwise we clear the selection
2025-02-11 18:10:09 +01:00
Olivier Goffart
22317d29b4
Qt: Fix event forwarding for native popups
So that popup menus can handle hover events.

This also remove some of the code in the qt backend that used the
private API
2025-02-11 17:11:43 +01:00
Olivier Goffart
ceb7ea00f5
Qt: don't call deleteLater on the main widget
Otherwise we crash at exit

Fixes #7570
2025-02-11 12:53:53 +01:00
Simon Hausmann
8372cd6412
Convey clipping of children to accesskit (#7587)
and while at it, move is_clipping_item() that casts a function of the ItemVTable.

Fixes #2341
Fixes #7382
2025-02-10 13:42:10 +01:00
Yuri Astrakhan
bcb2953f00 Auto-fixed clippy::unnecessary_map_or
This is a hacky approach, but does help a lot with the tedious fixes.

See https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_map_or

```
__CARGO_FIX_YOLO=1 cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::unnecessary_map_or

cargo fmt --all
```
2025-02-07 09:02:31 +01:00
Yuri Astrakhan
61de4d56b0 Fix all format arg inlining
Ran this command:

```shell
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-06 10:16:20 +01:00
Arnold Loubriat
358e42a8d5 Add the accessible-action-expand action 2025-02-03 20:32:45 +01:00
Arnold Loubriat
f30f953ffd Add the accessible-expanded property 2025-02-03 20:32:45 +01:00
Arnold Loubriat
53fd7b12e4 Add the accessible-expandable property 2025-02-03 20:32:45 +01:00
Simon Hausmann
a4709b211e Cleanup: Rename bounding_rect_for_geometry to bounding_rect 2025-01-30 10:55:28 +01:00
Simon Hausmann
85b91bd325 Reduce size of CachedItemGeometryAndTransform and fix filter_item to respect the bounding rect
Remove the geometry field and merely store the offset/transform. This brings the size down from 40 to 32 bytes on aarch64.

Related, filter_item() now respects the item's bounding rect for the decision whether to draw the item or not.
2025-01-30 10:55:28 +01:00
Simon Hausmann
4a6b4d9dfa Add support for bounding text rendering with the partial renderer
cc #7247
2025-01-30 10:55:28 +01:00
Simon Hausmann
58ea5389f8 Add support for box shadows with the partial renderer
cc #7247

Fix comment in partial renderer's filter_item() about dependency tracking

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-01-30 10:55:28 +01:00
Simon Hausmann
05e70e8c8b Fix support for Window.background tracking with the partial renderer
Fixes #5219
2025-01-29 16:32:42 +01:00
Simon Hausmann
cf9b515a92 Clean up rendering of component container
Instead of creating a dummy Rectangle with background property, implement a RenderRectangle trait.
2025-01-29 12:39:40 +01:00
Arnold Loubriat
c739f1e9ba Slider widget: react to Home and End keys 2025-01-25 21:30:22 +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
Simon Hausmann
53f2d572b1 Remove some uses of once_cell 2025-01-14 14:18:24 +01:00
Olivier Goffart
e34c19325c
Fix closing PopupWindow when the click opens another PopupWindow
Fix #7322
2025-01-10 21:57:35 +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
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
Arnold Loubriat
49196728a7 Add AccessibleRole::GroupBox 2025-01-07 23:08:03 +01:00
Arnold Loubriat
3304df0f82 Add AccessibleRole::TabPanel 2025-01-06 09:30:11 +01:00
Olivier Goffart
a3dad45f0b Accessibility: rename a few properties after API review:
- Rename `accessible-selectable` and `accessible-selected` to `accessible-item-{selectable,selected}`.
   Because the property is for items in list rather than eg Text
 - Rename `accessible-position-in-set` to `accessible-item-index`.
 - Rename `accessible-size-of-set` to `accessible-item-count` and move
   the property to the container element rather than the item itself
2024-12-07 08:25:42 +01:00
Nigel Breslaw
92534a8a27
1.9 Organise docs folder. (#7005)
Move astro files to docs/astro
2024-12-05 15:40:04 +02:00
asuper0
387220227d
Add step property to Slider (#6981)
Closes #4549

ChangedLog: Slider: added `step` property
2024-12-05 11:50:08 +01:00
Nigel Breslaw
4c1ececc67
1.9 docs: Flesh out docs guide 2024-12-05 00:19:37 +02:00
FloVanGH
0d1412afc5
removed skip-taskbar property from window (#6982) 2024-12-03 10:07:36 +00:00
FloVanGH
901afde11f
api review: callback parameters and properties name adjustements 2024-12-02 16:22:39 +00:00
FloVanGH
712f930897
windows: added skip_taskbar (#6911)
* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/src/content/docs/reference/window/window.mdx

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-27 09:55:11 +00:00