Delay some delegate removals to reduce CPU spent on recalculating sizes

This commit is contained in:
Nicolas Werner 2023-03-25 22:31:18 +01:00
parent 696419c4f6
commit ef31f67c32
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 3 additions and 0 deletions

View file

@ -125,6 +125,8 @@ Control {
delegate: Rectangle { delegate: Rectangle {
property variant modelData: model property variant modelData: model
ListView.delayRemove: true
color: model.index == popup.currentIndex ? Nheko.colors.highlight : Nheko.colors.base color: model.index == popup.currentIndex ? Nheko.colors.highlight : Nheko.colors.base
height: chooser.child.implicitHeight + 2 * popup.rowMargin height: chooser.child.implicitHeight + 2 * popup.rowMargin
implicitWidth: fullWidth ? ListView.view.width : chooser.child.implicitWidth + 4 implicitWidth: fullWidth ? ListView.view.width : chooser.child.implicitWidth + 4

View file

@ -449,6 +449,7 @@ Item {
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
width: chat.delegateMaxWidth width: chat.delegateMaxWidth
height: section.active ? section.height + timelinerow.height : timelinerow.height height: section.active ? section.height + timelinerow.height : timelinerow.height
ListView.delayRemove: true
Loader { Loader {
id: section id: section