mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Revert #1049
This breaks the printer demo USB page, it makes it impossible to change the current item. That's because the printer demo do `current-item: 1;` to preselect the cat. But that breaks the property binding that makes current-item follow the actual-current-item. * Revert "move actual-current-item to FocusScope" This reverts commit8240531e6e
. * Revert "reset StandardListView's current-item if it is out of bounds" This reverts commit9d18882f9d
.
This commit is contained in:
parent
894ee5aa91
commit
8a4d6a34ba
2 changed files with 10 additions and 12 deletions
|
@ -447,7 +447,7 @@ export ListView := ScrollView {
|
|||
|
||||
export StandardListView := ListView {
|
||||
property<[StandardListViewItem]> model;
|
||||
property<int> current-item: min(fs.actual-current-item, model.length - 1);
|
||||
property<int> current-item: -1;
|
||||
for item[idx] in model : Rectangle {
|
||||
l := HorizontalLayout {
|
||||
padding: 8px;
|
||||
|
@ -462,17 +462,16 @@ export StandardListView := ListView {
|
|||
touch := TouchArea {
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
clicked => { fs.actual-current-item = idx; }
|
||||
clicked => { current-item = idx; }
|
||||
}
|
||||
}
|
||||
fs := FocusScope {
|
||||
property<int> actual-current-item: -1;
|
||||
FocusScope {
|
||||
key-pressed(event) => {
|
||||
if (event.text == Keys.UpArrow && current-item > 0) {
|
||||
actual-current-item -= 1;
|
||||
current-item -= 1;
|
||||
return accept;
|
||||
} else if (event.text == Keys.DownArrow && current-item + 1 < model.length) {
|
||||
actual-current-item += 1;
|
||||
current-item += 1;
|
||||
return accept;
|
||||
}
|
||||
reject
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue