Commit graph

12394 commits

Author SHA1 Message Date
FloVanGH
c84af1a8d7
std-widgets: added LayoutSpec global (#6711) 2024-11-06 14:47:04 +00:00
Olivier Goffart
e3ea25f48c LSP: Signature Help 2024-11-06 13:27:29 +01:00
szecket
c52fdd71bc
preview: attempting a header change to optimize usability (#6720)
changed the interaction for header view
both library and properties can be shown anytime
and selection is is a toggle button at any time
suggestions:
goes hand in hand with the selection mode
likely requires settings for toggle or single
select.

attempting a header change to optimize usability
TODO: make dragging from library automatically
into edit mode

the toggle that existed is the same as toggling a button - whcih can sit next to the closed library and properties.
properties should be editable while selection is active so those should be openable / visible whether in edit mode or not.

STILL TODO:
- make dragging from library automatically into edit mode
- add settings to either single select 'inspect' button or toggle on off
- change display of active icon OR add icon for toggled mode for clearer display than blue icon for inspect
2024-11-05 18:51:38 +01:00
Olivier Goffart
d40e28a6dc Update ChangeLog 2024-11-05 16:48:56 +01:00
Olivier Goffart
1941b8a40b SwipeGestureHandler: currectly grab the mouse
Fixes #6543
Fixes #6542
2024-11-05 15:49:32 +01:00
Olivier Goffart
3552e004e1 Fix wrong value or panic in the interpreter when converting struct of struct
The "tmpobj" variable was overwriten because the interpreter (contrary
to rust and C++) don't have scopes for the local variables, and local
variable of the same name would conflict.
(I think this could in theory be a problem in C++ and rust although i
haven't reproduced it)

Other uses of StoreLocalVariable also make the number unique with a
counter

Fixes #6721
2024-11-05 14:06:09 +01:00
Olivier Goffart
14adc2af2f Silence a warning in Qt headers 2024-11-04 20:45:04 +01:00
Olivier Goffart
dfefe9968a CI: update Qt, defaults to Qt6 for the linux binaries
Closes #6586
2024-11-04 20:45:04 +01:00
Olivier Goffart
d27c5dc198 LSP: add the function and callback argument name on the tooltips 2024-11-04 17:09:57 +01:00
Olivier Goffart
929e71e6b0 Widgets: add callback arg names to some callback
The ones that have a comment already.

Tests that the name is consistent accross the styles.
2024-11-04 17:09:57 +01:00
Olivier Goffart
51e4d4562a Do not print the internal struct name in LSP tooltip or error message
just strip the `slint::` or `slint::private_api::`
This is not a 100% match to the slint name (eg, LogicalPosition) but
it is better anyway
2024-11-04 17:09:57 +01:00
Olivier Goffart
b44172be4f Janitor: Remove BuiltinElement::reserved_properties
It was added when support for `font-metrics` was added, but there is no
reason why this can't simply be in the `properties` hash.
2024-11-04 17:09:57 +01:00
Brandon Fowler
6da0f55b05
Associate PopupWindows with an ID for their active popup (#6693)
Popups are stored in a HashMap and are assigned an ID so popup.close(); closes the correct popup and so a single PopupWindow cannot be opened multiple times
2024-11-04 09:17:55 +01:00
Tobias Hunger
d30dfc0175 slintpad: Always show preview when the first editor is opened
This makes sure we always have soemthing in the preview.
2024-11-02 19:22:47 +01:00
Tobias Hunger
f6731eb582 slintpad: Properly dispose of editors and related data
This makes sure we send content invalidation when closing
editors (by opening a new project).
2024-11-02 19:22:47 +01:00
Olivier Goffart
875ca075fb esp-idf: Fix vsync locking 2024-11-01 18:49:11 +01:00
Olivier Goffart
2d944b242c Support multiple PopupWindow
Fixes #4356

Still not perfect:
 - Calling several times `popup.show()` on the same popup, will open
   that popup multiple times (instead of being a noop once opened)
 - Calling `some-popup.close()` will always close the top of the stack,
   without considering if it is the `some-popup` or another popup.

Both problems are because we don't remember whether a particular popup
is open and we don't associate `close()` with a particular popup
2024-10-31 22:27:56 +01:00
Olivier Goffart
3ce0e49003 Qt: Fix PopupClosePolicy::CloseOnClickOutside 2024-10-31 22:27:56 +01:00
Ryan Naddy
908580b951
Added rejected to textedit (#6662) 2024-10-31 16:23:50 +01:00
Nigel Breslaw
5bd6c4b951
Improve the resolution the Home Automation demo runs at 2024-10-30 20:01:21 +02:00
Olivier Goffart
446bb4a6bf
swrenderer: signed distance field: properly round the x and y glyph coordinate (#6687) 2024-10-30 18:12:52 +01:00
Olivier Goffart
0f8e3b84b7 Janitor: fix doc comment 2024-10-30 10:43:40 +01:00
Olivier Goffart
45976bcf2b
Small polish of the appearence of small glyph with sdf
The trick is that we should have a constant delta, regardless of the
size of the individual glyphs.
2024-10-30 10:43:32 +01:00
Arnold Loubriat
17207b0508 Make accessible-position-in-set zero-based 2024-10-30 15:54:01 +08:00
Arnold Loubriat
97219c21bf Add the accessible-size-of-set property 2024-10-30 15:54:01 +08:00
Arnold Loubriat
67166fcc2d Add the accessible-position-in-set property 2024-10-30 15:54:01 +08:00
Olivier Goffart
d00655b059
Update MCU dependencies (#6682) 2024-10-29 21:35:51 +01:00
Olivier Goffart
7b1e8b4e12 Fix division by zero in distance field rendering
if the width or hight is one pixel, then the delta don't matter since we
will just draw one pixel anyway
2024-10-29 15:54:48 +01:00
Aurindam Jana
23c24b1033 Update Slint License: Move paid plans to Annex 1 2024-10-29 15:24:37 +01:00
Olivier Goffart
95f5685789
Bundle translations (#6661)
This currently doesn't have public API to enable it yet.

TODO:
 - Error handling in the compiler
 - Public API in the compiler configuration
 - Documentation
2024-10-29 15:07:15 +01:00
Milian Wolff
2f62c60e3c
Optimize resolve_expression to operate on a single scope vector (#6664)
Instead of cloning the vector on every iteration level, pass the
scope in and out of the visitation function and push/pop the element
there as needed. This way we can operate on a single vector that
gets moved around, which removes a few thousand memory allocations.
The speed impact is not measurable, as the code also triggers rowan
API that is much more allocation happy.

Still, I believe this patch is still merge-worthy as it also reduces
the code duplication a bit and is subjectively better, esp. from a
performance pov.
2024-10-29 11:46:04 +01:00
Olivier Goffart
1340a4902e
swrenderer: Always use an offset in the image when rednering glyphs (#6673)
Instead of using the trick of taking a sub-slice and pretending the
image was smaller than it is.
Then this is more uniform with all the other rendering path.
And this should prevent the panic in #6643

Fixes #6643
2024-10-28 14:37:00 +01:00
Olivier Goffart
6bb0e6038f
Merge the Callback and Function type
There is no need for two of these
This simplify some code

Amend efdecf0a13
2024-10-28 14:36:30 +01:00
Olivier Goffart
dff19c52da Fix assertion failed: lhs_lookup.is_local_to_component
Fixes #6632
2024-10-28 11:44:25 +01:00
Milian Wolff
89bc023819 Optimize: Filter/map rowan nodes instead of doing multiple lookups
Instead of doing potentially multiple calls in the chained calls,
each of which would allocate in rowan, we now only call the iterator
function once and then leverage `find_map`. This is arguably even
more readable and it removes ~300k allocations and speeds up parsing.

Before:
```
  Time (mean ± σ):     930.7 ms ±  15.1 ms    [User: 678.7 ms, System: 165.5 ms]
  Range (min … max):   906.4 ms … 956.3 ms    10 runs

    allocations: 2339130

```

After:
```
  Time (mean ± σ):     914.6 ms ±  22.7 ms    [User: 649.6 ms, System: 174.5 ms]
  Range (min … max):   874.8 ms … 946.3 ms    10 runs

    allocations: 2017915

```
2024-10-28 09:40:58 +01:00
Milian Wolff
79e1592b9f Intern some more common types
This is just for completeness, we "only" save ~13k allocations
with no measurable speed impact:

Before:
```
  Time (mean ± σ):      1.019 s ±  0.033 s    [User: 0.716 s, System: 0.203 s]
  Range (min … max):    0.957 s …  1.061 s    10 runs

        allocations:            2679001

```

After:
```
  Time (mean ± σ):      1.015 s ±  0.015 s    [User: 0.715 s, System: 0.201 s]
  Range (min … max):    0.997 s …  1.038 s    10 runs

        allocations:            2666889
```
2024-10-28 09:39:54 +01:00
Milian Wolff
df1dd3b6cf Use one central thread_local for builtin function types
Instead of occupying multiple TLS slots, introduce a single type
that stores all the builtin function types in members. Use a macro
to define this struct then, which allows us to use a nice DSL to
define these function types, reducing the boiler plate significantly.

The downside is that we no longer have the ability to easily share
semantically equivalent function types (e.g. for `Round`, `Ceil`
and `Floor` etc.). Doing so would require us to introdue a separate
name for these types, and then use external matching to map the
BuiltinFunctions to the reduced list of types. The performance impact
is minimal though, so this is not done to KISS.
2024-10-28 09:39:54 +01:00
Milian Wolff
6ff8abfb1a Move thread local types from typeregister into BUILTIN
This way we don't need a separate TLS slot for these two types.
2024-10-28 09:39:54 +01:00
Milian Wolff
6e9e66ea7d Refactor typeregister's BUILTIN_ENUMS => BUILTIN.enums
This will allow us to add more buildin types to this thread local
in follow-up patches, to reduce the number of thread local slots.
2024-10-28 09:39:54 +01:00
Milian Wolff
00dec34d34 Cache the reserved properties in a hash map for reserved_property()
The latter accumulates ~2.6% of all CPU cycles, Now, it only takes
1.3% by using the hash map here.
2024-10-28 09:39:54 +01:00
Milian Wolff
0abfb056a1 Also use Rc for langtype::Type::Array
This is rarely used, but using Rc here like elsewhere allows us to
elide a few unneccessary memory allocations when copying such types.
The speed impact is not measurable though. With heaptrack I see that
we get rid of the last ~7600 allocations in my benchmark when cloning
Type.
2024-10-28 09:39:54 +01:00
Milian Wolff
fd0eb01c55 Share common definitions for builtin function types
This way we can reuse a single reference counted type where possible.
2024-10-28 09:39:54 +01:00
Milian Wolff
0fc9f3574a Only allocate the BuiltinFunction::ty() return types once
These are known statically, so let's store them once in thread local
statics and return them from there.

Before:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```

After:
```
  Time (mean ± σ):     996.9 ms ±  17.7 ms    [User: 708.9 ms, System: 202.9 ms]
  Range (min … max):   977.8 ms … 1033.1 ms    10 runs

        allocations:            2686677
```
2024-10-28 09:39:54 +01:00
Milian Wolff
69c68b22b2 Also wrap langtype::Type::Struct in an Rc
This makes copying such types much cheaper and will allow us to
intern common struct types in the future too. This further
drops the sample cost for langtype.rs from ~6.6% down to 4.0%.

We are now also able to share/intern common struct types.

Before:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```

After:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```
2024-10-28 09:39:54 +01:00
Milian Wolff
efdecf0a13 Wrap langtype::Type::{Callback,Function} data in an Rc
This allows us to cheaply copy the langtype::Type values which
contain such a type. The runtime impact is small and barely noticable
but a sampling profiler shows a clear reduction in samples pointing
at langtype.rs, roughly reducing that from ~8.6% inclusive cost
down to 6.6% inclusive cost.

Furthermore, this allows us to share/intern common types.

Before:
```
Benchmark 1: ./target/release/slint-viewer ../slint-perf/app.slint
  Time (mean ± σ):      1.089 s ±  0.026 s    [User: 0.771 s, System: 0.216 s]
  Range (min … max):    1.046 s …  1.130 s    10 runs

        allocations:            3152149
```

After:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```
2024-10-28 09:39:54 +01:00
Simon Hausmann
e01a121165 Move weather demo to demos/ sub-folder 2024-10-26 09:39:52 +02:00
Ryan Naddy
58efd5312b
Added rejected to TextInput (#6649) 2024-10-25 17:24:47 +02:00
Simon Hausmann
1eb30a484a Fix home-automation wasm loading 2024-10-25 17:15:46 +02:00
Simon Hausmann
d81cc50699 Fix uefi-demo build after printerdemo move to demos 2024-10-25 15:13:19 +00:00
Nigel Breslaw
8ba87950ae
Add fonts back to Home Auto demo 2024-10-25 18:07:36 +03:00