Commit graph

97 commits

Author SHA1 Message Date
Tobias Hunger
f7de5d4602
docs: Go over builtin_elements.md (#2280)
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2023-02-24 11:03:56 +01:00
Olivier Goffart
473103dc95 Add a lifetime to ModelPeer
ModelPeer is a short lived object which is just used to register a view
to a ModelNotify.
Using a life time allow to save a heap allocation.

closes #1953
2023-01-26 11:02:32 +01:00
Olivier Goffart
a0fdf94fb1 StandardTableView: Remove the editable feature for now
This commit can be reverted when we want to introduce it again.
There is a few bugs with the editable property:
 - The text is not in sync with the model if the model changes after an
   edit. (can be seen by making an edit and then sort)
 - The highlight of the current row doesn't work properly
 - We should probably only edit on double click or some shortcut instead
   of just clicking
 - The editable field exist but does nothing for the StandardListView
2023-01-24 07:31:29 +01:00
Olivier Goffart
48ce61f740 TableViewColumn: document that the widths are in logical pixel 2023-01-23 16:26:49 +01:00
Olivier Goffart
66b848227b StandardTableView resizable columns 2023-01-23 16:26:49 +01:00
Olivier Goffart
5e7f6bd363 Fix panic when resetting the model to a smaller model in a ListView
Regresison in 1162ebbb79:
Before that commit, the vew would never have more items than the model
since the model would communicate what items to remove.
But now, it is possible that the model has less elements than the view
currently displays from the previous model, so we need to account for
that.
2023-01-17 11:14:04 +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
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
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
Olivier Goffart
39aebc1f4e Use the std::ops::Range as range in the repeater
And fix the preview highlight to use that
2022-11-17 12:23:23 +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
Simon Hausmann
c16253d29f Use Property<LogicalLength> instead of Property<Coord>
This removes the special code for the generated property getters and
ensures type safety in the run-time library for property value setting.

In the Rust generated code we continue to do arithmetic on the scalar
values, that means we immediately extract the scalar, do arithmetic and
rely on the compiler to only allow compatible units.

Danger zone alert: In the interpreter Value::Number can now be converted
to LogicalLength as-is.
2022-10-24 12:49:37 +02:00
Olivier Goffart
7d90a3673f Add VecModel::extend, tests, and changelog entry for last commit
CC #1678  #1647
2022-10-17 14:40:48 +02:00
David John
a049d72ac5 add VecModel::extend_from_slice 2022-10-17 14:04:49 +02:00
Florian Blasius
5fb31ace02
Florian/rust sorting model (#1712)
Add Rust version of SortModel
2022-10-07 16:24:48 +02:00
Olivier Goffart
2760d96b79 Make VecModel::remove() return the removed value like Vec
Fixes #1221
2022-09-06 05:42:56 +02:00
Olivier Goffart
4d05688730 ListView: try the best to keep the listview elements consistant when scrolling
Even when the average height changes
2022-07-11 19:33:05 +02:00
Olivier Goffart
55155915d2 Fixt listview jumping when scrolling and element have different size
The test test one particular case where we want to expand an item to
the size of the listview when clicking
2022-07-11 19:33:05 +02:00
Tobias Hunger
4da7588af4 Fix component_at in repeaters 2022-07-05 14:27:19 +02:00
Simon Hausmann
cdff68da17 Revert "Fixt listview jumping when scrolling and element have different size"
This reverts commit 1ae0e8f760.

Oops, this was not intended to be pushed to master.
2022-07-04 13:53:39 +02:00
Olivier Goffart
1ae0e8f760 Fixt listview jumping when scrolling and element have different size
The test test one particular case where we want to expand an item to
the size of the listview when clicking
2022-06-30 14:46:34 +02:00
Lukas Jung
ff036d41ec Add model adapters
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2022-05-11 15:50:43 +02:00
Lukas Jung
a36ac901db Add nth() implementation to ModelIterator to improve skip() performance 2022-05-11 15:50:43 +02:00
Olivier Goffart
696ce933f7
Refactor the Model tracking in a module (#1223)
Contain the unsafe code in a smaller module.
Add an abstraction to make it easier to create change listener other
than the repeater.
2022-05-05 10:25:15 +02:00
Olivier Goffart
525e9982d8 Re-export and document ModelExt 2022-05-04 11:08:14 +02:00
Lukas Jung
7c45be97cd Move row_data_tracked to ModelExt trait 2022-05-04 11:08:14 +02:00
Olivier Goffart
86d893245e Model: When items are inserted, sets the components after that as dirty
Because their index property needs to be updated
2022-05-02 11:47:17 +02:00
Olivier Goffart
fd44b2e651 Model: Do not register row data tracker if not needed
Make track_row_data_changes not register a dependency to the row
if there is currently no binding being evaluated.
2022-04-19 15:12:15 +02:00
Olivier Goffart
67e9a59398 Add a Model::row_data_tracked function
Closes #1177
2022-04-19 15:12:15 +02:00
Simon Hausmann
5a270313d2 Improve VecModel::set_vec test
Verify the values reported by `row_count()` in the rows added/remove
callbacks.
2022-04-14 14:20:27 +02:00
Olivier Goffart
f5030cff06
Add a reset function to the model notifier 2022-04-14 14:06:34 +02:00
Olivier Goffart
1b91158b46 corelib: allow to use i32 for coordinate instead of f32 2022-04-11 17:46:50 +02:00
Tobias Hunger
ee68716d07 Component: Add information to stich together ItemTrees
Add accessors to the information necessary to stitch together the
Component-wide ItemTrees (which include DynamicNodes) into one logical
tree of Items.
2022-03-28 14:13:36 +02:00
Simon Hausmann
3a3ce15970 Add a unit test that verifies that VecModel::set_vec notifies the view correctly 2022-03-17 09:47:10 +01:00
Ray Redondo
b265f721f2 add a test 2022-03-17 09:15:58 +01:00
Ray Redondo
94cbaa55d7 add VecModel::set_vec 2022-03-17 09:15:58 +01:00
Lukas Jung
4c61a16c08 add From<&str> and From<SharedString> to StandardListViewItem 2022-03-11 15:45:59 +01:00
Olivier Goffart
bc38d31bcb Save one property dependency when accessing dirty model 2022-03-07 19:06:23 +01:00
Olivier Goffart
c941946f49 Debug: make sure that more properties have debug_name
The global properties, and base properties were not named

This adds a Property::new_named regardless if debug is enabled or not
2022-02-18 17:40:17 +01:00
Olivier Goffart
7a7a21ca54 Fix build with no_std 2022-02-14 16:21:31 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Simon Hausmann
125b90a64b Merge remote-tracking branch 'origin/master' into wip/rename
Conflicts:
	api/cpp/cbindgen.rs
	api/cpp/include/slint.h
	examples/CMakeLists.txt
	examples/imagefilter/Cargo.toml
	examples/plotter/main.rs
	internal/backends/mcu/lib.rs
2022-02-04 16:47:20 +01:00
Olivier Goffart
54d9ebdc19 Fix documentation warnings about non-existing links 2022-02-04 14:53:23 +01:00
Olivier Goffart
03534039d6 Replace more .60 by .slint
Mainly an automated change with
    git grep -O"sed -i 's/\.60/.slint/g'" -w "\.60"

and some manual checks
2022-02-02 10:12:31 +01:00
Simon Hausmann
ad0c020aa4 Rename the sixtyfps-corelib crate 2022-02-01 18:04:30 +01:00
Tobias Hunger
e6b24bceec [reorg]: Set up and populate the internal directory
Move "internal" crates into the `internal` directory. This first batch
includes most of sixtyfps_runtime but leaves the rendering backends
alone for now.

pre-commit applied some cleanups to the moved files:
 - Consistent newline at end of file policy
 - trimming trailing whitespace
 - Formatting Cargo.toml files.
2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_runtime/corelib/model.rs (Browse further)