mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
Do not trigger current-item-changed on StandardListView if current-item is set on the same value (#5958)
This commit is contained in:
parent
1d434ad242
commit
7a0c3dcc50
3 changed files with 11 additions and 4 deletions
|
@ -8,6 +8,7 @@ All notable changes to this project are documented in this file.
|
|||
### Widgets
|
||||
|
||||
- Fixed `TextEdit` not invoking `edited` callbacks (#5848).
|
||||
- Do not trigger `current-item-changed` on `StandardListView` if `current-item` is set on the same value.
|
||||
|
||||
## [1.7.2] - 2024-08-14
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ component StandardListViewBase inherits ListView {
|
|||
in-out property <int> current-item: -1;
|
||||
|
||||
callback current-item-changed(/* current-item */ int);
|
||||
callback item-pointer-event( /* item-index */ int, /* event */ PointerEvent, /* absolute mouse position */ Point);
|
||||
callback item-pointer-event(/* item-index */ int, /* event */ PointerEvent, /* absolute mouse position */ Point);
|
||||
|
||||
public function set-current-item(index: int) {
|
||||
if (index < 0 || index >= model.length) {
|
||||
if index < 0 || index >= model.length || index == root.current-item {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ TestCase := Rectangle {
|
|||
callback set-current-item(int);
|
||||
|
||||
out property <int> count: list.model.length;
|
||||
out property <int> callback-current-item: -1;
|
||||
in-out property <int> callback-current-item: -1;
|
||||
|
||||
in-out property<[StandardListViewItem]> model: [
|
||||
{ text: "Item 1" },
|
||||
|
@ -41,5 +41,11 @@ assert_eq!(instance.get_callback_current_item(), -1);
|
|||
instance.invoke_set_current_item(1);
|
||||
assert_eq!(instance.get_callback_current_item(), 1);
|
||||
assert_eq!(instance.get_current_item(), 1);
|
||||
|
||||
instance.set_callback_current_item(-1);
|
||||
instance.invoke_set_current_item(1);
|
||||
assert_eq!(instance.get_callback_current_item(), -1);
|
||||
assert_eq!(instance.get_current_item(), 1);
|
||||
|
||||
```
|
||||
*/
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue