working highlightBar

This commit is contained in:
Chris Cochrun 2023-03-12 06:30:47 -05:00
parent 38bfec602a
commit e2e44f1c3c
2 changed files with 23 additions and 17 deletions

View file

@ -198,6 +198,8 @@ FocusScope {
reuseItems: true reuseItems: true
model: SlideModel model: SlideModel
delegate: Presenter.PreviewSlideListDelegate {} delegate: Presenter.PreviewSlideListDelegate {}
highlight: highlightBar
highlightFollowsCurrentItem: false
Kirigami.WheelHandler { Kirigami.WheelHandler {
id: wheelHandler id: wheelHandler
@ -225,21 +227,24 @@ FocusScope {
} }
Rectangle { Component {
id: activeHighlightBar id: highlightBar
width: Kirigami.Units.gridUnit * 10 Rectangle {
height: Kirigami.Units.gridUnit / 4 id: activeHighlightBar
y: previewSlidesList.y + Kirigami.Units.gridUnit * 6.15 width: Kirigami.Units.gridUnit * 10
x: previewSlidesList.currentItem.x + Kirigami.Units.smallSpacing height: Kirigami.Units.gridUnit / 4
radius: 5 y: Kirigami.Units.gridUnit * 7.35
color: Kirigami.Theme.negativeTextColor x: previewSlidesList.currentItem.x
radius: 5
color: Kirigami.Theme.negativeTextColor
Behavior on x { PropertyAnimation { Behavior on x { PropertyAnimation {
properties: "x" properties: "x"
easing.type: Easing.InOutElastic; easing.type: Easing.InOutElastic;
easing.period: 1.5 easing.period: 1.5
duration: 150 duration: 150
}} }}
}
} }
} }

View file

@ -48,8 +48,9 @@ Item {
id: slidesTitle id: slidesTitle
width: previewHighlight.width width: previewHighlight.width
anchors.top: previewHighlight.bottom anchors.top: previewHighlight.bottom
/* anchors.leftMargin: Kirigami.Units.smallSpacing * 8 */ anchors.left: previewHighlight.left
anchors.topMargin: Kirigami.Units.smallSpacing * 3 anchors.topMargin: Kirigami.Units.smallSpacing
anchors.leftMargin: Kirigami.Units.smallSpacing
elide: Text.ElideRight elide: Text.ElideRight
text: ServiceItemModel.getItem(serviceItemId).name text: ServiceItemModel.getItem(serviceItemId).name
font.bold: true font.bold: true
@ -74,7 +75,7 @@ Item {
function onDataChanged() { function onDataChanged() {
if (active) { if (active) {
previewSlidesList.currentIndex = index; previewSlidesList.currentIndex = index;
previewSlidesList.positionViewAtIndex(index, ListView.Contain); previewSlidesList.positionViewAtIndex(index, ListView.Center);
} }
} }
} }