Commit graph

371 commits

Author SHA1 Message Date
Olivier Goffart
010126992e MenuItem with for and if 2025-01-30 10:08:22 +01:00
Olivier Goffart
3d664578dd Fix ListView implementation in C++
Regressed in commit 4da79ac69a
2025-01-22 19:52:02 +01:00
Olivier Goffart
7e37f19e2c ListView: fix continuous redraw with fluent style
Because we set the viewport-width several time to different value during
the layouting of the ListView, it will cause this property to always be
dirty. In particular, this causes permanent restart of the fluent's
scrollbar animation on the size of the handle, causing continous
repaints.
2025-01-21 14:31:55 +01:00
Olivier Goffart
4da79ac69a Fix layouting of huge ListView with millions of items
The problem is that the precision of f32 for coordinate wouldn't be
accurate enough with such big viewport to put the elements so that they
are next to eachother.
So put the elements relative to the Flickable instead of relative to the
created moving viewport Rectangle.

Fixes #3700

Note that the ListView still use f32 for the scrollbar value, meaning
that at some point, the wheel stops working as the wheel increment is
smaller than the f32 increment, and scrolling becomes somehow fuzzy.
But this only happens after one more billions pixels now, so one can
have more than 50 millions of elements without much problems
2025-01-20 17:41:38 +01:00
Olivier Goffart
87d86ae7d2 Only re-create elements if the model actually changed
Being dirty is not enough

Fixes #7245

ChangeLog: Elements of a `for` now only get re-created if the model is
changed, not if it is only dirty
2025-01-13 12:11:21 +01:00
Olivier Goffart
6b4c822a4a MenuBar: C++/Rust native menubar implementation
introduce a SetupMenuBar builtin function to ease C++/Rust lowering
2025-01-08 21:16:17 +01:00
Olivier Goffart
846664ad45 WIP: native menubar using muda
Only the interpreter is implemented so far

MacOs won't work yet because we don't disable the default winit menubar

The viewer don't support removing the MenuBar yet
2025-01-08 14:05:35 +01:00
Simon Hausmann
b4b878d71e Introduce link-data.json in the C++ docs to reduce risk of dead links 2024-12-17 16:20:47 +01:00
Simon Hausmann
8d85c54a6f Fix up Window::take_snapshot docs
Clarify the "performance" as discussed in the API review.
2024-12-11 17:07:23 +01:00
Olivier Goffart
e03e812984 Fix Focus in PopupWindow
Fix https://github.com/slint-ui/slint/issues/2911
2024-12-09 15:58:16 +01:00
Olivier Goffart
917b0c88f7 C++: set_xdg_app_id: use std::string_view in the API 2024-12-07 09:34:34 +01:00
Olivier Goffart
44df136c4f Translation API: a few renaming for API review 2024-12-07 09:33:58 +01:00
Olivier Goffart
3b0ddbfa75 C++: Use size_t instead of uintptr_t for the index and count
Same as row_count
2024-12-07 08:25:42 +01:00
Olivier Goffart
a3dad45f0b Accessibility: rename a few properties after API review:
- Rename `accessible-selectable` and `accessible-selected` to `accessible-item-{selectable,selected}`.
   Because the property is for items in list rather than eg Text
 - Rename `accessible-position-in-set` to `accessible-item-index`.
 - Rename `accessible-size-of-set` to `accessible-item-count` and move
   the property to the container element rather than the item itself
2024-12-07 08:25:42 +01:00
Simon Hausmann
1888e58735 Add API to set the XDG app id
ChangeLog: Added function to set the XDG app id on Wayland/X11. This needs to be added with respective function names in the language sections.

Fixes #1332
2024-11-22 11:24:06 +01:00
FloVanGH
6ebce7e5f4
cpp: added to_lowercase and to_uppercase to SharedString (#6869)
* cpp: added to_lowercase and to_uppercase to SharedString

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/cpp/include/slint_string.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/core/string.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* code review feedback

* Update api/cpp/tests/datastructures.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* code review feedback

* Update api/cpp/include/slint_string.h

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

* Update api/cpp/include/slint_string.h

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-21 18:53:02 +00:00
Olivier Goffart
5bd20def0e Experimental support for MenuBar
Introduces `MenuBar{ ... }` that can be put in a Window
2024-11-20 09:25:37 +01:00
Olivier Goffart
d68b84a3f1
Change API to set the language with bundle translation
* Change API to set the language with bundle translation

Part of #6793
2024-11-17 11:40:02 +01:00
Simon Hausmann
a7a3b3f9ee Changelog: C++: Add slint::Window::take_snapshot()
Corresponds to the Rust API.
2024-11-13 12:38:36 +01:00
Brandon Fowler
6da0f55b05
Associate PopupWindows with an ID for their active popup (#6693)
Popups are stored in a HashMap and are assigned an ID so popup.close(); closes the correct popup and so a single PopupWindow cannot be opened multiple times
2024-11-04 09:17:55 +01:00
Arnold Loubriat
97219c21bf Add the accessible-size-of-set property 2024-10-30 15:54:01 +08:00
Arnold Loubriat
67166fcc2d Add the accessible-position-in-set property 2024-10-30 15:54:01 +08:00
Olivier Goffart
95f5685789
Bundle translations (#6661)
This currently doesn't have public API to enable it yet.

TODO:
 - Error handling in the compiler
 - Public API in the compiler configuration
 - Documentation
2024-10-29 15:07:15 +01:00
DataTriny
2de3b9d455 Add the accessible-enabled property 2024-10-25 10:20:09 +02:00
FloVanGH
14c7910d49
PopupWindow: added close-policy property (#6614)
* Update api/cpp/include/slint_window.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/reference/src/language/builtins/elements.md

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

* Update internal/core/window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/eval.rs

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

* Update internal/backends/qt/qt_window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/dynamic_item_tree.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/compiler/passes/materialize_fake_properties.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-10-24 09:27:39 +00:00
Arnold Loubriat
19f09950c2 Changelog: Add accessible-selectable and accessible-selected properties 2024-10-16 15:38:46 +02:00
U. Bruhin
40811193aa
C++: Add size() method to SharedString (#6417)
The length is an important property of a string and should be available
as a getter. The new size() method is consistent with std::string.

ChangeLog: [C++] Added `SharedString::size()`
2024-10-01 14:51:56 +02:00
Simon Hausmann
7db5024c52
Generate bindings of Image::to_rgb8/to_rgba8/to_rgba8_premultiplied f… (#6405)
ChangeLog: [C++] Add `Image::to_rgb8/to_rgba8/to_rgba8_premultiplied` pixel buffer accessors.

Fixes #6399
2024-10-01 10:55:11 +02:00
Olivier Goffart
d2bd5366f4 Timer::set_interval
Don't return an Option, just return 0 when the timer is not started.
As discussed in the API review, the rational is that the interval is
just like a field in a struct and when the struct is default
constructed, it is initialized to 0
2024-09-18 09:24:39 +02:00
Simon Hausmann
4d585279b0 STM32: Add support for rendering rotation 2024-08-30 08:49:26 +02:00
Simon Hausmann
d78354f01b
Initial import of STM32 Platform Integration (#5892)
This is a head-only library for now.
2024-08-22 15:55:01 +02:00
Olivier Goffart
a9f526491a Timer Element
Closes #5724
2024-08-16 16:36:38 +02:00
Olivier Goffart
0f8246d598
C++: add assert_main_thread to public functions in the Window
Some have it some don't. Just add it everywhere.

See https://github.com/slint-ui/slint/discussions/5762
2024-08-06 22:52:45 +02:00
Simon Hausmann
8a7db55bb6
Route debug() calls in Slint consistently through Platform's debug_log() (#5718) 2024-07-29 16:31:09 +02:00
Simon Hausmann
bda89c25da Document that availability of slint::testing is conditional to enabling the feature and experimental features. 2024-07-11 11:47:09 +02:00
Simon Hausmann
27dc6e53c0
API review: enable all features in the C++ docs (#5592)
And make sure that functions excluded when freestanding is enabled are included in the docs.
2024-07-11 08:29:51 +02:00
Olivier Goffart
e67e46ab47 LLR: merge the popup's x and y property access in one expression 2024-07-10 17:54:03 +02:00
Simon Hausmann
419042f476 Add support for using own properties in PopupWindow's x and y properties
This allows positioning popup windows in a way that takes their width/height into account.
2024-07-10 13:43:41 +02:00
Olivier Goffart
42d7661ec6 C++: make the PhysicalRegion::rectangles non-overlapping 2024-07-10 10:58:27 +02:00
Arnold Loubriat
ce2db77e88
Add the accessible-placeholder-text property (#5464) 2024-06-26 12:59:22 +02:00
Olivier Goffart
d0cdebfee6 C++: move globals in a different struct
So that subcomponent don't depend on the root component name
which will hallow to have several root components
2024-06-14 16:26:53 +02:00
Olivier Goffart
4cc6337c42 Rust: Don't get the default font size through the root component
Planning for multi-component support
2024-06-13 13:53:07 +02:00
Simon Hausmann
5247b0afae
Add ElementHandle::accessible_role() to the C++ API (#5388) 2024-06-13 06:32:25 +02:00
Olivier Goffart
58826ddd94 Testing C++ API: add a visitor over the ElementHandle 2024-06-10 15:52:40 +02:00
Simon Hausmann
88e1a366a3 Make rendering rotation a public feature of the software renderer
Fixes #5372
2024-06-10 05:24:48 -07:00
Simon Hausmann
650f19a33c Re-run clang-format with version 18 2024-06-10 02:25:40 -07:00
Olivier Goffart
a780dd4905 Testing: Fix duplicated accessibility element
This fix the C++ todo test that wasn't run because of a typo

When an element is optimized in another one, only the first one should
report the accessible properties. (because element with accessible
properties cannot be optimized so they are always the first)
2024-06-07 13:18:12 +02:00
Olivier Goffart
445802c46d date_time: simplification and cleanups 2024-06-06 09:03:50 +02:00
Simon Hausmann
37b63e4bd4 Add public API in the interpreter (Rust/C++) to obtain the list of functions 2024-06-05 14:06:10 -07:00
Florian Blasius
3ccee816be
Added TimePicker widget (#5251) 2024-06-05 15:23:06 +02:00