Commit graph

1484 commits

Author SHA1 Message Date
Florian Blasius
0b26ca79b3
Cosmic: updated TabWidget style (#4953) 2024-03-27 12:03:02 +01:00
ogoffart
6bf40989d9 Bump version number to 1.6.0 2024-03-27 07:49:22 +00:00
Olivier Goffart
028d075199 Fix code generation when the if branch has a value and there is no else branch
Fixes #4942
2024-03-27 08:30:32 +01: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
Olivier Goffart
18eea8602a Fix insertion point of @children
Don't always appends at the end

Fixes #4935
2024-03-26 18:14:14 +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
Simon Hausmann
f27c185daf
Add a released callback to Slider (#4821)
The released callback is invoked when the user finished changing the value, for example
when the arrow key is released.

As a bonus, for the Qt implementation this fixes a few bugs in the keyboard handling:
  - Handle orientation
  - Implement click-to-focus
  - Emit released also on key release

Co-authored-by: Luke D. Jones <luke@ljones.dev>
2024-03-26 14:15:52 +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
7e3c00be9c
Material style: fix text color
The text color for the text input that has the focus is the normal
"on-surface" color according to https://m3.material.io/components/text-fields/specs

Also fix the selection color of the TextEdit
2024-03-22 11:22:50 +01:00
Montel Laurent
fc0e8faae9
Accessibility: use tab-list for the tabwidget (#4909)
* Don't show tabwidget as tab
2024-03-21 17:48:42 +01:00
Laurent Montel
7ab5d7f5a1 Add missing accessibility in common textedit 2024-03-21 17:14:38 +01:00
Montel Laurent
1a57e9fc7a
Fix accessible-role of ProgressIndicator (#4912)
In other styles it's defined as progress-indicator.
2024-03-21 15:42:31 +01:00
Montel Laurent
da30fa2663
Add ListView accessibility role (#4911) 2024-03-21 15:20:43 +01:00
Montel Laurent
4844b84e0c
Add Treeview accessibility support (#4907) 2024-03-21 15:18:52 +01:00
Montel Laurent
c2517008d8
Add TextInput as accessibility role (#4899) 2024-03-21 13:39:31 +01:00
Olivier Goffart
8628624296 fmt: Fix formatting of function argument declaration
Fix #4892
2024-03-20 22:35:53 +01:00
Olivier Goffart
db08970324 Keep the optimized ElementRc around.
They can be used in as the Popup's parent_element which we need to get
to the parent's enclosing Component.
Since that parent_element is not in a RefCell, we can't change it.
parent_element is a Weak so if its optimized item is removed, we will
not be able to access it.

Fix #4884
2024-03-19 11:58:36 +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
ogoffart
20c570ab1d Bump version number to 1.5.1 2024-03-18 08:55:01 +00:00
Olivier Goffart
5c381fd73e Fix clipping and border-radius
Fix #4854
2024-03-14 23:48:16 +01:00
Simon Hausmann
78771e0e37 Fix panic when loading unsupported images in Rust
The call to load the image already prints a message to stderr, so don't
panic but return a null image instead - neither when calling load_from_path
nor when decoding embedded image data.

cc #4846
2024-03-14 23:04:43 +01:00
Tobias Hunger
28b96ca6f6 janitor: manual cargo clippy fixes
Semi-random selection of clippy topics that were
uncontroversial before:-).

Leaves about 84 deduplicated issues in the code base
according to clippy from nightly.
2024-03-14 13:42:38 +01:00
Olivier Goffart
b844f76842 Add test and fixup color red/green/blue fields 2024-03-12 11:36:30 +01:00
Luke D. Jones
8c60cc74be feat: color: add channel properties to color
Add extra properties to the `color` type.
- `red`
- `green`
- `blue`
- `alpha`
2024-03-12 09:42:30 +01:00
Olivier Goffart
c3a2ad1c45 fmt: format two way bindings 2024-03-11 10:39:55 +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
Wilston Oreo
bef532b5fc
Optional C++ namespaces (#4759)
Co-authored-by: Michael Winkelmann <michael@winkelmann.site>
2024-03-06 19:43:11 +01:00
Tobias Hunger
2e035fd0d1 compiler: Document function added in d0fc025bc8
... and remove code needlessly added in that commit,
too.
2024-03-06 14:25:21 +01:00
Tobias Hunger
d0fc025bc8 live preview: Do not drop on elements that can not have children
Slpit up `lookup_type_for_child_elemnt` (in the compiler) into the
part that looks at the element itself only (called `accepts_child_element`)
and the part that looks at the child.

When deciding whether we can drop something into another element in
the live preview, we know the child type is going to be OK, even when
the `TypeRegister` does not contain it yet (as it is not imported yet).
2024-03-06 12:15:10 +01:00
Florian Blasius
82d784a4d4
Cupertino: added pressed state to tab, fix animation (#4751) 2024-03-05 14:40:18 +01:00
Olivier Goffart
5fe68e1746 Fix animation when started from a different item tree
Fixes #4741

This commit move the property_binding_and_analysis from the inlining
pass to an associated funciton in the context.
Then re-use that from the rust and c++ generator to actually get the
right animation
2024-03-05 12:27:11 +01:00
Florian Blasius
22095ccf03
Cupertino TabWidget: Tweaked visual appearance (#4743) 2024-03-04 09:11:45 +01:00
Tobias Hunger
f62d5e0d4b Update internal/compiler/lib.rs
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2024-03-01 12:59:08 +01:00
Tobias Hunger
121cda19fd interpreter: Make sure the root document is in the TypeLoader
Refactor the code in the compiler a bit to allow using the
`TypeLoader` for the root document itself and use that in the
interpreter.

You need to run passes *before* the `TypeLoader` takes ownership
of the Document, so the `load_file` in `TypeLoader` needed a bit of
changing.
2024-03-01 12:59:08 +01:00
Tobias Hunger
06b04e71b5 compiler: Return the TypeLoader from compile_syntax_node 2024-02-29 19:35:52 +01:00
Olivier Goffart
100123901a Rust: move the call to ItemTreeVTable_static at mod level
... instead of having it in the drop implementation.
This is required to fix the `non_local_definitions` warning in nightly rust.

Part of #4706
2024-02-28 11:19:26 +01:00
Olivier Goffart
c71b58e556 Fix rust nightly warnings about unused import in tests 2024-02-28 11:19:26 +01:00
Tobias Hunger
48de2f83e4 compiler: Add layout debug info to all nodes when lowering layouts
This enables us to find all layouts e.g. in

```slint
component MyLayout inherits GridLayout { @children }

component FooBar {
   my-layout := MyLayout {
      Rectangle {
      }
   }
}
```
2024-02-26 22:19:29 +01:00
Paul Zinselmeyer
73e05aebdb Added flicked-Callback on Flickable
As requested in #1462, I've added a `flicked`-Callback that gets
triggered when the `viewport_x`- or `viewport_y` -Properties are changed
by a mouse drag or mouse wheel movement.
2024-02-26 12:17:31 +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
5e7ddf3a19 Image Tiling
(Doesn't work yet with 9slice)
2024-02-26 12:16:41 +01:00
Olivier Goffart
190273d293 C++: fix enum with dashes 2024-02-22 10:41:45 +01:00
Olivier Goffart
b5abee6c8d C++: fix compilation when class name has an underscore
Fixes: #4659
2024-02-22 10:41:45 +01:00
Olivier Goffart
2ab71db4f7 Update deps, including resvg 2024-02-21 12:30:33 +01:00
Olivier Goffart
fac0921579 Compiler: keep the layout debugging info next to its node 2024-02-21 11:33:37 +01:00
ogoffart
a0eed4e58e Bump version number to 1.5.0 2024-02-20 17:33:11 +00:00
Tobias Hunger
a8f912900b janitor: Fix warnings in nightly about redandant use 2024-02-19 17:05:21 +01:00
Olivier Goffart
dab4ea44cd Fix C++ compilation with nightly rust
```
error: casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused
    --> internal/core/item_tree.rs:1035:32
     |
1035 |             Pin::new_unchecked(&*(&**component as *const Dyn as *const u8)),
     |                                ^^^^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |                                    |
     |                                    backing allocation comes from here
     |
     = note: casting from `vtable::Dyn` (0 bytes) to `u8` (1 bytes)
     = note: `#[deny(invalid_reference_casting)]` on by default
```
2024-02-14 10:15:07 +01:00
Olivier Goffart
97067c3d65 Add 9slice information at runtime 2024-02-13 14:46:27 +01:00
Olivier Goffart
22d9fc9cf9 @image-url: Semantic analysis of the 9slice 2024-02-13 14:46:27 +01:00