Added SlideShow Component

parents
import QtQuick 2.0
Item {
id: slideShowRoot
anchors.fill: parent
visible: false
property int pauseDuration: 500
property int fadeDurantion: 500
property int currentChild: 0
property var endCallback: function() { console.log("SlideShow Dummy End Callback") }
Component.onCompleted: {
configure()
}
function configure() {
console.log("SlideShow: configure()")
visible = false
for (var i = 1; i < slideShowRoot.children.length; i++) {
slideShowRoot.children[i].opacity = 0.0
slideShowRoot.children[i].visible = false
}
visible = true
var nChildren = slideShowRoot.children.length - 1
console.log("SlideShow: configure() has ",nChildren," children.")
if (nChildren > 0) {
currentChild = 1
} else {
currentChild = 0
}
}
function start() {
console.log("SlideShow: start()")
if (currentChild > 0) {
next()
} else {
console.log("SlideShow: start() No Children")
}
}
function next() {
if (currentChild < slideShowRoot.children.length) {
console.log("SlideShow: next() is ",currentChild)
theAnimation.target = slideShowRoot.children[currentChild]
theAnimation.showStopCallback = function() { pauseTime.start() }
theAnimation.hideStopCallback = function() { slideShowRoot.next() }
theAnimation.show()
currentChild++
} else {
console.log("SlideShow: next() Finished")
slideShowRoot.endCallback()
configure()
}
}
Item {
FadeInOutAnim {
id: theAnimation
duration: fadeDurantion
}
Timer {
id: pauseTime
interval: pauseDuration
repeat: false
onTriggered: {
theAnimation.hide()
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment