Keep the highlighted ListView item centered

This commit is contained in:
miruka 2019-08-19 14:46:40 -04:00
parent c841a7a841
commit 99bbe7f3ee
2 changed files with 12 additions and 0 deletions

View File

@ -1,4 +1,6 @@
- Refactoring - Refactoring
- Don't show the highlight rectangle sliding when clicking room
- Make room loading faster
- Filter smart case - Filter smart case
- Make all icon SVG files white/black, since we can now use ColorOverlay - Make all icon SVG files white/black, since we can now use ColorOverlay
- Make the icon blue in EditAccount when hovering and no avatar set - Make the icon blue in EditAccount when hovering and no avatar set

View File

@ -6,6 +6,16 @@ ListView {
currentIndex: -1 currentIndex: -1
highlightMoveDuration: theme.animationDuration highlightMoveDuration: theme.animationDuration
// Keep highlighted delegate at the center
highlightRangeMode: ListView.ApplyRange
preferredHighlightBegin: height / 2 - currentItemHeight
preferredHighlightEnd: height / 2 + currentItemHeight
readonly property int currentItemHeight:
currentItem ? currentItem.height : 0
highlight: HRectangle { highlight: HRectangle {
color: theme.controls.interactiveRectangle.checkedOverlay color: theme.controls.interactiveRectangle.checkedOverlay
opacity: theme.controls.interactiveRectangle.checkedOpacity opacity: theme.controls.interactiveRectangle.checkedOpacity