making a PreviewSlideListDelegate and using a repeater
This commit is contained in:
parent
8442913576
commit
40cb3163e2
4 changed files with 108 additions and 80 deletions
|
@ -187,85 +187,7 @@ FocusScope {
|
|||
reuseItems: true
|
||||
|
||||
model: serviceItemModel
|
||||
delegate: Rectangle {
|
||||
id: previewHighlight
|
||||
property var outerModelData: model
|
||||
implicitHeight: Kirigami.Units.gridUnit * 6
|
||||
implicitWidth: Kirigami.Units.gridUnit * 11
|
||||
border.color: Kirigami.Theme.highlightColor
|
||||
radius: 5
|
||||
color: {
|
||||
if (active || previewerMouse.containsMouse)
|
||||
Kirigami.Theme.highlightColor
|
||||
else
|
||||
Kirigami.Theme.backgroundColor
|
||||
}
|
||||
ListView {
|
||||
id: slidesList
|
||||
anchors.centerIn: parent
|
||||
model: outerModelData.slideNumber === 0 ? 1 : outerModelData.slideNumber
|
||||
width: parent.width * model - 10
|
||||
height: parent.height
|
||||
orientation: ListView.Horizontal
|
||||
cacheBuffer: 900
|
||||
reuseItems: true
|
||||
spacing: Kirigami.Units.smallSpacing
|
||||
Component.onCompleted: {
|
||||
showPassiveNotification("Number of slides: " + outerModelData.slideNumber);
|
||||
parent.width = width;
|
||||
}
|
||||
delegate: Presenter.Slide {
|
||||
id: previewSlideItem
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: Kirigami.Units.gridUnit * 10
|
||||
implicitHeight: width / 16 * 9
|
||||
textSize: width / 4
|
||||
itemType: outerModelData.type
|
||||
imageSource: outerModelData.backgroundType === "image" ? background : ""
|
||||
videoSource: outerModelData.backgroundType === "video" ? background : ""
|
||||
audioSource: ""
|
||||
chosenFont: outerModelData.font
|
||||
text: outerModelData.text[index + 1] === "This is demo text" ? "" : outerModelData.text[index + 1]
|
||||
pdfIndex: 0
|
||||
preview: true
|
||||
editMode: true
|
||||
|
||||
MouseArea {
|
||||
id: innerMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: changeServiceItem(outerModelData.index)
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
id: slidesTitle
|
||||
width: Kirigami.Units.gridUnit * 7
|
||||
anchors.top: slidesList.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.topMargin: 5
|
||||
elide: Text.ElideRight
|
||||
text: name
|
||||
/* font.family: "Quicksand Bold" */
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: previewerMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: changeServiceItem(index)
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
target: serviceItemModel
|
||||
onDataChanged: if (active)
|
||||
previewSlidesList.positionViewAtIndex(index, ListView.Center)
|
||||
}
|
||||
}
|
||||
delegate: Presenter.PreviewSlideListDelegate {}
|
||||
Kirigami.WheelHandler {
|
||||
id: wheelHandler
|
||||
target: previewSlidesList
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue