moment/src/qml/Base/HListView.qml

61 lines
1.5 KiB
QML
Raw Normal View History

import QtQuick 2.12
import QtQuick.Controls 2.12
2019-05-14 03:15:03 +10:00
ListView {
id: listView
interactive: enableFlicking
currentIndex: -1
keyNavigationWraps: true
highlightMoveDuration: theme.animationDuration
// Keep highlighted delegate at the center
highlightRangeMode: ListView.ApplyRange
preferredHighlightBegin: height / 2 - currentItemHeight
preferredHighlightEnd: height / 2 + currentItemHeight
2019-09-07 07:03:52 +10:00
maximumFlickVelocity: 4000
property bool enableFlicking: true
readonly property int currentItemHeight:
currentItem ? currentItem.height : 0
2019-08-28 12:46:31 +10:00
highlight: Rectangle {
color: theme.controls.listView.highlight
}
2019-09-07 06:46:04 +10:00
ScrollBar.vertical: ScrollBar {
visible: listView.interactive || ! listView.enableFlicking
}
// FIXME: HOpacityAnimator creates flickering
add: Transition {
ParallelAnimation {
HNumberAnimation { property: "opacity"; from: 0; to: 1 }
HXAnimator { from: 100 }
HYAnimator { from: 100 }
}
}
move: Transition {
ParallelAnimation {
// Ensure opacity goes to 1 if add/remove transition is interrupted
HNumberAnimation { property: "opacity"; to: 1 }
HXAnimator {}
HYAnimator {}
}
}
remove: Transition {
ParallelAnimation {
HNumberAnimation { property: "opacity"; to: 0 }
HXAnimator { to: 100 }
HYAnimator { to: 100 }
}
}
displaced: move
2019-05-14 03:15:03 +10:00
}