Commit graph

186 commits

Author SHA1 Message Date
Olivier Goffart
a9f526491a Timer Element
Closes #5724
2024-08-16 16:36:38 +02:00
Olivier Goffart
3a12ebf7ab Report an error when accessing a function within a PopupWindow
instead of panicking

Fixes #5852
2024-08-16 10:31:13 +02:00
Olivier Goffart
9b71cf1a36 Math postfix member functions on numbers
Closes #5328
2024-08-15 14:52:13 +02:00
Olivier Goffart
5dfa8d56dc API review of the slint interpreter Compiler api
Closes #5466
2024-07-05 17:20:08 +02:00
Olivier Goffart
875d20f1ac Add test for deprecated import
Should have been part of a0dd978f8a
2024-07-03 16:44:31 +02:00
Olivier Goffart
66370b6bda
Add export { ... } from "....slint"; syntax. (#5533) 2024-07-03 12:50:40 +02:00
Olivier Goffart
f93729ffe2 Port LSP to slint_interpreter::Compiler
Add a feature to only generate a specified component.
2024-07-03 11:51:23 +02:00
Simon Hausmann
7896e645b2 Permit rotation properties on Text elements without children
This works with Skia, Qt, and FemtoVG.

cc #1481
2024-07-03 09:08:23 +02:00
Olivier Goffart
a63618fcfe Fix error messages with invalid change callback 2024-06-28 10:45:45 +02:00
Olivier Goffart
42a2c6a569
Only generate code for the exported Window
Have a warning when a component is exported from the main file and
doesn't inherit Window.
Unless it's the last component, for compatibility with Slint 1.6

Also don't warn in the interpreter
2024-06-25 15:13:06 +02:00
Olivier Goffart
539abfc550 Revert "Add a warning if a PopupWindow is in a layout"
This reverts commit 66652cdc1d.

The warning in the gallery are hard to fix because the component inherit
from a layout and there is nowhere to place the popups
2024-06-24 16:38:37 +02:00
Olivier Goffart
8933f3308c Remove the error when using @children on the root component
This complicates multi-component handling
2024-06-21 11:58:09 +02:00
Olivier Goffart
acb7da11d2 fix missing warning of missing export
... for last component when globals are exported
2024-06-21 11:57:49 +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
47a61dda10 Fix compiler crash with invalid code 2024-06-11 19:22:59 +02:00
Olivier Goffart
42704eee65 Fix @children in a PopupWindow
Fixes #5375
2024-06-10 22:18:06 +02:00
Olivier Goffart
66652cdc1d Add a warning if a PopupWindow is in a layout
This is not intuitive since the position of the PopupWindow will not be
handled by the Layout
2024-06-04 13:31:36 +02: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
8221e2e4b2 Fix stack overflow in purity check
Fix #5220
2024-05-29 06:42:37 +02:00
Olivier Goffart
bc8e18e148 Fix compiler panic when trying to set a function in a state
Fixes #5246
2024-05-28 17:25:15 +02:00
Olivier Goffart
61233d8f6b Only mark builtin StyleMetrics as deprectated.
User defined component or global named StyleMetrics shouldn't be deprecated
2024-05-28 13:45:56 +02:00
Olivier Goffart
25ef8f8711 Fix declaring callback alias that override a property
Do the check for existing property before handling of callback aliases

Fixes #5205
2024-05-10 13:50:04 +02:00
Olivier Goffart
0929e3dfc1 Slint: make the abs work with unit types 2024-05-08 19:04:22 +02:00
Olivier Goffart
af1aa2991e
Fix component that inherits from PopupWindow
This regressed in commit 12d904a71c
which changed the order of the pass to get the lower_popup pass before
the first inlining pass.
If by chance (which is likely if one have children), the component that
inherits from PopupWindow was inlined in that pass, it would be as
if it was not a component, and it would be removed from its parent.
But since it is no longer inlined, we need to support that case and
delay the removal when processing the component that holds that popup.
2024-05-06 13:20:25 +02:00
Olivier Goffart
c5f857ffc9 Change callback: gate behind experimental flag 2024-05-02 22:25:53 +02:00
Olivier Goffart
2e4d1f2427 WIP: work on changed callback 2024-05-02 22:25:53 +02:00
Simon Hausmann
10e5c228b7 Fix calling clear-focus() on non-focusable elements not producing an error 2024-04-26 11:09:11 +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
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
0f05089d5e Polish the C++ and Rust HSV API 2024-04-15 18:18:00 +02:00
Olivier Goffart
eb2b7bf178
Widgets: test that widgets have the same accessible-role in all styles (#5065) 2024-04-15 18:15:47 +02:00
Simon Hausmann
ae2e0197f8
Deprecate the use of StyleMetrics for users of the public API (#4947) 2024-04-15 17:07:05 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Olivier Goffart
ea0227098a Throw an error when a callback aliases itself
Instead of panicking
Fixes #4938
2024-03-26 18:14:31 +01:00
Simon Hausmann
68083243b2
Add an in-out boolean color-scheme property to Palette (#4701)
This allows applications to force dark/light mode, as well as determine
which mode is active.
2024-03-26 15:44:22 +01:00
Olivier Goffart
42a4286048 Fix missing error when calling argb() with too many arguments
This is technically a breaking change if someone was calling it with too
many args by mistake, but i think it's fine to do this as a bugfix
2024-03-22 14:57:07 +01:00
Olivier Goffart
c553eb4398
compiler: Don't panic when using foo.focus(something)
Just ignore the case where focus has more argument that planed as it has
been reported as an error earlier.

Also fix the error message for calling member function with the wrong
number of argument to not include the base in the count.

Fix #4883
2024-03-19 11:06:08 +01:00
Olivier Goffart
255dc59ef4 Rename @image-url(..., 9slice(...)) to @image-url(..., nine-slice(...))
As per API review:
 - In the Rust and C++ API we use `set_nine_slice_edges` because the getter couldn't start with 9
 - in english we spell number less than 10 with letters and this is a name
2024-03-07 17:01:57 +01:00
Tobias Hunger
06b04e71b5 compiler: Return the TypeLoader from compile_syntax_node 2024-02-29 19:35:52 +01:00
Olivier Goffart
11e8070726 Compiler: fix lookup of the model not seeing that the element is being repeated
The problem is that we were taking the whole `repeated` field and as a
result we wouldn't see that the element was being repeated and that we
shouldn't have to lookup id within it

Fix #4683
2024-02-26 12:16:51 +01:00
Olivier Goffart
22d9fc9cf9 @image-url: Semantic analysis of the 9slice 2024-02-13 14:46:27 +01:00
Olivier Goffart
6e2280ece3 Parse 9slice in @image-url 2024-02-13 14:46:27 +01:00
Simon Hausmann
7ce0bd493a Fix panic when using foward-focus with non-element binding
Since commit 6fefe75a1c the handling
of forward-focus bindings happens before the resolve_expressions pass,
which means that we cannot rely on type mismatch
error handling yet.

Fixes #4475
2024-01-30 10:09:07 +01:00
Simon Hausmann
6fefe75a1c Don't require components that use forward-focus to be inlined
Achieve this by generating a `focus()` function for such components
and call it from the outside.

This replaces the previous focus handling with what should be cleaner:

- Any `forward-focus: some-element;` is basically syntactic sugar for
 `public function focus() { some-element.focus(); }`.
- The init code gets simplified to calling focus() on the root, if it's
  available.

Since the `focus()` functions are now generated in the imports pass,
they become visible in the style checker. That means the checker
requires consistent focus handling between the styles.
2024-01-26 12:16:09 +01:00
Olivier Goffart
2564eede9f Compiler: avoid two error message when trying to call a non-existing function 2024-01-24 20:06:48 +01:00
Olivier Goffart
638985612c Test purity of model expression 2024-01-11 15:13:01 +01:00
Olivier Goffart
5aa6b424e3 Janitor: Optimize usage of is_dir/is_file
As suggested in https://github.com/slint-ui/slint/issues/4219

Closes #4219
2023-12-27 10:36:25 +01:00
Olivier Goffart
2ce161ced8 Parser: Hint for the mod function when parsing %
Was reported several times:
 - https://github.com/slint-ui/slint/discussions/4190
 - https://github.com/slint-ui/slint/issues/3980
2023-12-19 17:23:30 +01:00
Olivier Goffart
85526d772e Fix detection of properties when they are only used in two way bindings
Fixes #2166
2023-12-19 11:14:53 +01:00