123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- /*
- * Copyright (c) 2011 Nokia Corporation.
- */
- import Qt 4.7
- Rectangle {
- id: slideShow
- function initialize() { }
- color: "black"
- anchors.fill: parent
- // This model information might be better in XML file.
- ListModel {
- id: slidesModel
- ListElement {
- image: "../fancypicker/qtqp_back1.jpg"
- text1: "The Qt Quick Playground demonstrates the features of the Qt Quick"
- text2: "Watch specially for the animations and effects"
- text3: "Check also the QML source code of each demo"
- logo: ""
- }
- ListElement {
- image: "../fancypicker/qtqp_back2.jpg"
- text1: "Most of the code is QML"
- text2: "Some of the logic is made with Javascript"
- text3: "Added with some pieces of Qt"
- logo: ""
- }
- ListElement {
- image: "../fancypicker/qtqp_back3.jpg"
- text1: "Play around"
- text2: "Get to know what Qt Quick offers"
- text3: "Have fun with Qt Quick Playground!"
- logo: ""
- }
- ListElement {
- image: ""
- text1: ""
- text2: ""
- text3: ""
- logo: "Forum_Nokia_03_RGB_strap.gif"
- }
- }
- Component {
- id: delegate
- Item {
- id: slide
- property int fadeDuration: 2000
- property int textAnimationDuration: 2000
- property int textPixelSize: height / 15
- // the slide will cover whole screen
- width: slideShow.width + 1; height: slideShow.height
- Rectangle {
- anchors.fill: parent
- color: "white"
- Image {
- id: background
- source: image
- anchors.fill: parent
- fillMode: "Stretch"
- clip: true
- Text {
- id: t1
- Behavior on x { NumberAnimation { duration: slide.textAnimationDuration; easing.type: "OutCubic" } }
- x: 100
- anchors.top: parent.top; anchors.topMargin: parent.height / 8
- width: parent.width - 100
- wrapMode: "WordWrap"
- text: text1
- color: "white"
- font.bold: true
- font.pixelSize: slide.textPixelSize
- style: Text.Raised
- Behavior on opacity { NumberAnimation { duration: slide.fadeDuration } }
- opacity: 0
- }
- Text {
- id: t2
- Behavior on x { NumberAnimation { duration: slide.textAnimationDuration; easing.type: "OutCubic" } }
- x: 100
- anchors.verticalCenter: parent.verticalCenter
- width: parent.width - 100
- wrapMode: "WordWrap"
- text: text2
- color: "white"
- font.bold: true
- font.pixelSize: slide.textPixelSize
- style: Text.Raised
- Behavior on opacity { NumberAnimation { duration: slide.fadeDuration } }
- opacity: 0
- }
- Text {
- id: t3
- Behavior on x { NumberAnimation { duration: slide.textAnimationDuration; easing.type: "OutCubic" } }
- x: 100
- anchors.bottom: parent.bottom; anchors.bottomMargin: parent.height / 8
- width: parent.width - 100
- wrapMode: "WordWrap"
- text: text3
- color: "white"
- font.bold: true
- font.pixelSize: slide.textPixelSize
- style: Text.Raised
- Behavior on opacity { NumberAnimation { duration: slide.fadeDuration } }
- opacity: 0
- }
- Image {
- id: l
- source: logo
- width: 367; height: 149
- anchors.centerIn: parent
- }
- Timer {
- id: timer
- property int timerPosition: 0
- interval: 2000
- running: true
- repeat: true
- onTriggered: {
- timer.timerPosition = timer.timerPosition + 1
- if(timer.timerPosition == 1) { t1.x = 50; t1.opacity = 1.0 }
- else if(timer.timerPosition == 2) { t2.x = 50; t2.opacity = 2.0 }
- else if(timer.timerPosition == 3) { t3.x = 50; t3.opacity = 3.0 }
- else if(timer.timerPosition == 5) {
- timer.running = false
- t1.opacity = 0
- t2.opacity = 0
- t3.opacity = 0
- if(view.currentIndex == 3) {
- // We will close the slide show when it is done
- sidePanel.closeClicked()
- }
- else {
- view.incrementCurrentIndex() // Change the slide
- }
- }
- }
- }
- }
- }
- }
- }
- ListView {
- id: view
- anchors.fill: parent
- delegate: delegate
- model: slidesModel
- snapMode: "SnapToItem"
- keyNavigationWraps: true
- orientation: "Horizontal"
- cacheBuffer: 0
- interactive: false
- }
- }
|