Commit graph

1484 commits

Author SHA1 Message Date
Tobias Hunger
d785f2d5df compiler: Store an optional version number with the document
A None value means the file on disk is the golden version.

We have an editor, the LSP and the preview that all need to at least
notice when they have newer data then their peers. So IMHO it makes
sense to have an optional document version around.

The language server protocol makes use of a version number already. This
patch moves that code into the compiler so that it is stored with the
actual data getting versioned.
2023-12-18 14:21:50 +01:00
Olivier Goffart
4484fe647b Fix wrongly optimized properties with aliases
If we don't see that a native property is modified, it could get inlined
and we wouldn't detect changes

Fix #4072
2023-12-18 12:22:20 +01:00
Florian Blasius
e587c09d9c
Added colorize-icon to Button (#4152)
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2023-12-14 12:07:55 +01:00
Olivier Goffart
5d4c390b0f
Compiler: Error when assigning to compile time properties
Some property need to be known at compile time. We already had checks
that the binding is a compile time constant, but there was no check to
prevent, say

    self.row = 42;

which wouldn't work or could even cause panic or miscompilation of
generated code

Closes #4037
2023-12-12 21:51:56 +01:00
Olivier Goffart
6ebfad14db Fix panic in the interpreter when using visible in a ListView
This doesn't solve the issue #2537, but at least prevent the panic

Drive by change to fix compile when a struct is named `Box`
2023-12-12 14:01:55 +01:00
Florian Blasius
6da8120dfa
added palette global (#3984)
* Update docs/reference/src/language/builtins/globals.md

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

* Update docs/reference/src/language/builtins/globals.md

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

* Update docs/reference/src/language/builtins/globals.md

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

* Update docs/reference/src/language/builtins/globals.md

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

* Update docs/reference/src/language/builtins/globals.md

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


---------

Co-authored-by: Florian Blasius <florian.blasius@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
Co-authored-by: Florian Blasius <flovansl@fedora.fritz.box>
2023-12-11 14:44:05 +00:00
ogoffart
b081c489d6 Bump version number to 1.4.0 2023-12-11 11:21:37 +00:00
Olivier Goffart
63d199a728 Rust&C++: Fix Return value of complex expression
We were using the has_value of the previous expression of a sequence of
expression, instead of using the last expression type to know if there
is a value.

Fixes #4070
2023-12-08 17:28:38 +01:00
Tobias Hunger
2bdcbc8e9f
core: Add a double-click callback to the TouchArea (#4060)
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-12-08 12:12:41 +01:00
Florian Blasius
6d6b18300a
added focus state to StandardLIstView (#4086)
* added focus state to StandardLIstView

* (wip) focus handling for qt style

* Update CHANGELOG.md

Co-authored-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>

* Share StandardListView between all styles

* Update internal/compiler/widgets/material-base/combobox.slint

Co-authored-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>

* code review feedback

---------

Co-authored-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
2023-12-08 10:58:58 +01:00
Florian Blasius
c53a70db8d
fixed cupertino spinbox, move more code to base (#4083) 2023-12-07 14:53:31 +01:00
Florian Blasius
5d34c8307b
combobox fix mouse wheel selection direction (#4091) 2023-12-07 14:53:02 +01:00
Olivier Goffart
44ec841609 Fix lookup relative to the manifest path in .rs file
For the slint! macro, we need to lookup files in the manifest path.
The base_directory function regressed in commit 0ff8e2c.
This was not cought by the test because it had falled back to the `pwd`
with a warning, as we used to load ressources relative to `pwd` as a
fallback.
So also check that there are no warning (meaning updating the rest of
the test so that there isn't any warnings)

Fix #4045
2023-12-02 13:11:59 +01:00
ogoffart
b9255ab8e2 Bump version number to 1.3.2 2023-12-01 08:05:15 +00:00
Olivier Goffart
41f7275c35 Fluent: fix disabled LineEdit
The `color` is the Rectangle's deprecated alias to background. I wonder why we don't get a warning though.
It was meant to change the text-color
2023-12-01 07:25:00 +01:00
今何求
607bdbfcf8
Upgrade to fontdue 0.8
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2023-11-29 10:52:27 +01:00
Florian Blasius
e55bde4c97
fix lineedit callbacks (#4028) 2023-11-29 06:13:23 +01:00
Tobias Hunger
2ad9e07225 component_container: Add has-component property
... that returns a bool when a component is set up in the
ComponentContainer.
2023-11-28 10:38:46 +01:00
Florian Blasius
6963aefb7b make fluent scrollbar bigger 2023-11-27 22:21:52 +01:00
Olivier Goffart
017448893a
Fix LineEdit with right alignment (#4016)
* Fix LineEdit with right alignement

 - Align the placeholder the same way
 - Make sure the cursor is visible to the right (it is drawn outside of
   the TextInput, so some size need to be accounted for

(Discussed in https://github.com/slint-ui/slint/discussions/3996 )
2023-11-27 18:52:54 +01:00
Olivier Goffart
6195fc8567 Fix compilation when dividing by zero at compile time
Rust would have panicked and C++ generated wrong code.

CC #3982
2023-11-27 17:09:57 +01:00
Florian Blasius
c00a21d651
make use of textinputbase (#4014) 2023-11-27 08:50:29 +01:00
Olivier Goffart
a3e48c4950 Const propagation of min and max
Since we generate a lot of max(min, preferred) in the geometry code,
this allow to simplify some expressions in the generated code
2023-11-24 14:20:27 +01:00
Olivier Goffart
fdfa4b31e4 Visit the geometry property as root from binding_analysis
We need to visit them from there to mark them as used externally,
otherwise the remove_alias passes might remove them.

Fixes #4002
2023-11-24 14:07:42 +01:00
Olivier Goffart
e27a662019 Revert "Clip button texts"
This reverts commit 19e1cd8ac2.

This caused regressions as the button no longer have the proper minimum
size.

Fixes #3985
Reverts #3977
2023-11-23 08:53:12 +01:00
ogoffart
0a5bf6c37b Bump version number to 1.3.1 2023-11-23 07:47:07 +00:00
Tobias Hunger
2ad8774a61 Add clamp function to slint language 2023-11-22 12:27:54 +01:00
George Hopkins
19e1cd8ac2 Clip button texts 2023-11-22 06:49:33 +01:00
Florian Blasius
62e5fb43bf
align styling resources (#3973) 2023-11-21 14:45:07 +01:00
Olivier Goffart
678afb3ba0 Throw an error when returning no value when one is expected.
Previously we were likely to get error in the compiled code anyway.
(although the interpreter worked fine)

Fixes #3962
2023-11-20 13:50:57 +01:00
Olivier Goffart
8d91ff7dea
Fix compiler panic when there is a component called "Window"
the ensure_window and popupwindow passes were looking up the "Window"
builtin in the global register instead of in the builtin register,
causing the presence of an user-defined "Window" to cause panic.

The "Clip" and "BoxShadow" calls are not affected because they were
looking up in the builtin reguister, but using the appropriate function
is more future-proof

Fix #3916
2023-11-20 13:10:31 +01:00
Florian Blasius
aeace4c4ed
fluent: fixed scrollbar width / height (#3939) 2023-11-16 06:49:34 +01:00
Florian Blasius
95582e6794
fluent: make scrollbars overlay (#3932) 2023-11-15 19:04:02 +01:00
Olivier Goffart
7a04b9a643 Qt Spinner: different design without hardcoded strong colors 2023-11-08 12:04:18 +01:00
Florian Blasius
110689bad1
Added Spinner widget (#3871) 2023-11-07 15:04:24 +01:00
Simon Hausmann
a5c3692fbc Add progress-indicator accessible role 2023-11-07 13:37:12 +01:00
Olivier Goffart
34ea148c48 Fluent combobox: always put the first item on top
Currently it's always the second, but that's not great.
Ideally it should be the current active element, but that's hard to
compute

This becomes extra-relevent when our preview UI has a combobox on the
top and that it is clipped to the window by winit

Fixes https://github.com/slint-ui/slint/issues/3345
2023-11-07 11:12:27 +01:00
Tobias Hunger
d53cebd3e1 lsp: Get signalled by the preview 2023-11-03 22:14:20 +01:00
Olivier Goffart
f043234890 C++: fix (private) properties of type EasingCurve
tests/cases/properties/animation_props_depends.slint in previous commit
added a property<easing> and that didn't work with C++
2023-11-03 15:11:06 +01:00
Olivier Goffart
89c80f3b6d Fix animation expression not being visited for use count of property
resulting in properties being optimized when they shouldn't
2023-11-03 15:11:06 +01:00
Ken Carpenter
b20536131f
Add more easing formulas (#3812)
Closes #2655
2023-11-03 09:20:44 +01:00
Tobias Hunger
c2056075c0 janitor: Disable clippy::overly_complex_bool_expr in generated rust code
This makes clippy error out in our users code (using a nightly compiler).
2023-11-02 16:33:19 +01:00
Tobias Hunger
d62c98d574 janitor: Do not spam the build output with empty lines 2023-11-02 10:17:59 +01:00
Tobias Hunger
2adc3713fa janitor: Do not warn about unused imports in generated rust code
When testing, we have `deny(wanrings)` set, so this actully makes the
tests error out.
2023-11-02 10:17:59 +01:00
Tobias Hunger
b5c433dada janitor: Fix build warning about DefaultParser 2023-11-02 10:17:59 +01:00
Simon Hausmann
1e579eeb4e Make it possible to focus Cupertino and Fluent buttons
The Material button already has the forward-focus.
2023-11-02 07:24:42 +01:00
Tobias Hunger
83e37f7c51 component_container: Do not auto-match the parent's size
This fixes the widget having the right size and sifes some strange
issues I had been wondering about for a while now!

Pass own size to children instead, so that they will always have
matching sizes.
2023-11-01 17:25:42 +01:00
Olivier Goffart
ac8fd60091 Fix regression with empty array
Regression noticed in this line:
3f97d98bff/ui/tabs/downloads.slint (L77)

The following used to work:

```slint
import { Button, VerticalBox } from "std-widgets.slint";
export component Demo {
    in property <[int]> mods;
    VerticalBox {
        alignment: start;
        for xxx in true ? mods : [] : HorizontalLayout { alignment: center; Button { text: "OK!"; } }
    }
}
```

But we fixed array conversion and this caused a regression with empty
array
2023-11-01 11:30:59 +01:00
Olivier Goffart
8df1217261 Fix slint compiler panic in chiptrack
If a branch that always return has a "void value" and the side that
doesn't return has a value, we need to synthetize a default value
so the struct is complete, even if that value is not used.
2023-11-01 09:51:33 +01:00
Florian Blasius
10066c5eef
cleanup widgets according to upcoming code guidelines (#3771) 2023-10-30 10:45:25 +01:00