Commit graph

436 commits

Author SHA1 Message Date
Olivier Goffart
81cb89d374 C++: fix including the generated file in several translation units 2023-02-17 16:42:40 +01:00
Florian Blasius
1b04601750
std-list-view: bring selected into view (#2246)
* std-list-view: bring selected into view

* Update internal/compiler/widgets/fluent-base/std-widgets-base.slint

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

* code review

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-02-17 13:50:09 +01:00
Olivier Goffart
361526fb33 Update resvg dependency 2023-02-16 09:03:22 +01:00
Olivier Goffart
8934bf3bf5 Layouting: When propagating constraint to parent, use the explicit constraints...
in addition to the implicit constraints

Finishes #783
2023-02-15 17:07:33 +01:00
Olivier Goffart
03e9edee64 Fix compiler panic when an component's base is not inlined
An element with children must be fully inlined or the children array
can't be easily computed.
But the code wouldn't work if the base of a component was not inlined
2023-02-15 09:20:12 +01:00
Olivier Goffart
41157b9984 Fix visible property on the root of a component
Just like opacity and other properties, it needs to prevent inlining.

And also add the same warning as for opacity if it is used on the root
(the Window)
2023-02-14 13:28:54 +01:00
Olivier Goffart
4f00f268a5 Make the old syntax a warning 2023-02-14 12:38:39 +01:00
Olivier Goffart
ca7b2e0bb8 Harmonize style properties 2023-02-10 16:49:25 +01:00
Olivier Goffart
70f8c45d26 Add a test that styles are in sync
Closes #2051
2023-02-10 16:49:25 +01:00
Olivier Goffart
55ed3bc1f5 Compiler: use the new syntax for builtins.slint 2023-02-10 16:22:52 +01:00
Simon Hausmann
e09943ead5
Improve error message when trying to create a two-way binding to model data
Closes #2186
2023-02-10 13:13:15 +01:00
Olivier Goffart
6889dfa5f5 Rust: Make new(), run() and show() report errors from the backend
Fixes #2198
2023-02-10 05:00:03 +01:00
Simon Hausmann
02694f4992 Replace unwraps in compiler glyph embedding with diagnostics
As discussed with Olivier, fatal diagnostics are better than a panicing
compiler.
2023-02-09 18:16:29 +01:00
Olivier Goffart
acb41d8244 CPP: fix struct which have a field with the same name as the struct
The operator== reference the struct name, so if there is a
field with the same name, we should disambiguate

Fix  tests/cases/issues/name_conflicts.slint that was added in last
commit
2023-02-08 18:34:52 +01:00
Olivier Goffart
11d404a216 Rust: Avoid use statement in the generated code
So we avoid name conflict between user types and internal types

Fixes #2207
2023-02-08 18:34:52 +01:00
Simon Hausmann
047ab1d419 Fix run-time panic when combining forward-focus with text rendering in no_std environments
As outlined in #2199, there may be ways to trigger text layout code
through forward-focus before embedded fonts are registered. To fix this,
this patch replaces the init_code vector, which had the SetFocusItem
code before the font registration, with three explicit vectors for focus
setup code, code from init callbacks, and initial focus, and defines the
order in one central place in the copmiler (iter()).

Fixes #2199
2023-02-08 15:41:35 +01:00
Simon Hausmann
860f318f7c
Bump femtovg, rustybuzz, ttf-parser, and fontdb dependencies (#2191)
Mostly bugfix changes upstream with some minor API changes. FemtoVG is
no more limited to 24 gradient stops for the paint.
2023-02-08 09:56:53 +01:00
Olivier Goffart
eaa9db4911 C++: use size_t everywhere as index in our models
cc #2024
2023-02-07 15:25:44 +01:00
Olivier Goffart
dddfcf572d Fix const detection with two ways binding
The const detection for two way binding was not detecting change if one
of the property was set to a const value in a component using it.

This would cause the compiler to generate call set_content on one of the
property in a two way bindings, and later, the "const sentinel" be
present in the dependency list, causing crash.

To avoid segfault for similar bug in the future, added added an assert!
in the property system to detect that.

Fixes #2185
2023-02-07 10:27:37 +01:00
Olivier Goffart
9c20369653 Fluent style: cleanup unwanted properties
Don't make our widgets inherit element that we didn't want to expose in the API

The other styles will be synchronized with later
2023-02-03 20:29:26 +01:00
ogoffart
e7f48512ee Bump version number to 1.0.0 2023-02-03 11:07:15 +01:00
Olivier Goffart
d899257225 Fixup last commit: duplicated exports 2023-01-31 09:53:49 +01:00
Olivier Goffart
6e3610da93 Remove AboutSixtyFPS 2023-01-31 09:38:56 +01:00
Olivier Goffart
7290049a17 Fix panic parsing invalid linear grandient
If the last position expression is invalid due to an unrelated error,
the code that tries to do the interpolation was panicking with the
message "The last should never be invalid". (Because it assumed that
invalid meant that it was not set, and we added a 100% for that last
one if it wasn't set. But if it is set and invalid, this would error.)
2023-01-27 13:56:48 +01:00
Simon Hausmann
9180704d70 Warn about components that are neither used nor exported 2023-01-26 15:52:40 +01:00
Simon Hausmann
448b216bd8 Second stage of cleaning up the export handling of the slint root component
Commit 24dcef5fed added a warning for the
implicit export of last component. For 1.0, this commit makes it so that
the root component is determined by the last export in the file.
2023-01-26 15:52:40 +01:00
Olivier Goffart
5bb84c1d69 Remove deprecated Keys enum in slint language 2023-01-26 15:35:18 +01:00
Olivier Goffart
a0fb8bc771 Remove support of old SIXTYFPS_ env variable, and sixtyfps_widgets.60 2023-01-26 13:36:38 +01:00
Olivier Goffart
63cc68ea0c C++: Use concepts for the invokables 2023-01-26 11:35:16 +01:00
Olivier Goffart
7c55b9f925 Only apply the constraint to the parent with the new syntax
Also attempt to document it
2023-01-24 19:18:59 +01:00
Olivier Goffart
ee672d65f5 Fix panic when the binding loop is caused by accessing the same component twice
The component properties might be accessed through different paths so we
may still reach a case where we have to borrow something that is already
borrowed
2023-01-24 18:01:30 +01:00
Olivier Goffart
bc1afb6f8f Fix TabWidget::current-index bindings
The property set by the user was not kept because the binding went the
wrong way.

Also remove the undocumented (and equaly not working)
TabWidget::current-focused property from the public API.
The current-focused property is initialized by the tab.
2023-01-24 11:34:35 +01:00
Olivier Goffart
a0fdf94fb1 StandardTableView: Remove the editable feature for now
This commit can be reverted when we want to introduce it again.
There is a few bugs with the editable property:
 - The text is not in sync with the model if the model changes after an
   edit. (can be seen by making an edit and then sort)
 - The highlight of the current row doesn't work properly
 - We should probably only edit on double click or some shortcut instead
   of just clicking
 - The editable field exist but does nothing for the StandardListView
2023-01-24 07:31:29 +01:00
Olivier Goffart
66b848227b StandardTableView resizable columns 2023-01-23 16:26:49 +01:00
Olivier Goffart
fabebaa009 Adjust the look of the native StandatdTableView
- The header should be within the frame
 - Use the NativeStandardListViewItem so we have the right alternative
   row coloring and hover
2023-01-23 16:26:49 +01:00
Olivier Goffart
aad6cbbe07 StandardTableView: don't inherit from Rectangle 2023-01-23 16:26:49 +01:00
Simon Hausmann
24dcef5fed
First stage of cleaning up the export handling of the slint root component (#2095)
We implicitly export the last component of a .slint file to the generator.
Issue a warning when that happens and suggest to export it explicitly.
2023-01-23 15:19:49 +01:00
Simon Hausmann
629c7ed80e Remove undocumented and dysfunctional PathLayout
This type is poorly implemented and not documented. Let's remove it for now.
It shall remain available in the git history in the event of a resurrection.
2023-01-21 13:10:19 +01:00
Olivier Goffart
6e87385cb3 Style: Harmonize the in/out properties accross styles 2023-01-20 16:21:59 +01:00
Olivier Goffart
4a086d7ed2 Always generate the native struct for exported struct
Fixes #594
2023-01-19 15:42:32 +01:00
Olivier Goffart
95e07ff4fe Fix two way binding to global getting the wrong value
We should not move the expression from a component to a global because
there is a two way binding

Fixes #2064
2023-01-18 14:07:32 +01:00
Olivier Goffart
279f399adf Don't forget elements with box-shadow error
There may still be reference to them. We may panic in later passes.

Fixes syntax/basic/box_shadow.slint test
2023-01-17 16:29:13 +01:00
Olivier Goffart
b55ec6894a Layouting: forward the implicit constraint from the children to the parent
Closes #783
2023-01-17 16:29:13 +01:00
Olivier Goffart
6e4b1b3468 Rename the std-widgets files of style base so they are not considered as a style
This is just so they don't appear in the error message, and also not
being tested by #2076 (https://github.com/slint-ui/slint/pull/2076#issuecomment-1385408167)
2023-01-17 16:21:53 +01:00
Florian Blasius
520df46998
Update examples to new syntax (#2067)
* run slint-updater on examples
* manual syntax updates
2023-01-16 12:11:25 +00:00
Florian Blasius
ac5eaf495f
move cpp StandardListViewItem from private to public namespace (#2062)
* move cpp StandardListViewItem to public namespace
* Fix missing C++ docs for StandardListViewItem

The struct is originally defined in Rust in model.rs and cbindgen creates the
compatible C++ declaration. For doxygen
to see it, it needs to be emitted into slint_generated_public.h.

* Improve the StandardListViewItem docs a little bit
* move cpp StandardListViewItem to public namespace

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-01-16 09:06:36 +01:00
Simon Hausmann
96c80a2dd1
Fix crash when using an int model in a repeater with a negative value (#2063)
Make sure that we return an unsigned for row_count() in C++ and Rust by ensuring an unsigned int model at creation time.

For the interpreter this "worked" by chance as casting a negative floating
number to usize automatically caps at zero, and all values are stored as f64. For safety this patch
applies the same fix though, to be on the safe side.
2023-01-14 21:20:14 +01:00
Florian Blasius
f2aab576f4
Add StandardTableView widget (#2032)
* Text only StandardTableView with column and rows
* Text editing of cells
* Sort by column ascending and descending
* Variants of the TableView for native, fluent and material
2023-01-12 19:41:12 +01:00
Olivier Goffart
7947d44e59 Run the syntax_updater on our widgets
This is commit is just the output of running the syntax updater on the
files in the internal/compiler/widgets directory.
No extra manual steps were done.

Note: In order to run the updater, I did a hack so that the updater wouldn't
choke on internal item used by the styles by commenting out the check in
ElementType::lookup_type_for_child_element
2023-01-11 10:52:48 +01:00
Olivier Goffart
5fbf68a647 Compiler: use the empty type more often instead of the Rectangle
We have that type now, so it should be used when we don't really need a
rectangle
2023-01-10 22:23:53 +01:00