Scroll back to top when contents of table change

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-25 19:05:54 +01:00
parent 2a5abfdb01
commit f22fea5f22
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
2 changed files with 19 additions and 1 deletions

View file

@ -113,7 +113,7 @@ Item
{ {
// Vertical ScrollBar, styled similarly to the scrollBar in the settings panel // Vertical ScrollBar, styled similarly to the scrollBar in the settings panel
id: verticalScrollBar id: verticalScrollBar
visible: flickableView.contentHeight > flickableView.height visible: tableView.contentHeight > tableView.height
background: Rectangle background: Rectangle
{ {
@ -169,5 +169,14 @@ Item
} }
} }
} }
Connections
{
target: model
function onRowCountChanged()
{
tableView.contentY = 0; //When the number of rows is reduced, make sure to scroll back to the start.
}
}
} }
} }

View file

@ -147,5 +147,14 @@ Item
} }
} }
} }
Connections
{
target: model
function onRowCountChanged()
{
tableView.contentY = 0; //When the number of rows is reduced, make sure to scroll back to the start.
}
}
} }
} }