Commit graph

1514 commits

Author SHA1 Message Date
Simon Hausmann
3db168d03d C++: Attempt to place embedded into read-only data sections 2023-07-20 16:20:51 +02:00
Simon Hausmann
917cecff85 Add support for embedding bitmap fonts in C++ 2023-07-20 16:20:51 +02:00
Guilhem Vallat
0ebcc2be70 remove clippy warning in rust code gen
This generated a `clippy::clone-on-ref-ptr` warning
2023-07-19 11:04:25 +02:00
Olivier Goffart
d5d772dcbd
Compiler: Visit the model and other "side" named reference in binding_analysis (#3109)
This is necessary for the `is_used` to be set properly

Fixes #3107
2023-07-19 09:53:38 +02:00
Aleš Katona
44fb865ad4
add row-pointer-event callback to tableview (#3082) 2023-07-19 08:34:24 +02:00
Florian Blasius
94ce4ebaee
Fixed text input on fluent and material SpinBox (#3101) 2023-07-18 07:43:37 +00:00
Eric
1b0d3b1061
Add edited callback for SpinBox (#3096)
* add edited callback for SpinBox
* fix compile error
* add inline comment for callback definition
2023-07-18 07:53:54 +02:00
Olivier Goffart
57e9b5b796 Don't panic when an unresolved alias has a binding
Fixes #3085

When there are both a binding and a two way binding, we must keep the
two way binding in our bindings map. Otherwise type inference will not
work
2023-07-14 14:13:48 +02:00
Olivier Goffart
c990660500 Run the import pass even when building the object tree fails.
This improve the code coverage of syntax_text, so some adjustment had to
be made.
This may add more error in the main file, but this make it the same
behavior as for imported files and lsp who were already running these
passes all the time
2023-07-14 14:13:48 +02:00
Simon Hausmann
59d869cb84 Fix missing invocation of init() on Items with C++
In Rust, register_component in the run-time library is called unconditionally and
invokes init(). The window adapter is an optional
parameter.

In C++, we'd call register_component only if we had a window adapter, which meant
that we're missing init calls().

Amends cd9994306e
2023-07-14 13:09:45 +02:00
Olivier Goffart
81e5d3bb36 Fix setting rotation-angle and opacity from a callback
... if they are not set as actual binding before

As reported in #3068

The problem is that the pass will properly create the Rotation or
Opacity item, but will not create the two way binding if there is no
existing binding. This causes code like `img.rotation-angle = ...` to
change the rotation angle of the image, but not its parent Rotation
item.
Fix it by making sure there is always a binding.

Since the change only affect visual representation, I abused one of the
screenshot test to test this feature. And I also patched another bug
that some #[allow(unused_parens)] was not set in the 'init' callback and
would cause a warning in the test
2023-07-11 20:07:49 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Tiller
94ecce4040 Added zero width to focus scope to prevent double-click to select a list item 2023-07-10 08:35:52 +02:00
Olivier Goffart
eb257774e8
Add modifiers to PointerEvent
* Add modifiers to PointerEvent

Closes #2686
2023-07-06 09:54:43 +02:00
Guilhem Vallat
3d30e81668 reduce rust generated file size
using `use slint::private_unstable_api::re_exports as sp;` should
allow to safely qualify everything will keeping things shorter.

For the `todo` example:
- before 1_050_650 octets for 24_012 formatted lines
- after 934_049 octets for 23_032 formatted lines

This also makes the generated code more readable if needed.
2023-07-03 16:36:11 +02:00
Guiguiprim
6db1c44d2a
Support button with only icon (#3024) 2023-07-03 12:17:46 +02:00
Olivier Goffart
0c71a94867 Remove dbg! 2023-07-03 10:10:54 +02:00
Olivier Goffart
03bed94072 Fix default geometry of items with inject_element_as_repeated_element
Fixes #3027
2023-06-30 17:35:29 +02:00
Guilhem Vallat
555e191ab4 remove clippy::needless_borrow warnings 2023-06-30 12:28:13 +02:00
Olivier Goffart
d4216385d8 refactor: extract the resource code generation in a function 2023-06-29 10:43:46 +02:00
Olivier Goffart
7a88dba2e7 Add clear-selection() to all our input fields 2023-06-28 17:07:55 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Tobias Hunger
8345c6cd79 Do automatic clippy fixes 2023-06-28 14:22:30 +02:00
Olivier Goffart
331e5713c2 C++: Use a static_assert to detect Slint version mismatch
cc #2909 , #223

New message:
```
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: error: static assertion failed: This file was generated with Slint compiler version 1.1.1, but the Slint library used is 1.1.0. The version numbers must match exactly.
    6 | static_assert(1 == SLINT_VERSION_MAJOR && 1 == SLINT_VERSION_MINOR && 1 == SLINT_VERSION_PATCH, "This file was generated with Slint compiler version 1.1.1, but the Slint library used is " SLINT_VERSION_STRING ". The version numbers must match exactly.");
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: note: the comparison reduces to ‘(1 == 0)’
```

Previous message:
```
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: conversion from ‘VersionCheckHelper<[...],[...],0>’ to non-scalar type ‘VersionCheckHelper<[...],[...],1>’ requested
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: could not convert ‘slint::private_api::VersionCheckHelper<1, 1, 0>()’ from ‘VersionCheckHelper<[...],[...],0>’ to ‘VersionCheckHelper<[...],[...],1>’
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                                                                                 |
      |                                                                                                                                                                 VersionCheckHelper<[...],[...],0>
```
2023-06-28 14:16:52 +02:00
Olivier Goffart
f0a1ef7194 Fix getting type of more complex expressions in model
Fixes #2977

The problem is that expressions such as "foo * foo" can be optimized by
optimization pass to only query the property once, and this is
transformed in a Expression::CodeBlock and is no longer a
Expression::Cast(Model)
So we need to introspect the expression more.
2023-06-27 10:06:20 +02:00
Olivier Goffart
a709402bf9 LSP: auto-complete relative to CARGO_MANIFEST_DIR in slint! macro 2023-06-26 18:44:34 +02:00
Olivier Goffart
56a58f704b Compiler: load import and other files relative to the CARGO_TARGET_DIR for .rs files 2023-06-26 18:44:34 +02:00
ogoffart
c8c9496722 Bump version number to 1.1.1 2023-06-26 12:50:02 +00:00
Olivier Goffart
9b59036816 Add licenses symlinks 2023-06-26 13:12:29 +02:00
Olivier Goffart
1b9e245b4e Remove the NativeSwitch
It is identical to the NativeCheckBox  (Qt don't have a switch widget)
2023-06-23 11:02:46 +02:00
Olivier Goffart
c260210d6d Janitor: update itertools 2023-06-22 15:03:10 +02:00
Aurindam Jana
78679030f9 Update About Slint widget 2023-06-22 12:55:45 +02:00
Olivier Goffart
31fc7cdd08 Janitor: Some dependencies update 2023-06-21 17:24:57 +02:00
Florian Blasius
82cc0683e8
Switched to relative-font-size for fluent. (#2951) 2023-06-21 15:37:42 +02:00
Florian Blasius
e3486542d8
Polish fluent design refresh (#2950) 2023-06-21 11:46:47 +02:00
Simon Hausmann
016d776b7d Simplify implementation of absolute-position
Since we materialize only one point property, we don't need to cache the
parent position in a separate property, but we can just store that in
the binding.
2023-06-21 10:02:04 +02:00
Simon Hausmann
ab0e38c76d
Merge absolute-x and absolute-y "virtual" properties into absolute-position (#2942)
The type of thep property is `Point`, which existed before. It was
mapped to `slint::private_unstable_api::re_exports::Point` (euclid) and
is now mapped to slint::LogicalPosition (also in C++).
2023-06-21 08:17:57 +02:00
Olivier Goffart
f1bc0eb4d3 Native LineEdit: use same min size as the other styles 2023-06-21 06:37:34 +02:00
Florian Blasius
18d56800c8
Adjusted structure of material widgets. (#2941) 2023-06-20 14:54:10 +02:00
Florian Blasius
2656dfad7d
Refactor ProgressIndicator api according to api review. (#2937)
* Refactor ProgressIndicator api according to api review.

* Update docs/language/src/builtins/widgets.md

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

* Capping progress also for native.

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-06-20 12:27:48 +02:00
Olivier Goffart
fdec5960bd Support for @rust-attr on enums 2023-06-19 22:40:49 +02:00
Florian Blasius
7784e37928
Fluent widgets refresh (#2928) 2023-06-19 17:04:56 +02:00
Simon Hausmann
653b63a35e Port to resvg 0.34 2023-06-18 08:58:09 +02:00
Simon Hausmann
c8f1f4354b Port to resvg 0.33 2023-06-18 08:58:09 +02:00
Olivier Goffart
300cb06ac8 Make sure we don't load internal files 2023-06-16 22:03:45 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Tobias Hunger
04d1229685 Fix licnese information using xtask 2023-06-16 09:14:20 +02:00
ogoffart
641cab0e75 Bump version number to 1.1.0 2023-06-15 16:01:28 +00:00
Olivier Goffart
033263127b
Qt Combobox: make it look proper when the style show the comobox in popup mode
As discusseed in https://github.com/slint-ui/slint/discussions/2893

Also initialize the current item the same way as fluent and material
2023-06-15 17:14:28 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00