mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-22 08:12:48 +00:00

Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
49 lines
No EOL
1.3 KiB
Text
49 lines
No EOL
1.3 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
import { StandardTableView } from "std-widgets.slint";
|
|
|
|
TestCase := Rectangle {
|
|
callback set-current-row(int);
|
|
|
|
out property <int> row-count: list.rows.length;
|
|
out property <int> callback-current-row: -1;
|
|
|
|
in-out property<[[StandardListViewItem]]> rows: [
|
|
[{ text: "Item 1" }, { text: "Description"} ],
|
|
[{ text: "Item 1" }, { text: "Description"}],
|
|
[{ text: "Item 1" }, { text: "Description"}],
|
|
];
|
|
in-out property <int> current-row <=> list.current-row;
|
|
|
|
list := StandardTableView {
|
|
rows: root.rows;
|
|
|
|
columns: [
|
|
{ title: "Items" },
|
|
{ title: "Descriptions" },
|
|
];
|
|
|
|
current-row-changed(index) => {
|
|
root.callback-current-row = index;
|
|
}
|
|
}
|
|
|
|
set-current-row(index) => {
|
|
list.set-current-row(index);
|
|
}
|
|
}
|
|
|
|
/*
|
|
|
|
```rust
|
|
let instance = TestCase::new().unwrap();
|
|
assert_eq!(instance.get_row_count(), 3);
|
|
assert_eq!(instance.get_current_row(), -1);
|
|
|
|
assert_eq!(instance.get_callback_current_row(), -1);
|
|
instance.invoke_set_current_row(1);
|
|
assert_eq!(instance.get_callback_current_row(), 1);
|
|
assert_eq!(instance.get_current_row(), 1);
|
|
```
|
|
*/ |