adding a bar to track the active slide
This commit is contained in:
parent
bb2c58773e
commit
7d11fa86ba
2 changed files with 27 additions and 15 deletions
|
@ -177,23 +177,44 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
|
// The active items X value from root
|
||||||
|
property int activeX
|
||||||
id: previewSlidesList
|
id: previewSlidesList
|
||||||
anchors.top: mainGrid.bottom
|
anchors.top: mainGrid.bottom
|
||||||
anchors.bottom: root.bottom
|
anchors.bottom: root.bottom - Kirigami.Units.gridUnit
|
||||||
width: parent.width
|
width: parent.width
|
||||||
orientation: ListView.Horizontal
|
orientation: ListView.Horizontal
|
||||||
spacing: Kirigami.Units.smallSpacing * 2
|
spacing: Kirigami.Units.smallSpacing * 2
|
||||||
cacheBuffer: 900
|
cacheBuffer: 900
|
||||||
reuseItems: true
|
reuseItems: true
|
||||||
|
|
||||||
model: serviceItemModel
|
model: serviceItemModel
|
||||||
delegate: Presenter.PreviewSlideListDelegate {}
|
delegate: Presenter.PreviewSlideListDelegate {}
|
||||||
|
|
||||||
Kirigami.WheelHandler {
|
Kirigami.WheelHandler {
|
||||||
id: wheelHandler
|
id: wheelHandler
|
||||||
target: previewSlidesList
|
target: previewSlidesList
|
||||||
filterMouseEvents: true
|
filterMouseEvents: true
|
||||||
|
onWheel: {
|
||||||
|
wheel.accepted = true;
|
||||||
|
showPassiveNotification(wheel.inverted)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: activeHighlightBar
|
||||||
|
width: previewSlidesList.currentItem.width - Kirigami.Units.smallSpacing * 2
|
||||||
|
height: Kirigami.Units.gridUnit / 4
|
||||||
|
y: previewSlidesList.y + Kirigami.Units.gridUnit * 6
|
||||||
|
x: previewSlidesList.currentItem.x + Kirigami.Units.smallSpacing
|
||||||
|
radius: 5
|
||||||
|
color: Kirigami.Theme.negativeTextColor
|
||||||
|
|
||||||
|
Behavior on x { PropertyAnimation {
|
||||||
|
properties: "x"
|
||||||
|
easing.type: Easing.InOutQuad;
|
||||||
|
duration: 150
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -66,17 +66,6 @@ Item {
|
||||||
onClicked: changeSlideAndIndex(outerModelData, index)
|
onClicked: changeSlideAndIndex(outerModelData, index)
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: activeHighlightBar
|
|
||||||
width: previewSlideItem.width
|
|
||||||
height: Kirigami.Units.gridUnit / 4
|
|
||||||
anchors.top: previewSlideItem.bottom
|
|
||||||
anchors.left: previewSlideItem.left
|
|
||||||
anchors.topMargin: Kirigami.Units.smallSpacing
|
|
||||||
color: Kirigami.Theme.negativeTextColor
|
|
||||||
visible: outerModelData.active && SlideObject.slideIndex == index - 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,15 +94,17 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: serviceItemModel
|
target: serviceItemModel
|
||||||
onDataChanged: if (active)
|
onDataChanged: if (active)
|
||||||
previewSlidesList.positionViewAtIndex(index, ListView.Center)
|
previewSlidesList.positionViewAtIndex(index, ListView.Contain)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeSlideAndIndex(serviceItem, index) {
|
function changeSlideAndIndex(serviceItem, index) {
|
||||||
// TODO
|
// TODO
|
||||||
console.log("Item: " + serviceItem.index + " is " + serviceItem.active);
|
console.log("Item: " + serviceItem.index + " is " + serviceItem.active);
|
||||||
if (!serviceItem.active)
|
if (!serviceItem.active) {
|
||||||
changeServiceItem(serviceItem.index)
|
changeServiceItem(serviceItem.index)
|
||||||
|
previewSlidesList.currentIndex = serviceItem.index;
|
||||||
|
}
|
||||||
console.log("Slide Index is: " + index);
|
console.log("Slide Index is: " + index);
|
||||||
if (index === 0)
|
if (index === 0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue