Commit graph

1488 commits

Author SHA1 Message Date
Olivier Goffart
04e03ed197
Rust generator: don't run the init code twice for popups (#6447)
Don't run the `init=>` callback in popup twice

ChangeLog: rust: Fixed `init=>` callback on PopupWindow ran twice.
2024-10-04 17:17:36 +02:00
Olivier Goffart
d6706494a5
Binding between a read only property to input-output is deprecated (#6419)
ChangeLog: deprecated two way binding between `in` and `in-out` property

Fixes #6400
2024-10-01 16:00:06 +02:00
FloVanGH
fd9807515f
TextInput: use selection colors from palette (#6381)
* Update internal/compiler/builtins.slint

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>

---------

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2024-09-30 10:56:22 +00:00
Olivier Goffart
53e79000a4
Layouting: Take in account explicit constraints when generating layout info base on content (#6306)
Fixes #6285

ChangeLog: Fixed geometry constraints when they are partially infered
from the content, and partially infered from the explicit constraints
2024-09-30 10:57:23 +02:00
Florian Blasius
71d1d814ce Revert "TextInput: use selection colors from palette"
This reverts commit 044518ee81.
2024-09-30 08:43:41 +02:00
Florian Blasius
044518ee81 TextInput: use selection colors from palette 2024-09-30 08:41:41 +02:00
Olivier Goffart
cfa115affa LSP: changed callbacks auto-completion
ChangeLog: LSP: auto-completion of changed callbacks
2024-09-26 18:20:03 +02:00
Olivier Goffart
61565e1ba9 Visit expressions of changed callback during binding analysis
Fixes #6331  (second part)
2024-09-26 17:54:21 +02:00
Olivier Goffart
87d72a8553 Fix changed callback of an unused property
If the property was not used, it was optimized out and the compiler
would panic
Fixes #6331

ChangeLog: compiler: Fix changed callback of an unused property
2024-09-26 16:51:31 +02:00
Olivier Goffart
8ac0c792e8 Update derive_more 2024-09-26 09:14:58 +02:00
Olivier Goffart
a9aa8bca42 compiler: Simplify a function now that we can use rust 1.77 2024-09-26 09:14:58 +02:00
ogoffart
eb273a63ee Bump version number to 1.9.0 2024-09-25 11:49:15 +00:00
Josh Wood
6a131e2648
Added PropertyAnimation.direction property for controlling animation direction (#6261)
Closes #6260

ChangeLog: Added property for controlling animation direction
2024-09-24 19:55:24 +02:00
Olivier Goffart
9a1e3c40cc Fluent CheckBox: text should be using the normal text color
ChangeLog: Checkbox: fix text color in fluent style
Fixes #6239
2024-09-24 10:38:13 +02:00
Enyium
4509496143
Improve layout-related error message. (#6264)
The phrasing shouldn't be universal, so users aren't taught it would always apply to *all* kinds of layouts.
2024-09-24 09:43:02 +02:00
Simon Hausmann
cd2b738c7a Rename SwipeGestureRecognizer to SwipeGestureHandler
The origin of this proposal is the name of the `swipe-left`, etc.
directional, boolean properties. They're missing another verb in their
name. In principle the right choice would be "recognize". That is what
the type name suggests, that's the term the documentation uses, so the
code should read `recognize-swipe-left: true;`. However that is a long
word. "Handle" is a verb that's simpler. It's also more generic (that's
a downside), but it's otherwise short enough to make things look
"right":

```
SwipeGestureHandler {
    handle-swipe-left: true;
    swiped => { something.naviate-left(); }
}
```

Therefore this patch proposes to rename the type to SwipeGestureHandler
and prefixes the boolean directional properties with "handle".
2024-09-18 16:37:27 +02:00
Olivier Goffart
d2bd5366f4 Timer::set_interval
Don't return an Option, just return 0 when the timer is not started.
As discussed in the API review, the rational is that the interval is
just like a field in a struct and when the struct is default
constructed, it is initialized to 0
2024-09-18 09:24:39 +02:00
Olivier Goffart
bcdc3e1cee Timer: make the interval property mandatory
A default of 0 is not a great default because that's way too often
2024-09-18 09:24:39 +02:00
Olivier Goffart
02467bd4cc
Change mod() to always return positive number (#6179)
* Change `mod()` to always return positive number

Closes #6178

ChangeLog: The mod function was changed to always return a positive value (#6178)
2024-09-17 11:37:32 +02:00
FloVanGH
4b6b64f521
Select text on SpinBox on double click (#6157)
* Select text on SpinBox on double click

* Update CHANGELOG.md

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

* Code review feedback

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-09-16 09:01:10 +00:00
FloVanGH
2e383e3d84
Fixed button of cup. ComboBox not centered on bigger height (#6155)
* Fixed button of cup. ComboBox not centered on bigger height
* Update CHANGELOG.md

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

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-09-16 07:30:23 +00:00
Arnold Loubriat
7e236017a7 Apply AccessibleRole::ListItem to the standard ListItem component 2024-09-16 09:15:39 +02:00
Olivier Goffart
3b6cc0f8cf Flickable: size in % bow refer to the Flickable's size instead of the viewport
This is consistant so that `width: 100%` is the same as `width: parent.width`

This basically revert the previous commit that was just working around
the debug_assert to actually fix the behavior

ChangeLog: width and height expressed in `%` unit for an element in a
Flickable now refer to the size of the Flickable instead of that of
the viewport
2024-09-12 09:45:24 +02:00
Olivier Goffart
e98780fafc Fix compiler panic when using % size in a flickable
The viewport of a flickable is of ElementType::Native, and `lookup_property`
don't query the builtin reserved properties in that case.

This commit fix the assert by allowing Type::Invalid as well.

Fixes #4163
2024-09-12 09:45:24 +02:00
Olivier Goffart
3bc758bc3f Janitor: deps update 2024-09-11 17:19:36 +02:00
Olivier Goffart
7d446c98a0
Fix generated setter and getter of public property alias in globals
We need to skip the generation of the local property so it directly
forward to the alias in the public property

Fixes #5855
ChangeLog: Fixed generated getter and setter of alias properties in globals
2024-09-11 08:35:38 +02:00
Olivier Goffart
0c8a9fcefb Fix compiler panic when accessing path.commands in expressions
Fixes #5564
2024-09-10 13:36:09 +02:00
Olivier Goffart
ea3072d696 Path: fix panic when accessing properties on sub commands
We need to keep the ElementRc around with its properties so that
accessing them doesn't panic later
2024-09-10 11:44:13 +02:00
Olivier Goffart
5663ddd9cc
SwipeGestureRecognizer (#6005) 2024-09-09 14:40:55 +02:00
Olivier Goffart
0feb674612
unmark changed callback as experimental
Closes #112
2024-09-09 14:40:16 +02:00
Nigel Breslaw
482308f5da
Add Math.atan2 to the inbuilt math function
Math.atan2(y, x) -> angle
2024-08-30 09:55:10 +02:00
Olivier Goffart
1d3e9120d8 Avid reporting further error when an element is misspelled
eg, don't report an error for each callback or animation or changed
event that the the property doesn't exist or such.

Also reword the message when an element doesn't exist. Use "element"
rather than "type" as it is more accurate.
2024-08-29 13:10:35 +02:00
Enyium
5a796e6dc0
Change debug() separator from , to . (#5997)
This is also how JavaScript's `console.log()` behaves.

Fixes #5991.
2024-08-29 12:02:13 +02:00
Tobias Hunger
bacae03919 compiler: More wrappers around rowan methods
... in SyntaxNode and SyntaxToken.

And do a small code cleanup enabled by this.
2024-08-28 18:02:47 +02:00
Olivier Goffart
bf1b014840 Timer: fix timer when two timers have the same id
We need to give unique name to optimized item as well, otherwise the
properties ends up the same.

Also fix the optimized element and timer when inlining

Fixes #5977
Fixes #5976
2024-08-28 16:21:34 +02:00
FloVanGH
5b8f68f43b
visual clamp slider (#5967) 2024-08-28 10:41:24 +00:00
FloVanGH
039f33eaae
Added scrolled callback to ListView and ScrollView (#5964) 2024-08-27 10:18:43 +00:00
Olivier Goffart
f57cd6735b janitor: better panic message when accessing wrong NamedReference 2024-08-27 12:01:54 +02:00
FloVanGH
c9f005b40a
Fixed TimePickerPopup does not open minute view by click on selected hour (#5959) 2024-08-27 09:56:55 +00:00
FloVanGH
7a0c3dcc50
Do not trigger current-item-changed on StandardListView if current-item is set on the same value (#5958) 2024-08-27 07:22:18 +00:00
Tobias Hunger
d28b13cbe5 lsp: Remove explicit rowan dependency from LSP
... by implementing more helpers on `parser::SyntaxNode` and
`parser::SyntaxToken`.
2024-08-26 14:51:47 +02:00
Tobias Hunger
90e55bd29f compiler: Fix a couple of clippy issues
Nothing major, nothing controversial, just killing time
while waiting on CI.
2024-08-26 08:45:52 +02:00
Olivier Goffart
47028bce27 Fixed inlining updating property use count 2024-08-23 17:17:15 +02:00
Olivier Goffart
5f77808d1c Optimization: improve expression inlining
If a property is only used once, we can inline it with a bigger
threshold.
But this require to first compute the use, and then do the inlining
while adjusting the usages
2024-08-23 17:17:15 +02:00
Olivier Goffart
4de03fba5b Use f32 for float-to-string conversion
Because f64 has too much precision, so limit to f32 so that we don't
have extra precision we don't need and would be wrong as all our float
as in f32

(Also avoid double allocation in rust generated code)
2024-08-23 16:09:53 +02:00
Tobias Hunger
45c24803f2 compiler: Remove version info from SourceFile again
... and fix the fallout of that change.
2024-08-21 16:55:13 +02:00
Olivier Goffart
85063dc4dc Fix rust generated code with struct of percent value
We wouldn't detect percent as a unit product in
43c7f57b0f/internal/compiler/generator/rust.rs (L2418-L2422)

Percent is not strictly of percent unit because that unit doesn't
combine with other unit (as per the comment in `default_unit`)
But since it converts to number, it is then an unitless value. (scalar)

Fixes #5887
2024-08-21 14:48:22 +02:00
Olivier Goffart
e0ca9dfd76 Fixes rust generated code when taking expression of void callback
code like so:
```slint
callback foo();
if true : Button {
   clicked => {
      true ? foo() : foo();
   }
}
```

the code like foo() use the `option.map()`  to get to the parent, but then it
needs to still be wrapped in a `{...}` to convert that to a `()` expression

Fixes #5883
2024-08-21 11:52:15 +02:00
Olivier Goffart
12820c809f compiler: enable use of internal features when the experimental flag is set
This allow to preview/edit the widgets with the lsp's preview when the
experimental mode is enabled
2024-08-20 18:02:39 +02:00
Olivier Goffart
686f5e43e2 Widget style: simplify -light/-dark handling
Instead of having all style duplicated and re-using a base, we just hack
into the funciton that queries the dark/light theme based on the style
suffix known at compile time.

This removes one of the problem that happens when trying to work on the
widget style with the extension, as it relies on include path hacks
2024-08-20 16:55:15 +02:00