Olivier Goffart
51481b101c
Make conversion from float to int property truncate
...
- Make sure that in Rust and C++ we also truncate if the properties are
inlined
- Change the interpreter to truncate
This is a redo of commit f5d003d
but truncate instead of round
fixes #5689
2024-08-10 14:51:05 +02:00
Olivier Goffart
819e549278
Rust generated code: handle the case if the parent is destroyed in a binding
...
This can happen if somehow the parent get destroyed while a binding is
running. This is issue #3464
This is enough to fix #5698
2024-08-09 15:05:15 +02:00
Olivier Goffart
4622025969
Use less precision when comparing vaue in slint language
...
In rust, use f32 instead of f64 for arithmetic comparison.
In the interpreter, use approx_eq
The test is failling in nightly because of precision change in `log`.
By using f32, it actually should work
Also Revert "Disable builds with nightly Rust temporarily"
This reverts commit 4afc3a2e84
.
Fixes #5722
2024-08-08 14:30:25 +02:00
W Etheredge
80ae11cd80
Use associated constants on number types
2024-08-01 07:53:48 +02:00
Simon Hausmann
8a7db55bb6
Route debug() calls in Slint consistently through Platform's debug_log() ( #5718 )
2024-07-29 16:31:09 +02:00
Simon Hausmann
9a34789070
Revert "Fix conversion to from float to int"
...
This reverts commit f5d003d1e2
.
We decided to postpone this change until a later release, in maybe a
different shape.
2024-07-25 15:25:00 +02:00
Olivier Goffart
f5d003d1e2
Fix conversion to from float to int
...
Round the value.
The previous behavior is that
- For the interpreter, we were rounding (same as new behavior)
- for Rust and C++ we were truncating, unless the properties were
inlinined and then we were keeping it as float
2024-07-23 17:32:57 +02:00
Olivier Goffart
a957b7fd98
Rust: Ignore dead code warning for unused enums
...
Strangely I wasn't able to reproduce the problem in a test, and we already have tests
that have enums which are not fully used.
Fix #5661
2024-07-23 13:33:51 +02:00
Olivier Goffart
e67e46ab47
LLR: merge the popup's x and y property access in one expression
2024-07-10 17:54:03 +02:00
Simon Hausmann
419042f476
Add support for using own properties in PopupWindow's x and y properties
...
This allows positioning popup windows in a way that takes their width/height into account.
2024-07-10 13:43:41 +02:00
Olivier Goffart
14593a55e1
llr: Don't generate unused globals
...
Global for which none of the properties are used can be omitted in the
generated code.
2024-07-04 10:24:54 +02:00
Simon Hausmann
0f158e10dd
testing api: Avoid bogus warnings about missing debug info
...
A `Rectangle { clip: true; }` will generate an intermediate `Clip` rectangle, which
certainly has no debug info.
The check whether debug info is present or not should not be done on a per-element
level but it can be done on the level of the compilation unit.
2024-07-03 18:01:24 +02:00
Olivier Goffart
59942df91f
Add some tests and fixes for change handler
...
Make sure that when inlining, the callback in the sub component
is executed before the root
Fix a warning in the generated C++ code
2024-06-28 10:45:45 +02:00
Olivier Goffart
c19dbc0cfc
Rust: Rename the slint_generated module to its old name
...
Some project on github were reaching into that module so it cannot be
renamed
2024-06-26 13:39:58 +02:00
Olivier Goffart
bd18d8dc0a
Fix compiler crash when const propagating a property of component-factory
with its default value
...
We couldn't represent an empty component factory in the exrpession tree,
so add Expression::EmptyComponentFactory for that
2024-06-25 20:25:01 +02:00
Tobias Hunger
cd3b60c889
janitor: Fix clippy "creates a reference which is immediately dereferenced"
2024-06-24 14:59:47 +02:00
Olivier Goffart
3764312561
Generate multiple components in Rust and C++ ( #5449 )
...
When lowering to the LLR, generate one PulbicComponent for each exported
component in the main file
Closes #784
2024-06-24 10:03:19 +02:00
Olivier Goffart
408637a677
Remove the is_root_component within the component
...
There will be serveral roots, so this makes no sense.
2024-06-21 11:58:09 +02:00
Olivier Goffart
a4c0cc9f09
Move the used_types from the (root) Component in the Document
...
Preparation for multi-components
Note that this had to rename one instance of TextStyle because it
conflicts with the struct of the same name used in the FontSettings
in the style. This wasn't a problem before because it shares some
property in common, and the the order of processing of component has
changed leading to the other one being generated.
(But that is a wider bug in the compiler outside of the scope of this
refactoring)
2024-06-20 12:03:38 +02:00
Olivier Goffart
2fd8744cfc
compiler: Move embedded_file_resources from the root Component to the Document
2024-06-20 12:03:38 +02:00
Olivier Goffart
62e0fdd5bd
Rust: Attempt to fix the stack overflow when constructing the item array
...
Workaround from https://github.com/rust-lang/rust/issues/53827
2024-06-17 10:16:53 +02:00
Olivier Goffart
d0ed0438ce
LLR: peliminary support for multiple public components
...
There currently still can only be one because the passes expect that,
but now the LLR and generator should be ready to accept multiple public
component later
2024-06-15 14:44:11 +02:00
Olivier Goffart
d0cdebfee6
C++: move globals in a different struct
...
So that subcomponent don't depend on the root component name
which will hallow to have several root components
2024-06-14 16:26:53 +02:00
Olivier Goffart
f343780462
Rust generated code: move globals and window in a separate Rc...
...
... that is independent on the root component type, so we could support
several different root component sharing the same sub-components and
globals
2024-06-13 16:05:59 +02:00
Olivier Goffart
4cc6337c42
Rust: Don't get the default font size through the root component
...
Planning for multi-component support
2024-06-13 13:53:07 +02:00
Olivier Goffart
42704eee65
Fix @children
in a PopupWindow
...
Fixes #5375
2024-06-10 22:18:06 +02:00
Olivier Goffart
3f80b5ba59
Ignore all clippy warnings in generated code
...
We don't want user to see clippy warnings from our generated code
Relates to #1874
2024-06-06 11:55:37 +02:00
Olivier Goffart
445802c46d
date_time: simplification and cleanups
2024-06-06 09:03:50 +02:00
Olivier Goffart
3da0ee5bb9
DatePicker: Logic in C++
...
Had to simplify a bit the rust logic to make it work
2024-06-06 09:03:50 +02:00
Florian Blasius
973ecac989
DatePicker: finished features
2024-06-06 09:03:50 +02:00
Florian Blasius
3ccee816be
Added TimePicker widget ( #5251 )
2024-06-05 15:23:06 +02:00
Simon Hausmann
15b517a554
Emit a warning to stderr (debug_log) when using the ElementHandle API but there's no debug info present
2024-06-05 01:29:58 -07:00
Simon Hausmann
1a8ce3c659
Add support for optimized rectangles in ElementHandle
...
Keep merging elements, but remember the boundaries in the debug info, separated by a slash.
Also fixed tests that rely on accessible-label being set only once. For example
```
Button { text: "foo"; }
```
will certainly have "foo" as accessible-label on `Button`, but its internal `Text` element has
an implicit "accessible-label" set to the same
value.
So don't rely on that for now but search by id instead.
2024-06-05 01:29:58 -07:00
Simon Hausmann
4eef2d4936
WIP: Add find_by_element_type_name
2024-06-05 01:29:58 -07:00
Simon Hausmann
a52fe6bbfc
Make element debug information configurable
...
The `SLINT_EMIT_DEBUG_INFO` environment variable needs to be set for Rust and C++ builds. For the interpreter it's always enabled, since ... we have it.
2024-06-05 01:29:58 -07:00
Olivier Goffart
43a336b534
C++ part of element_ids
...
Simplify a bit the llr generation so that there is less code duplication
between Rust and C++
2024-06-05 01:29:58 -07:00
Olivier Goffart
8add2e4ebd
element_ids: Can't return a SharedString by value from the vtable
...
also compile the LSP
2024-06-05 01:29:58 -07:00
Simon Hausmann
73b5136f98
WIP: Search by qualified element id
2024-06-05 01:29:58 -07:00
Aurindam Jana
3523e86359
Simplify commercial license ( #3063 )
...
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license ( #5257 )
...
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Olivier Goffart
1040946d7f
Fix rust warnings in generated code with changed callbacks
...
We sometimes generate dead code or unused variables for our expressions.
Most code is already covered with the `#[allow]`, so we need to also
allow it for callbaks
2024-05-27 17:51:02 +02:00
Olivier Goffart
5c3732c74e
C++: fix string to float so that it doesn't depends on the current locale
2024-05-07 14:58:07 +02:00
Olivier Goffart
80f37a3acf
C++ ChangeTracker implementation
2024-05-02 22:25:53 +02:00
Olivier Goffart
cadcd4caf4
Change callback: rust code generation
2024-05-02 22:25:53 +02:00
Simon Hausmann
31767eb6ab
Add a clear-focus()
function on all elements that have a focus()
function
...
This is the counter-part, which removes focus from the element if it's currently focused. The window - if focused - may still be focused towards the windowing system.
2024-04-26 11:09:11 +02:00
Olivier Goffart
5a4713aa17
C++: add #pragma once
to generated file
2024-04-22 13:06:05 +02:00
Olivier Goffart
64404ceca2
accessibility: return an Option for accessible string values
...
So we can know whether the item had the property set at all or not
2024-04-19 11:23:26 +02:00
Olivier Goffart
13127dc71c
Accessibility: Add support for accessibility-action-* callback ( #5073 )
...
Merge branch 'feature/accessibility'
Conflicts:
internal/compiler/widgets/cosmic-base/button.slint
internal/compiler/widgets/cupertino-base/button.slint
internal/compiler/widgets/fluent-base/button.slint
internal/compiler/widgets/material-base/button.slint
Also updated license header in actions.slint
2024-04-16 15:02:25 +02:00
Olivier Goffart
bd112a3021
C++: fix code generation of functions that don't return anything
...
and whose expression return something. Otherwise we get an error:
`return-statement with a value, in function returning ‘void’`
2024-04-16 14:50:55 +02:00
Olivier Goffart
0f05089d5e
Polish the C++ and Rust HSV API
2024-04-15 18:18:00 +02:00