Commit graph

1271 commits

Author SHA1 Message Date
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
Tasuku Suzuki
bc89c634b3 Fix warning message for a property that name is used for function 2024-12-26 17:54:38 +01:00
Tasuku Suzuki
7a8ca9b147 Fix error message when a property named color is override
It said `Cannot override property 'background'` because color is defined
as below

```slint
property <color> color <=> background;
```

For the warning, the name should not be resolved.

Fixes #6324
2024-12-26 17:50:45 +01:00
aurindam
dc3f29b6da Bump version number to 1.9.1 2024-12-19 12:57:19 +00:00
Olivier Goffart
f31cefdea9
Fix min/max/clamp in presence of percentages
We were not properly converting the first argument

Fixes #7118
2024-12-16 18:44:55 +01:00
Olivier Goffart
60c10213d2
Remove LayoutSpec and undeprecate StyleMetrics.layout-* properties (#7069)
StyleMetrics is the right name for these
2024-12-16 14:52:28 +01:00
Olivier Goffart
4a5ba09e7a Fix panic in legacy component with out property
Fixes #7095
2024-12-16 13:58:56 +01:00
Benny Sjoestrand
5ef4aace4c Implement full-screen property for slint Window item
Make it possible to programatically to switch to full-screen mode
via a new property in the Windows item.
The SLINT_FULLSCREEN environment variable will default set this
property to true. However settings this property in the slint code
will override the SLINT_FULLSCREEN.

Fixes #6665
2024-12-16 09:52:40 +01:00
FloVanGH
e0ad561c86
widgets: added key-pressed and key-released callbacks to all text input components (#7081)
* widgets: removed rejected event
* widgets: added key-pressed, key-released callbacks to text input components
* Update docs/astro/src/content/docs/reference/std-widgets/lineedit.mdx
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-12-12 16:20:45 +00:00
Tobias Hunger
b7e1fb9d18
lsp: Offer to populate empty documents (#4767) 2024-12-11 19:33:24 +01:00
Olivier Goffart
6b3361d079 Properly report binding loop involing font-metrics 2024-12-10 21:26:58 +01:00
Olivier Goffart
a107462942 compiler: fix materialize_fake_property for properties in base class
Especially for font-metrics
2024-12-10 21:02:33 +01:00
Olivier Goffart
0f15a26f35 PopopWindow: Fix close-policy and close-on-click when inheriting 2024-12-10 12:10:49 +01:00
Olivier Goffart
69d201d6a0 ComboBox: key event when popup is open
Fixes #4826

The previous patch changed that the ComboBox was no longer focused when
the popup is shown, so make a hack around that
2024-12-09 15:58:16 +01:00
Olivier Goffart
e03e812984 Fix Focus in PopupWindow
Fix https://github.com/slint-ui/slint/issues/2911
2024-12-09 15:58:16 +01:00
Arnold Loubriat
9b9a34561d
Improve keyboard navigation of StandardListView (#6955) 2024-12-09 15:14:15 +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
Olivier Goffart
2ea482da49 Compiler: Change a new error from 1.9 to a warning
To keep compatibility with existing Slint code

Commit 53e79000a4 added a call to
LayoutConstraints::new which is shown to produce error in the crater
run.
2024-12-06 23:04:26 +01:00
Olivier Goffart
a7f0fdcd93 C++: explicitly cast to float when generating gradiant stop
To avoid the error `error: narrowing conversion of`
2024-12-06 23:04:12 +01:00
asuper0
387220227d
Add step property to Slider (#6981)
Closes #4549

ChangedLog: Slider: added `step` property
2024-12-05 11:50:08 +01:00
Olivier Goffart
1be59466dc llr: Slint global lowering so it doesn't panic with cross-reference
Global can reference other global.
This means that all global needs to be mapped before we can lower their
expressions

Fixes #6984
2024-12-03 15:52:48 +01:00
Olivier Goffart
461beb80cd Fix purity check for focus() on custom component
Do the purity check before doing the transformation of the `focus()`
function, so the source location of the error is the most accurate

Fixes #6979
2024-12-03 15:52:33 +01: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
Olivier Goffart
8efdcb332d Don't allow Menu without experimenal support
Previous attempt which included changing `lookup_type_for_child_element`
to check for `is_internal` failed because internal types shouldn't be
enabled in experimental mode, actually
We already have a function that removes the experimental types from the
TypeRegister, so do the same for MenuBar
2024-12-02 16:03:28 +01:00
crai0
e4b70efe6e
compiler: Warn user when immediately converting gradient macro to color (#6956)
Fixes #6819
2024-12-02 13:05:38 +01:00
Olivier Goffart
459fad7528 Janitor: fix comments in builtins.slint
The compiler is using StyleMetrics
2024-12-02 11:08:35 +01:00
Olivier Goffart
4e7bbcf2ba
Try to improve rendering (positioning) of signed field distance font. (#6868)
* WIP: swrenderer: use fixed point for the pixmap font coordinate

* swrenderer: signed distance field: move the glyph to the middle

* swrenderer: round the advance instead of truncating it in distance field

* swrenderer: actually align the gplyph on the sub-pixel precision

sub-pixel within the source.

* swrenderer: adapt the threshold for signed distance field

sqrt(2) is the distance to the diagonal, seems like this gives sharper fonts

* Fix bug in the elision, and re-upload the screenshort

the screenshot changed because the afvanced is now rounded intead of
truncated
2024-11-30 23:03:31 +01:00
Tobias Hunger
312d091a1d live-preview: Improve handling of cached files
The idea of the live-preview is that it never causes disk
access itself, the LSP side handles all that for it.

With this in mind:

* Keep source code of invalidated files in the cache. This
  way we will see whether we need to refresh the UI after the
  LSP has read the data back from disk. This avoids quite
  a bit of rerendering just because an unchanged buffer was
  closed in the editor (e.g. because the editor switched buffers!)

* Always return `Some` from our file open fallback so that the
  compiler does not fall back to reading data from disk

* Do not try to render if the main file has no source code yet.
  The LSP will tell us about the sources in time
2024-11-27 16:37:09 +01: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
Simon Hausmann
0d8b0630c7 Avoid inlining @image-url() expressions that can be expensive due to cache misses
If the `image-url()` expression of an `Image { source: @image-url("large-image.png"); ... }` gets inlined into geometry getters and other places that are called for every frame, then we might end up decoding images every frame, if the image isn't in the 5MB image decoder cache. It's better to rely on the `property <image>` of the `Image` for caching the decoded image, so don't inline those.

This fixes CPU being time being spent constantly on decoding images on the home automation lock screen.
2024-11-27 09:10:26 +01:00
Olivier Goffart
e44f7d7a4c LSP: fix reloading loaded dependencies
The change in https://github.com/slint-ui/slint/pull/6747
invalidated the cache, but it was only reloaded when one of the dependent was reloaded.
We need to reload the cache for all open file so that LSP feature continue to work on
open document even if they get no changes
2024-11-26 14:27:56 +01:00
szecket
ba14285332
Szecket/cupertino colours (#6801)
* creating a lookup table of colors based on the set on apple docs
then selecting from these colors rather than always typing hex
also added an in property for setting selected color (future)

* splitting out method of changing selection colour for later

* forgot to pull CupertinoColors from import

* Squashed commit of the following:

commit 4924aa908d6e039a7bf1f79ede3dc7c26f71007f
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 17:31:45 2024 -0500

    use  defined Palette for states

commit 80711ee7188f37b1b29ce11855b6a636d7a39306
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 17:29:51 2024 -0500

    make control colour consistent with style and other controls

commit 1cfd39e6da6643600e8b553dfab2418c8552cdc4
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 13:58:07 2024 -0500

    selection of controls when focused is not current cupertino style and too strong

commit 4bf4ae6ad385e118687f752362b34e079c03fe22
Author: szecket <szecket@magrittescow.com>
Date:   Fri Nov 15 13:42:58 2024 -0500

    make foreground color contrast when selected

* removing property that is only in cupertino
2024-11-22 08:18:27 +13:00
Olivier Goffart
c0a123b6b9 Callback arguments names is no longer experimental
ChangeLog: named callback arguments
2024-11-21 09:53:17 +01:00
Olivier Goffart
6e91b9bc91 Give name to the builtin element's callback argument 2024-11-21 09:53:17 +01:00
Olivier Goffart
f225f79d49 compiler: Put the argument names in the Type
That simplifies things a bit and will allow to have names for builtin callback and functions
2024-11-21 09:53:17 +01:00
Aurindam Jana
0898a5f641
Tweak Docs (#6834)
---------

Co-authored-by: Nigel Breslaw <nigel.breslaw@slint.dev>
2024-11-20 14:27:37 +01:00
FloVanGH
2200a64471
added min/max support for rem (#6842) 2024-11-20 10:19:28 +00:00
Olivier Goffart
5bd20def0e Experimental support for MenuBar
Introduces `MenuBar{ ... }` that can be put in a Window
2024-11-20 09:25:37 +01:00
Olivier Goffart
73b549a42c bundled translation: Better error reporting
forward the error up the stack instead of panicking while producing the llr
2024-11-19 21:34:42 +01:00
Milian Wolff
f6da161dbb
Reduce SmolStr <-> &str conversions and copies (#6688)
SmolStr has an Arc internally for large strings. This allows
cheap copies of large strings, but we lose that ability
when we convert the SmolStr to a &str and then reconstruct a
SmolStr from that slice.

I was hoping for some larger gains here, considering the impact
of this code change, but it only removes ~50k allocations,
while the impact on the runtime is not noticeable at all.

Still, I believe this is the right thing to do.

Before:
```
        allocations:            2338981

  Time (mean ± σ):     988.3 ms ±  17.9 ms    [User: 690.2 ms, System: 206.4 ms]
  Range (min … max):   956.4 ms … 1016.3 ms    10 runs
```

After:
```
        allocations:            2287723

  Time (mean ± σ):     989.8 ms ±  23.2 ms    [User: 699.2 ms, System: 197.6 ms]
  Range (min … max):   945.3 ms … 1021.4 ms    10 runs
```
2024-11-19 10:07:16 +01:00
Olivier Goffart
d68b84a3f1
Change API to set the language with bundle translation
* Change API to set the language with bundle translation

Part of #6793
2024-11-17 11:40:02 +01:00
FloVanGH
5ea05e18af
std-widgets: added horizontal-alignment to SpinBox (#6778) 2024-11-15 08:05:57 +00:00
Olivier Goffart
5b3ea5cdd5 LSP: record dependencies and invalid all dependents when a dependencies changes
Fixes #5797
2024-11-14 14:35:22 +01:00