Commit graph

2824 commits

Author SHA1 Message Date
Olivier Goffart
fab522cd4b core: Move style_text module outside of API
... just re-export the `StyledText` type from public API

That way we can access StyledText internals from the renderer
2025-12-11 17:48:59 +01:00
David Faure
2c4028b3d2 Rename for consistency repeater_indexes => repeater_indices 2025-12-11 09:55:56 +01:00
Simon Hausmann
c56f459dea CI: Pnpm publishing fix 14034230
npm is picky and wants a https url.
2025-12-10 15:31:04 +01:00
Olivier Goffart
b005d0c8cf software-renderer: Enable path and systemfonts by default when std is on 2025-12-10 15:29:39 +01:00
Simon Hausmann
10ba0776ec CI: Prospective fix for npm publishing
Make sure the binary packages also have the correct repository.url
2025-12-10 12:58:58 +01:00
Joshua Goins
f015cbe3ee C++: Expose raw window handle API
We had the raw_window_handle_06 feature and functions in Rust, but there
wasn't an easy way to do the same in C++. This is especially useful for
embedding windows (such as browsers, 3D views, etc.) or just wanting to
access the platform's handles for other reasons.

ChangeLog: It's now possible to access platform native window handles
from C++, like a HWND.
2025-12-10 10:34:55 +01:00
David Faure
b71878f36b Introduce Type::ArrayOfU16 for grid layout organized data
No point in stuffing u16 into f32 just to reuse an existing type.

OTOH ArrayOfU16 can be reused for other things than grid layout
organized data, so give it a more generic name than
GridLayoutOrganizedData (we should do the same for LayoutCache, at
least if we ever reuse the type for an additional purpose)
2025-12-10 09:47:23 +01:00
David Faure
45dfe28aa9 3 clippy fixes 2025-12-09 17:54:02 +01:00
Olivier Goffart
2dd3da6e45 Always enable the fontconfig-dlopen feature for build dependencies 2025-12-09 16:13:35 +01:00
Olivier Goffart
5c69db596a
Split the software renderer in its own crate: i-slint-renderer-software (#10229)
The goal is to be able to enable feature conditionally with `i-slint-renderer-software/?...`

NOTE: this change the implementation of
`SceneBuilder::platform_text_fill_brush/platform_text_stroke_brush`
It was warning about `non_exhaustive_omitted_patterns`.
And it changed it to always return the brush color so gradient gets
converted to plain color instead of None.
This is the behavior with the non-parley renderer
2025-12-09 14:17:05 +01:00
autofix-ci[bot]
590c9b7864 [autofix.ci] apply automated fixes
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
autofix.ci / ci (push) Blocked by required conditions
2025-12-09 12:11:04 +01:00
David Faure
29e289fbdf Move the workspace to rust edition 2024
Motivation: the git pre-commit hook is confused by the mix of 2021 and
2024 in the same workspace...

The only problem this raises is the std::env::set_var("LANGUAGE", lang) in
demos/printerdemo/rust/lib.rs, pre-existing but now explicitly marked as unsafe
because it actually is. Added a TODO there.
2025-12-09 12:11:04 +01:00
Olivier Goffart
c63733f61d
C++: Fix warnings after edition 2024 move that were not catched by CI
(About unsafe in unsafe functions)
This also replace some gratuitous `NonNull::new_unchecked` with the safe
`NonNull::new`.
2025-12-09 11:51:31 +01:00
autofix-ci[bot]
52459ffb4e [autofix.ci] apply automated fixes 2025-12-09 09:33:17 +01:00
David Faure
2faf91f04c api/cpp: switch to edition 2024 2025-12-09 09:33:17 +01:00
dependabot[bot]
78ef8e224c
build(deps): bump the npm-patch-updates group with 13 updates (#10225) 2025-12-08 09:21:19 +02:00
Simon Hausmann
ffee1e01fb
C++: Enable support for the Slint software renderer by default (#10217)
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
autofix.ci / ci (push) Blocked by required conditions
This is in line with Rust.
2025-12-05 22:27:54 +01:00
David Faure
41be30ee6a Port from vec![] to Vec::new()
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
autofix.ci / ci (push) Blocked by required conditions
vec![] expands to Vec::new(), but expanding macros takes a bit of
time and takes memory in rust-analyzer. Also, the code was using a mix
of vec![] and Vec::new(), so this is more consistent.
2025-12-05 16:53:45 +01:00
Joshua Goins
d5a515d944 C++: Fix NativeWindowHandle Win32 API being available on Linux
This seems just be a typo, I think it's supposed check if _WIN32 *or*
_WIN64 is defined. Before compilation for Linux could easily pass
through because it doesn't have _WIN64 defined.

Shouldn't have any adverse affects since this was never going to work on
Linux in the first place.
2025-12-05 16:52:28 +01:00
Olivier Goffart
80750b37ab Update Corrosion 2025-12-05 14:37:51 +01:00
Olivier Goffart
4b9017e513 translations: set the translation dirty when setting the translator 2025-12-05 09:56:13 +01:00
Olivier Goffart
3b0252dfbc Remove undeeded file for re-use complience
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
autofix.ci / ci (push) Blocked by required conditions
2025-12-04 21:58:09 +01:00
Olivier Goffart
84759dc02b Fix html-like comments to be on two lines 2025-12-04 21:58:09 +01:00
Olivier Goffart
88697c68bb Remove license header from .md/.mdx files
They should be in the lines, but the problem is that this causes issues
in the .mdx files.

License header doesn't really make sense for .md files anyway
2025-12-04 21:58:09 +01:00
Simon Hausmann
b76bd8e6e7 C++: Fix build against Yocto SDKs
When using `. environment-setup-*` against a Yocto SDK, we end up with PKG_CONFIG_PATH set to the target sysroot and the pkg-config binary coming out of Yocto SDK and always locating packages in the target.

That means the build of slint-compiler fails as it needs font-config from the host system, when enabling support for embedding glyphs.

In this scenario, enable the compiler/fontique to dlopen fontconfig instead.
2025-12-02 16:02:21 +01:00
Ashley
710f0c1968
Styled Text: add a macro and functions for parsing markdown (#10060)
* Add markdown macro and parse/escape functions

* Markdown stuff

* Implement escape markdown, handle trailing literal sections

* add StyledText Type and Value

* Implement more things

* [autofix.ci] apply automated fixes

* Rename MarkdownText to StyledText

* Add comments and solve warnings

* Apply automated fixes

* Fill out styled text type

* Change rendertext trait to use enum

* Add allow missing docs to stuff

* Fix testing backend thing

* Move test

* Don't use std:: for certain types

* Fix api/node

* [autofix.ci] apply automated fixes

* Rename to StyledTextItem

* Ignore styledtext in cpp for now

* Remove whitespace change

* Add tests, cpp generator changes

* Add markdown interpolation tests

* Add more tests, some fixes

* Implement some StyledText things

* Fix sharedparley imports

* Manually implement StyledText cpp type

* [autofix.ci] apply automated fixes

* Fix escape and parse markdown functions

* [autofix.ci] apply automated fixes

* Add ignore pyi, documentation for cpp styled text

* Apply some suggestions

* [autofix.ci] apply automated fixes

* Add cpp functions for styled text

* [autofix.ci] apply automated fixes

* Add documentation

* Fix api exports

* class -> struct

* Gate exports behind shared-parley

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-01 22:58:56 +13:00
Simon Hausmann
d903afecef Python: Fix tests in the CI having difficulties connecting to Xvfb
Instead of connecting to the X server, let's run the Python tests with the testing backend, like we do for test-driver-rust, test-driver-cpp, etc.

When building the Python package, pass --features backend-testing to Cargo, to forward to enabling the backend-testing feature in i-slint-backend-selector. That consequently enables SLINT_BACKEND=testing.
2025-11-30 10:02:36 +01:00
Olivier Goffart
59307db44b Fix warning about redundant explicit link target
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
autofix.ci / ci (push) Blocked by required conditions
Since the 2024 edition, Future is in the prelude
2025-11-27 17:07:35 +01:00
Olivier Goffart
b3470206ff Reformat after edition change 2025-11-27 17:07:35 +01:00
burhankhanzada
ef9d5d5c0c docs: Update language mod docs line. 2025-11-26 15:38:03 +01:00
burhankhanzada
3ab76828fc docs: Clarify language module as containing built-in Slint types and add slint_doc attribute. 2025-11-26 15:38:03 +01:00
burhankhanzada
f9dfde1171 refactor: move ColorScheme to the new slint::language module 2025-11-26 15:38:03 +01:00
Simon Hausmann
16a96399b5 Python: Unpin ty type checker version
Match the name of the argument to please the type checker.
2025-11-26 11:30:10 +01:00
Olivier Goffart
59de54a1e4 Translations: allow to opt out of default context
Fixes #9955
2025-11-26 11:11:07 +01:00
YuxuanYan
7bad0c4828
Error message for using a python callback decorator on an async callback not being declared (#10152)
* Error message for using a python callback decorator on an async callback not being declared
2025-11-25 08:43:02 +01:00
Simon Hausmann
dbe2c59ce9 Python: Fix support for underscores in async callback decorators
Some checks failed
autofix.ci / format_fix (push) Has been cancelled
autofix.ci / lint_typecheck (push) Has been cancelled
autofix.ci / ci (push) Has been cancelled
Fixes #10024
2025-11-22 14:03:42 +01:00
Joshua Goins
571e5497bb Fix C++ examples for SharedPixelBuffer
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
autofix.ci / ci (push) Blocked by required conditions
Someone has been writing too much Rust! You can't put :: before a
template argument, and there were some leftovers of this in the
C++ documentation.
2025-11-21 23:39:46 +01:00
Ashley
e86119c1d9
Add StyledText type (#10122)
* Add StyledText type

* Move to styled-text.rs

* Apply suggestions

* Don't gate around experimental-rich-text feature

* Gate pulldown_cmark behind std

* [autofix.ci] apply automated fixes

* Make thiserror optional

* Make htmlparser optional

* Gate color-parsing feature

* [autofix.ci] apply automated fixes

* Change flags

* Change to pub(crate)

* [autofix.ci] apply automated fixes

* Better docs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-22 03:06:50 +13:00
David Faure
804ca74c24 Move reordering of dialog buttons to the organize step
This repairs the feature of reordering buttons, which was
temporarily left out in the previous commit.
2025-11-21 14:45:55 +01:00
David Faure
8ae28adb6b GridLayout: introduce an Organize step to compute row/col
This allows to store the result into a different cache property
than the one that comes out of solve_grid_layout, which fixes
a binding loop when the text of a widget depends on its row or col
value.
2025-11-21 14:45:55 +01:00
David Faure
bf9031eeaa Lay out grids at runtime rather than at compile time
This includes support for row and col properties to be expressions
rather than just constants.
2025-11-21 14:45:55 +01:00
Simon Hausmann
feecce73ad Python: Speed up testing
Build editable builds as cargo debug builds, not release. This is faster
(because we don't need LTO) and in theory gives additional coverage to
debug asserts.
2025-11-21 09:48:42 +01:00
Olivier Goffart
75058cb230
Compiler: Remove Struct::rust_attributes and make it an error if @rust-attr(...) doesn't lex (#10118)
The `rust_attributes` in langtype::Struct is a bit wierd as it is only
used for rust code generation, yet is stored in every Struct.
Instead, read the `node` while doing code generation like we do in C++.

The previous code was ignoring the error lexing the code in the
attribute, and now we add a compile_error!
2025-11-20 22:41:51 +01:00
Simon Hausmann
f2dc010dbf Python: Speed up testing
Separate steps and remove nox, so that

1. We first set up the env and build slint **once**
2. We run the fast lint/ty/etc. checks
3. We run the python tests directly
2025-11-20 20:51:54 +01:00
Simon Hausmann
831e067f98 Python: Use ty instead of mypy
It has gotten pretty good and it's much faster than mypy.
2025-11-20 20:51:54 +01:00
Simon Hausmann
16ceb115a1
slint-compiler: Add support for generating Python stubs (#10123)
The generated file offers the following two pieces of functionality:

- Convenient front-end to slint.load_file() by loading the .slint file
  (replaces use of auto-loader)
- More importantly: Type information for exported properties, callbacks,
  functions, and globals

On loading, the previously generated API is compared to what's in the
.slint file and if the .slint file was changed in an incompatible way,
an exception is thrown.

A Python test driver is added which performs three steps with each test
case:

1. Generate python stubs and checks that they can be loaded with the
python interpreter and that `uv ty check` passes.
2. Extract expected python API out of pyi sections and compares them.
3. Appends any python code from python sections and runs them (this is
combined with step 1)

Fixes #4136
2025-11-20 17:17:01 +01:00
Nigel Breslaw
a119b714a5
Migrarte final api/node tests to Vitest (#10114) 2025-11-19 18:18:23 +02:00
Olivier Goffart
70e102e2eb Keep in sinc slint and slint-interpreter re-export
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
autofix.ci / ci (push) Blocked by required conditions
2025-11-19 12:04:11 +01:00
Olivier Goffart
7eafcaffaa Polish slint::register_font_from_memory
- Make `FontHandle` opaque.
 - Avoid memory allocations
 - Reword documentation
 - Avoid indirection to i_slint_core (prevent documentation to be
   repeated)

ammends for https://github.com/slint-ui/slint/pull/9762
2025-11-19 12:04:11 +01:00
Nigel Breslaw
428aae87f6
Migrate api and compiler node/api tests (#10111) 2025-11-19 10:20:40 +02:00