Commit graph

889 commits

Author SHA1 Message Date
Olivier Goffart
e57627d535 Use the new syntax in more tests
That are failing otherwise as there would be a warning
2023-02-14 12:38:39 +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
Olivier Goffart
a19efc30db
Replace the MAX_BUFFER_AGE const generic with a runtime enum
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult

(Also renamed buffer_stride to pixel_stride)

Closes #2135
2023-02-08 14:44:01 +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
Tobias Hunger
d93445bd0b docs: Remove inline langref documentation and link the mdbook
For node and cpp, I use relative links to point to the slint language
reference documentation.

For the slint crate documentation I create a link to
https://slint-ui.com/releases/VERSION/... instead: This needs to work from
docs.rs as well as from our own docs area on slint-ui.com! That is
pretty ugly: I can not even define constants for this as the crate docs
need to come before anything else.
2023-02-07 12:10:07 +01:00
ogoffart
e7f48512ee Bump version number to 1.0.0 2023-02-03 11:07:15 +01:00
Olivier Goffart
ae20ec59c8 Rename PointerEventButton::None to PointerEventButton::Other
And mark the enum non_exhaustive

closes #1903
2023-01-26 13:36:54 +01:00
Olivier Goffart
63cc68ea0c C++: Use concepts for the invokables 2023-01-26 11:35:16 +01:00
Olivier Goffart
a3ec320bfb Remove some deprecated stuff
CC #2024
2023-01-26 11:19:21 +01:00
Simon Hausmann
cbb5198bf6 Update syntax in Mini-C++ tutorial 2023-01-25 09:54:50 +01:00
Simon Hausmann
7e02fa8b6a Update the syntax used in the different documentation entries and README 2023-01-25 09:54:50 +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
83ea50761a Janitor: upgrade corrosion 2023-01-19 11:48:28 +01:00
Olivier Goffart
8967deef56 C++: add a manual test to test the platform API using Qt 2023-01-17 10:21:11 +01:00
Olivier Goffart
8d0cdc6ec2 C++: cmake: move the build instruction for the tests in the tests dir 2023-01-17 10:21:11 +01: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
Simon Hausmann
25a71afa53 doc: fix missing types mapping table in C++ 2023-01-11 15:40:51 +01:00
Simon Hausmann
3c65c6177d Fix C++ memory game tutorial not starting out of the box on Windows
After commit 3e5aa212d5 the Slint DLLs
aren't placed in the `bin/` directory by default anymore. Since the
tutorial builds Slint as an external sub-project, it is entirely
isolated and the CMAKE_*_OUTPUT_DIRECTORY variables do not propagate. On
macOS and Linux, the program still runs due to rpath. On Windows, the
instructions said to put `bin` into `%PATH%`, but that doesn't work
anymore, the dll is now in `_deps/slint-build`.

Instead of adjusting `%PATH%`, this change adjusts the documentation to
recommend the use of a custom command on Windows using
$<TARGET_RUNTIME_DLLS:tgt> to copy the DLL across. This is guarded with
WIN32 due to https://gitlab.kitware.com/cmake/cmake/-/issues/23543 ,
where the proposed solution requires CMake 3.26 (not released yet).
2023-01-09 13:30:13 +01:00
Simon Hausmann
ad0aaa4759 Fix crash when using repeaters in C++ on 32-bit architectures
The abort in the repeated item traversal is represented as 64-bit unsigned value with all bits set, not just 32-bits.

Fixes #2039
2023-01-09 13:00:25 +01:00
Olivier Goffart
629a64ba89 C++ interpreter: do the renaming invoke_callback -> invoke 2023-01-02 23:55:47 +01:00
ogoffart
ce07d078ce Bump version number to 0.3.4 2022-12-16 09:36:15 +00:00
Simon Hausmann
c4d5f079b5 Partial fix for cmake build with Skia against Yocto
Latest corrosion handles quoting differently and would escape the empty quoted
string, so pass an empty string instead, for the host cflags.
2022-12-14 11:40:03 +01:00
Simon Hausmann
a63c7bcada Use the fresh new corrosion release 2022-12-13 12:10:16 +01:00
Simon Hausmann
61dc5e31b4 Fix running of tests with multi-config generators
Now that the binaries are placed in their respective
CMAKE_RUNTIME_OUTPUT_DIRECTORY, that's config suffixed, let's use the
ctest signature that accepts a cmake target and thus automatically
figures out the correct location of the executable.
2022-12-13 11:39:34 +01:00
Simon Hausmann
3e5aa212d5 Remove workaround for slint DLL placement for examples
We can now use the standard CMake variables to make sure that a copy of
the DLL lands next to the executables for Windows.
2022-12-13 11:39:34 +01:00
Simon Hausmann
53b05c426c Upgrade corrision to a git snapshot
This includes support for placing build artefacts into output directories
using standard cmake variables.
2022-12-13 11:39:34 +01:00
Simon Hausmann
8145d10b5b janitor: adaptor -> adapter 2022-12-13 08:35:20 +01:00
Simon Hausmann
6a87a07e12 Add support for showing the renderer on macOS with AppKit 2022-12-12 17:02:11 +01:00
Olivier Goffart
fe0e881418 C++ wrapper for the Skia backend 2022-12-12 17:02:11 +01:00
Olivier Goffart
10d1595f3a Janitor: cleanup C++ AbstractWindowAdapter
- virtual destructor can be = default
 - rules of 3 for AbstractWindowAdapter
 - Since WindowAdapter inherit AbstractWindowAdapter, it is already no-copy
2022-12-12 15:00:55 +01:00
Simon Hausmann
2d72781f9f Fix warning about missing virtual destructor 2022-12-12 14:40:07 +01:00
Olivier Goffart
f1fb4e16bb C++ platform API: remove the template parameter in Platform 2022-12-12 14:04:33 +01:00
Olivier Goffart
8d686637f4
Experimental platform API from C++ 2022-12-12 12:54:31 +01:00
Olivier Goffart
ccf3e8e9e9 C++: Generate image texture data for software renderer 2022-12-09 09:25:48 +01:00
Simon Hausmann
1162ebbb79
Reduce the amount of re-creation of cells in repeaters when the model changes (#1954)
Re-use the cells but mark them as dirty, instead of re-creating them every time.
In the included test-case that provides behavior that's
more intuitive.
2022-12-06 18:43:55 +01:00
Simon Hausmann
11f46906a2 Centralize rust-version in Cargo.toml
Require 1.64 in the workspace and inherit the setting in package
Cargo.toml files.
2022-12-05 12:39:14 +01:00
Simon Hausmann
7e77a2a4cc Bump MSRV to 1.64
... due to rust-skia bindings requiring a feature (ffi related).
2022-12-04 19:39:35 +01:00
ogoffart
fb02b4118b Bump version number to 0.3.3 2022-11-28 13:11:11 +00:00
Simon Hausmann
4308ed921d
Add documentation about the available widget styles and how to select them (#1910) 2022-11-25 14:53:20 +01:00
Simon Hausmann
d8a1f2cf01 Introduce a rem unit in the type system
This allows specifying font sizes relative to the Window's
default-font-size, similar to CSS rem.
2022-11-24 11:33:38 +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
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
Olivier Goffart
f1c96a391c C++ docs: mention we need to set the PATH 2022-11-10 07:45:08 +01:00
Simon Hausmann
e9db914fb1
Add is_visible to NodeJS and C++ Window types (#1816)
Amends commit 82278a5742
2022-11-04 16:24:24 +01:00
Jonathan Schwender
4ade9faa0d Update Corrosion to v0.3
This requires the following changes:
- Delay configuring SlintConfig.cmake:
  Corrosion sets the `IMPORTED` locations late to allow us to set
  OUTPUT_DIRECTORY target properties. The configuration of
  SlintConfig.cmake must be deferred until after Corrosion set the
  locations. Since we are writing to a config file Generator expressions
  are not an option.
- Remove BUILD_TYPE mapping from SlintConfig.cmake:
  As discussed in https://github.com/slint-ui/slint/pull/1785#issuecomment-1294630845
  remove the mapping of the build types since corrosion now always sets
  the `IMPORTED_LOCATION` property.

User facing improvements enabled by the update:
- Corrosion will not fail anymore if the user has a Rust toolchain >=1.60
  installed, but the default toolchain is < 1.60.
- Corrosion will respect OUTPUT_DIRECTORY properties and move target
  artifacts to the expected locations
2022-11-02 21:38:39 +01:00
Simon Hausmann
a1f9e39054 doc: prospective fix for rendering of example snippet in C++ generated code docs
The sample component in the docs has nothing to see, disable preview.
2022-11-02 09:54:03 +01:00
Simon Hausmann
41e3e27bff doc: Fix rendering of slint::interpreter::ComponentInstance::set_global_callback
Don't use a preview for the Slint snippet that just shows a global. There's
nothing to render.
2022-11-02 09:51:12 +01:00
Simon Hausmann
fa8959c7bc doc: Fix rendering of generated docs for restart()
The `--` was converted into a HTML entity, which was escaped again and shown raw.
2022-11-02 09:48:02 +01:00