Commit graph

410 commits

Author SHA1 Message Date
Tobias Hunger
cd50b41965
internal: Cargo + typo fixes (#9665)
* internal: Cargo + typo fixes

No intended change of behavior :-)

* Update internal/core/item_tree.rs

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>

* Update internal/core/item_tree.rs

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>

---------

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-10-08 16:33:07 +02:00
Olivier Goffart
9329091c2c
Math.sign: Change behavior to return 1 when 0
This is consistent to the Rust/C++ behavior
Even if this depart from the JS behavior

Also replace the function with a Macro

As discussed in https://github.com/slint-ui/slint/issues/9651#issuecomment-3376318439
2025-10-08 09:12:13 +02:00
Olivier Goffart
ace0199f12 compiler: Fix rust generated code adding a ; in parentheses
A cast to void in an expression sometimes added a `;` at the wrong
place.

Fixes #9546
2025-09-29 15:28:28 +02:00
Bryce Happel Walton
e8d878655c
Add Math.sign(x) (#9444)
Some checks are pending
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
add sign builtin

Closes: #6205
2025-09-22 11:49:11 +02:00
Benny Sjoestrand
568d4953cb Get tid of a "unused_import" Rust warning when builind Slint code
Some checks are pending
CI / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
This may only happen when slint-build/experimental-module-builds feature
is enabled, and in a very specific circumstanances the type is collected
as 'used', but not directly used by the generated Rust code.

CC #7060
2025-09-19 16:36:14 +02:00
Benny Sjöstrand
0bda0a64eb
Add support for importing Rust types from another crate Slint compilation (#9329)
To implement an external Slint library, the types and components implemented
in the .slint files needs to be exposed through the Rust crate.
A simple example example/app-library is added to demonstrate how to use this feature.

CC #7060
2025-09-16 09:01:44 +02:00
Olivier Goffart
54c378c40b
slint macro: Use Span::local_file when Rust is 1.88
Some checks are pending
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / files-changed (push) Waiting to run
CI / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.85) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
So we can locate the files relative to the .rs file instead of relative
to the Cargo.toml file.

For compatibility with previous version and older rust, still try to
locate files relative to the Cargo.toml for rust files.

The LSP will always auto-complete relative to the .rs file

The live-preview for Rust need to make the file absolute because it
isn't in the case of a macro
2025-09-12 13:27:31 +02:00
Olivier Goffart
0207510596
live-preview for rust: Fix loading from slint! macro
Some checks failed
CI / build_and_test (ubuntu-22.04, nightly) (push) Has been cancelled
CI / cpp_cmake (macos-14, 1.85) (push) Has been cancelled
CI / cpp_cmake (ubuntu-22.04, stable) (push) Has been cancelled
CI / cpp_cmake (windows-2022, nightly) (push) Has been cancelled
CI / cpp_package_test (push) Has been cancelled
CI / vsce_build_test (push) Has been cancelled
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Has been cancelled
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Has been cancelled
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Has been cancelled
CI / mcu-embassy (push) Has been cancelled
CI / ffi_32bit_build (push) Has been cancelled
CI / wasm_demo (push) Has been cancelled
CI / node_test (macos-14) (push) Has been cancelled
CI / node_test (ubuntu-22.04) (push) Has been cancelled
CI / node_test (windows-2022) (push) Has been cancelled
CI / python_test (macos-14) (push) Has been cancelled
CI / python_test (ubuntu-22.04) (push) Has been cancelled
CI / python_test (windows-2022) (push) Has been cancelled
CI / cpp_test_driver (macos-13) (push) Has been cancelled
CI / cpp_test_driver (ubuntu-22.04) (push) Has been cancelled
CI / cpp_test_driver (windows-2022) (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / wasm (push) Has been cancelled
CI / tree-sitter (push) Has been cancelled
CI / updater_test (0.3.0) (push) Has been cancelled
CI / fmt_test (push) Has been cancelled
CI / esp-idf-quick (push) Has been cancelled
CI / android (push) Has been cancelled
CI / miri (push) Has been cancelled
CI / test-figma-inspector (push) Has been cancelled
Put the absolute path in the binary.
2025-08-29 18:15:49 +02:00
Olivier Goffart
88c0323e6c Rename "Live Reload" feature to "Live Preview for Rust/C++"
Some checks are pending
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
2025-08-28 17:26:01 +02:00
Olivier Goffart
484a04dcaa Rust&C++: Fix conversion from named struct to anonumous struct
As noticed in 4891421304
(building chiptrack)
2025-08-26 18:06:32 +02:00
Simon Hausmann
a6c88b5a3a !fixup Try to fix the C++ build 2025-08-21 14:29:55 +02:00
Simon Hausmann
2fab7822c3 Fix rem resolution within component container
For the implementation of BuiltinFunction::GetWindowDefaultFontSize, instead of going to the window adapter's window item rc (which will be the outermost window item), start at the first item of the current component and work the way up from there.

Fixes #4298
2025-08-21 14:29:55 +02:00
Simon Hausmann
18740aa826 Fix rem support
After commit e04f028c91, the
default-font-size property on WindowItem isn't set anymore by default,
so BuiltinFunction::GetWindowDefaultFontSize, which reads it, would
return zero.

Instead, delegate to a run-time function where we can fall back to the
default from the renderer.

This patch changes rem.slint to use the newer syntax. The main change to
the test case though is to removal of the explicit default-font-size
property setting, so that we fall back to the value provided by the
renderer. This test relies on being run with the testing backend.

Fixes #8961
2025-08-21 14:29:55 +02:00
Gustavo Henrique Montesião de Sousa
e0ae0af621
Add an Easing namespace (#9179)
The definition of an Easing namespace allows to name an easing curve
outside an expression of type easing like, for instance, a struct field.

Closes #3943.

ChangeLog: Added an `Easing` namespace to reference easing curve outside of `easing` properties.
2025-08-21 09:06:48 +02:00
Simon Hausmann
b70a008360 Ensure error reporting when using buffered file writes
Quoting from the BufWriter docs:

>It is critical to call flush before BufWriter<W> is dropped. Though
>dropping will attempt to flush the contents of the buffer, any errors
>that happen in the process of dropping will be ignored. Calling flush
>ensures that the buffer is empty and thus dropping will not even
>attempt file operations.
2025-08-20 10:22:45 +02:00
Olivier Goffart
a0192d443e C++: Fix ABI mismatch with Slice on MSVC AArch64
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly-2025-08-15) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
The second constructor of `Slice` causes the Slice to be passed
differently (in different register) as a return value.

So remove that constructor and use a helper function to
construct a Slice
2025-08-19 15:05:48 +02:00
Olivier Goffart
3b245c0c5e C++: native context popup menu 2025-08-19 14:52:14 +02:00
Olivier Goffart
e3077657c5 C++ live-reload: add conversion function for enum to/from Value
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly-2025-08-15) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
2025-08-18 15:11:29 +02:00
Olivier Goffart
98309972da MenuBar: allow it to be in a if
Fixes #8282
2025-08-18 11:17:57 +02:00
David Faure
d97cab16ca Fix default font size not being propagated to popup windows
With thanks to Simon and Olivier for the guidance on how to fix this.

Fixes #8855
2025-08-17 18:27:07 +02:00
Olivier Goffart
fb9a2c0f47 Simplify menu handling
Previously there were two kinds of Menu:
  1. "Simple" menu that don't have any `if` or `for`
  2. "Complex" menu that have `if` and `for`

For the first kind, we were generating in the compiler the `entries` and
`sub-menu` callback. This lead to more efficient and simple code at
runtime.
For the second kind, we generate an item tree so we can dynamically
produce them at runtime.

The issue is that as we added feature, the code became complex to
handle, even in the simple case as we need to create a `VRc<MenuVTable>`
also for the context menu so we can have native context menu.

We still need the "Simple" case for the internal though.
So for that I added a ShowPopupMenuInternal builtin function although it
only differ from ShowPopupMenu by the type of its second argument.
Since the generated code has lots in common, they are still handled
together.

The proof that the two different codepath were harmful is that removing
it showed a bug with contextmenu within repeated element.
the `contextmenu_delete.slint` started failling. It worked before
because it was only a problem with "Complex" menu and the test used a
"Simple" menu.

The change in the interpreter should also solve the issue #9031 which
were using the wrong item tree as the menu.
2025-08-15 12:07:46 +02:00
Simon Hausmann
e9a813a159 C++: Fix compilation of Path sub-classes that don't have commands set yet
An empty PathData is fine, we just can't call std::size() on an array with 0 elements - that doesn't compile.
2025-08-13 21:00:54 +02:00
npwoods
e1ced68a8d
Changed WindowInner::show_native_popup_menu() to take parent_item (#9084)
This is necessary for popup menus to be relative to an item

This should fix the position part of #9031
2025-08-13 16:31:10 +02:00
Tasuku Suzuki
3d7f616dee
Add conic gradient support for all backends (#9021)
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
- Implement @conic-gradient(color angle, ...) syntax
- Center is always at rectangle center (no center_x/center_y parameters)
- 0 degrees starts at north (12 o'clock position)
- Support Slint angle units: deg, rad, turn
- Software renderer: Full native implementation
- Qt backend: Native support with angle offset correction
- Skia backend: Native support with angle offset correction
- FemtoVG backend: Fallback to solid color (first gradient stop)


ChangeLog: Added support for `@conic-gradient`

Fixes #3957
2025-08-02 09:14:33 +02:00
Olivier Goffart
e9498fc7c9 janitor: cargo fmt
Last patch was not properly formated
2025-07-30 12:26:43 +02:00
Olivier Goffart
087c8d352d core: fix compilation with slint_debug_property
We did an unconditionel `no_std` at some point
2025-07-30 11:11:44 +02:00
Olivier Goffart
ab674f33fb C++: adapt to menu bar API change
The MenuVTable is now a VRc (and it was a Box before)
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
4b9d317fd5 Fixing menu bar code 2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
7acb7ec404 - Changed muda infrastructure to use VRc<MenuVTable> instead of `VBox<MenuVTable>
-- Problem: is using `vtable::VRc::borrow(&menubar)` the correct approach?
-- Problem: `VTableMetaDropInPlace` is not properly implemented for `MenuVTable`
-- Problem: Codegen for menus has not been updated yet

- Updated Context Menu code to use `VRc` so both sides are supported
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
da2e175ac4 Various improvements:
- Removed `ContextMenuFromItemTree`
- Moved `MudaType` to `internal/backends/winit/muda.rs`
- Stopped unnecessary use of `Option` when creating `context_menu_item_tree`
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
cb683aa9ce Fixes to Rust codegen for using native context menu
- Removed awkward Box<dyn> usage
- Using sp::VRc<sp::ItemTreeVTable> instead of recommended sp::VWeakMapped<sp::ItemTreeVTable> because the weak reference does not live enough to be activated

Outstanding issues:
- Root items are incorrectly all sub menus
- No longer needed ContextMenuItemTree needs to be removed
- MudaType needs to be moved
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
9a41cac8c3 The muda dropdown is now (sort of) functional, with a few problems
- Root menu items seem to be empty submenus, and are this not usable
- Root separators seem to be blank menu items
- `ContextMenuWrapper` works by virtue of passing `Box<dyn ...>` callbacks to them.  This is clearly a hack to get around the challenges of using the "quote macros" from within `impl ContextMenuWrapper`

This is clearly not a complete and desirable solution (yet)
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
46d1c6fdae Changes as per feedback
- Removed the `show_context_menu()` and started using the existing `show_native_popup_menu()` stub.  Changed (probably erroneously) the type of the context menu parameter to what was on original change.
- Created a `ContextMenuWrapper` for the case where have the generated `activate()` and `sub_menu()` calls (this is incomplete)
- Removed the `no_native_menu` infrastructure that I cargo culted.
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
8137230e7b NOT FUNCTIONAL: muda context menu support
This represents the better part of a day of trying to implement native context menu support with `muda`.  I've been able to get a context menu to appear, with the following caveats:
- Only the Rust code generator is supported
- Only Windows is supported
- Menu activation is `todo!()`
- Root menu items seem to display a subitem whether they have items or not

I've been finding it challenging navigating the Slint object model, particularly in the context of code generation, and I'm sure in some cases I'm overlooking simpler solutions.  So I was hoping that I could get some feedback (perhaps what objects I need to "lock on to") about how to pull this over the finish line.

Thanks in advance, I'm really looking forward to having a native context menu in Slint!
2025-07-29 16:53:57 +02:00
alex
64408af083 generator/rust: don't emit double semicolons
Some checks are pending
CI / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
2025-07-27 12:25:40 +02:00
alex
1ee9596ab8 generator/rust: be more correct with parentheses
Unused parentheses generate lints in the rust compiler, which get stored
and later filtered. Having too many of these lints impact compile times.
2025-07-27 12:25:40 +02:00
alex
369b7e017c generator/rust: silence unused Result lints more effectively
Just "allow"-ing lints will still record them and later filter them,
affecting compilation times.
2025-07-27 12:25:40 +02:00
Avery Townsend
69e0bffa7e
Add stop(), start(), and restart() methods to Timer (#8821)
Co-authored-by: R-Cramer4 <robin.cramer@kdab.com>
2025-07-18 14:51:55 +02:00
Simon Hausmann
5e8f2e4447 Fix warning with nightly about unnecessary parentheses 2025-07-11 08:26:30 +02:00
Olivier Goffart
01850e0b82 C++ live-reload: support getting the model back 2025-07-09 11:23:33 +02:00
Olivier Goffart
43b436a89f WIP: live-reload for C++
Missing feature:
 - conversion between Value and enums
 - conversion from value to Model
 - Compatibility with the testing framework (get the `VRc<ItemTreeTable>` from an instance)
2025-07-09 09:32:17 +02:00
Olivier Goffart
5f4a0a352d
live-reload: support slint!() macro 2025-07-08 12:19:04 +02:00
Olivier Goffart
647dd45213 Make a live reload module in the slint-interpreter 2025-07-04 10:07:22 +02:00
Olivier Goffart
cc9c573c9a Rust codegen that forward to the interpreter (live-reload)
When the SLINT_LIVE_RELOAD env variable is set, generate a component
that will forward everything to the interpreter instead of generating
everything.

Fix running the test driver rust with the SLINT_LIVE_RELOAD

```
SLINT_LIVE_RELOAD=1 cargo test -p test-driver-rust --all-features --features=slint/live-reload
```
2025-07-04 10:07:22 +02:00
Olivier Goffart
d2b3287876 ComponentHandle: don't rely on the Inner to be a VRc<ItemTreeVTable>
Because i want to be able to hold componetns that do not directly
implement ItemTreeVTable, but only forward to it
2025-07-04 10:07:22 +02:00
Olivier Goffart
05f48b0fee Rust codegen: ensure alignment of Texture
Some checks are pending
CI / test-figma-inspector (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / files-changed (push) Waiting to run
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, 1.85) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
Some hardware acceleration routine needs it to be aligned.
(Eg, Otherwise, we get artifacts when drawing RGBA images with nema-gfx)
2025-07-03 12:35:39 +02:00
Olivier Goffart
ac24e0274e Rust: fix compilation if the slint code declares struct named core 2025-06-30 13:36:01 +02:00
Avery Townsend
d2a5ae03dc
Add local variables (#8740)
Fixes: #2752

ChangeLog: Added local variable with `let`
2025-06-26 15:36:49 +02:00
Olivier Goffart
20061392cd
C++: Fix compilation of PopupWindow::show in changed callback
Some checks are pending
CI / ffi_32bit_build (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / files-changed (push) Waiting to run
CI / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.82) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.82) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.82) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
The window is dependent of an lambda `auto` parameter, so the `template` keyword is required in order to call show_popup

Fixes #8710
2025-06-16 23:25:24 +02:00
Simon Hausmann
06a19e59ad
slint: Change Platform.os to return a new enum OperatingSystemType (#8679)
* slint: Change Platform.os to return a new enum OperatingSystemType

cc #8631
2025-06-12 14:25:16 +02:00