Simon Hausmann
883e3c472e
Fix Material Design's choice of default font
...
* Apply the "Roboto" family by default to the Window.
* Don't use "Roboto XXX" as that is not the name that's encoded as family name in the TrueType fonts. The variants should be chose based on the weight, not the family name.
* Don't apply the font family in the MD's LineEdit - that should not be necessary anymore.
2022-11-22 20:20:53 +01:00
Simon Hausmann
bddbd43fac
Apply the default-font-family from the Style's StyleMetrics if available
...
This allows the style to provide a default font family.
2022-11-22 20:20:53 +01:00
Olivier Goffart
73a16a171c
Janitor: upgrade a few crates
2022-11-22 18:38:05 +01:00
Simon Hausmann
fd64060b26
Fix placeholder text rendered on top of cursor when empty LineEdit is focused ( #1888 )
...
Render the placeholder underneath.
2022-11-22 17:51:41 +01:00
Olivier Goffart
395532cebd
Forbid former transitions declaration with the new syntax
2022-11-22 15:16:54 +01:00
Olivier Goffart
1ad6523960
Error message wording: remove the "TODO"
2022-11-22 15:16:54 +01:00
Olivier Goffart
51933b99bb
New syntax for transitions, within the state
2022-11-22 15:16:54 +01:00
Olivier Goffart
c1c52a2b86
Make the test pass without defining the SLINT_EXPERIMENTAL_SYNTAX env variable
2022-11-21 22:01:52 +01:00
Olivier Goffart
d2ade4fd98
Document and enable the in / out keywords with the old component syntax ( #1879 )
...
But it still defaults to `in-out`
2022-11-21 18:41:35 +01:00
Simon Hausmann
59d3a69688
Fix support for multiple import statements from the same path ( #1868 )
...
Importing multiple types from the same file with multiple import statements would produce an error.
2022-11-21 15:37:38 +01:00
Tobias Hunger
a4e070bdfd
compiler: Add support for handling binding expressions for the LSP
2022-11-21 15:01:09 +01:00
Olivier Goffart
39aebc1f4e
Use the std::ops::Range as range in the repeater
...
And fix the preview highlight to use that
2022-11-17 12:23:23 +01:00
Olivier Goffart
1884750960
WIP: LSP: highlight selected element in the preview
2022-11-17 12:23:23 +01:00
Florian Blasius
1e23f3c34f
md: fix api of LineEdit
2022-11-17 11:42:30 +01:00
Simon Hausmann
907b58161c
Add support for invoking an init callback on component and element construction
...
This enables imperative code to be run. To be used sparingly :-)
2022-11-17 10:12:08 +01:00
Simon Hausmann
7be00f6d60
Improve error message when a property declaration clashes with a callback
...
(also continue, don't allow the declaration to proceed)
2022-11-16 09:46:40 +01:00
Simon Hausmann
e6bd9dc8c4
Improve error message when a callback clashes with a property
...
(also continue, don't declare the the callback anyway)
2022-11-16 09:46:40 +01:00
Simon Hausmann
9bb9ac3c39
Disallow callback overrides as well
2022-11-16 08:56:30 +01:00
Simon Hausmann
27db2bdcc6
Disallow duplicated callback declarations
...
A duplicated callback would silently overwrite the previous declaration,
which is counter-intuitive.
2022-11-16 08:56:30 +01:00
Olivier Goffart
443a5f7657
Center element by default in their parent with the new syntax
2022-11-15 17:33:27 +01:00
Olivier Goffart
731fd45bf0
syntax_updater: Add binding for x
and y
for elements that would end up centered
...
In the new language, we plan to center the element within their parent,
so for compatibility, add explicit x and y binding putting them back in
the corner
2022-11-15 17:33:27 +01:00
Olivier Goffart
0318b52a4c
remove alias pass: make sure to keep priority correctly
...
Fixes the bug that caused the TextEdit in the gallery to sometimes be
empty.
Generated default value without any priority means it should not be
taken against a real binding if set
2022-11-15 13:19:20 +01:00
Florian Blasius
61c39b5fa1
Add support for dispatching key events through the public platform API
...
This change adds `KeyPress` and `KeyRelease` variants to the
`WindowEvent` enum, along with the new `slint::Key` enum, that allows
encoding keys.
2022-11-15 10:34:17 +01:00
Florian Blasius
575f093baf
Fixed: md TextEdit text not displayed ( #1854 )
2022-11-14 13:40:32 +01:00
Simon Hausmann
3498ccbc91
Speed up compiler syntax tests
...
Use rayon to run the compiler syntax tests in parallel. On my machine
that reduces the time from 11 seconds to 1.5 seconds.
2022-11-14 13:03:55 +01:00
Olivier Goffart
d2fdd161e9
Make sure that the Clip element created for a visible binding has an empty size
...
The `inject_element_as_repeated_element` will create width and height
binding that we should not have.
Fixes #1846
2022-11-14 12:46:46 +01:00
Olivier Goffart
b0d538fe4b
Fix rust code generation when comparing percentages
...
Fixes #1837
2022-11-11 16:28:44 +01:00
Olivier Goffart
6ab6ae63d4
input output property: fix semantic with two ways bindings
2022-11-11 13:02:53 +01:00
Florian Blasius
15d9a2665b
Update background of material slider ( #1841 )
2022-11-11 11:43:24 +01:00
Olivier Goffart
5b44cc54d9
Don't generate a native setter for out property
2022-11-09 18:48:19 +01:00
Olivier Goffart
8a7c9bc53d
janitor: Fix comiler warning
2022-11-09 18:48:19 +01:00
Florian Blasius
a3e1f9f246
Design refresh of the gallery example ( #1820 )
...
* Visual refresh of the gallery example
* Add new Navigation
* Improve layout
* Fix layout behavior of material GroupBox
2022-11-09 14:39:16 +01:00
Olivier Goffart
4556291e1a
Compiler: move the image and font embedding behind a software-renderer flag
...
Limit the dependency tree of things like the interpreter or the C++ compiler that
doesn't support it anyway.
It is still enabled inconditionally in slint-build though
2022-11-09 12:56:44 +01:00
Olivier Goffart
dd4c701307
Rename input
and output
property to in
, out
and in-out
2022-11-08 15:25:20 +01:00
Olivier Goffart
ca616857b1
Workaround compiler bug with Rust 1.64 and aarch64
2022-11-07 12:50:09 +01:00
Olivier Goffart
be7bc66e6d
Add a changelog and fix flacky change_sub_property_indirection test
...
The test was only failing in some cases with node because of the
inlining in the interpreter, and it depended in which order the property
were processed (they were in a hash)
A test property was added to also test the interpreter
2022-11-04 15:32:20 +01:00
Olivier Goffart
6f3a73abd7
Debugging aid: print the base component for repeater
...
(These component are not on their own and they are not prprocessed
separately by most passes)
2022-11-04 15:32:20 +01:00
Olivier Goffart
f4bd77461d
Remove the check_aliases pass
...
The behavior has now changed, so no need for the warning
cc #1394
2022-11-04 15:32:20 +01:00
Olivier Goffart
425b477874
Always keep the binding of the right in a two way binding
...
When having a binding such as
```
foo <=> bar
```
The default value will always be the value of `bar` regardless what's
the value of foo.
This change of behavior is the only one that makes sense bacause if we
are having repeater or if, this will be a problem. eg:
```
property <xxx> bar;
if (some_cndition) : SomeElement {
foo <=> bar;
}
```
Then we can't possibly take the default value of foo for the value of
bar since it depends on the condition. (and it is even worse in case of
repeater)
This is a change of behevior, this is why the tests have changed. The
cse of tests/cases/bindings/* were already covered by a warning since
0.3.0 so that should be fine. But the warning did not trigger for
builtin property such as `visible` (eg, input/visible_mouse test)
Also some internal two way bindings had to be reversed.
cc: #1394
2022-11-04 15:32:20 +01:00
Simon Hausmann
39121994ca
Always set Window.default-font-size
...
Permit the style metrics to provide a `default-font-size` and bind that
to the `Window` if set. If not provided, then the backend can set a
`default-font-size`. By ensuring that the value is non-zero at run-time,
we can later introduce a rem unit that can act as factor relative to
this non-zero font size.
2022-11-03 17:15:44 +01:00
Florian Blasius
7a01e3c0cb
md: adjust GroupBox, CheckBox and SpinBox ( #1812 )
...
Now it's also possible to toggle checked by click on the text of the CheckBox similar to fluent design
GroupBox now respect the minimum width of the title, to avoid elision
Adopt SpinBox: set focus when buttons are clicked #1795 on md SpinBox
2022-11-02 17:25:44 +01:00
Olivier Goffart
2ceafc6392
New syntax: Make it an error to set the value of a builtin output property
...
With the old syntax, this becomes a warning
2022-11-01 12:51:45 +01:00
Olivier Goffart
8dbe745fc4
Builtin elements: use the input output syntax
2022-11-01 12:51:45 +01:00
Simon Hausmann
65e4e7bf15
Bump resvg/usvg/tiny-skia dependencies
2022-11-01 10:44:33 +01:00
Simon Hausmann
cecdb330f8
material design style: Replace remaining uses of pt with px
...
This is consistent with the use of `px` for the sizes and matches the expected
conversion to css pixels.
2022-10-31 21:12:52 +01:00
Olivier Goffart
5613fc4416
Rename inout
property to input output
...
`inout` and `input` are too similar, so use a longer form for `inout`
CC https://github.com/slint-ui/slint/issues/191#issuecomment-1296176978
2022-10-31 14:57:52 +01:00
Florian Blasius
072d8fabcb
Add material, material-light and material-dark widgets ( #1784 )
...
Add material, material-light and material-dark widgets and make it available by the `env` `SLINT_STYLE`.
2022-10-31 14:54:50 +01:00
Olivier Goffart
53090ab489
Forbid usage of @children in repeated or conditional element
...
It leads to compiler panic, or errors in the generated code.
2022-10-31 14:13:42 +01:00
Tasuku Suzuki
6c4e4850f9
SpinBox: set focus when buttons are clicked
2022-10-29 09:19:55 +02:00
Olivier Goffart
84ae4d2928
New syntax: Only allow children if the component has @children
...
For compatibility reason, this is also allowed when inheriting
2022-10-28 17:45:37 +02:00