main.qml Example File
declarative/shadereffects/qml/shadereffects/main.qml
 
 
 import QtQuick 1.0
 import Qt.labs.shaders 1.0
 Item {
     id: main
     width: 360
     height: 640
     Rectangle {
         anchors.fill: parent
         color: "black"
     }
     Image {
         id: header
         source: "images/shader_effects.jpg"
     }
     ListModel {
         id: demoModel
         ListElement { name: "ImageMask" }
         ListElement { name: "RadialWave" }
         ListElement { name: "Water" }
         ListElement { name: "Grayscale" }
         ListElement { name: "DropShadow" }
         ListElement { name: "Curtain" }
     }
     Grid {
         id: menuGrid
         anchors.top: header.bottom
         anchors.bottom: toolbar.top
         width: parent.width
         columns: 2
         Repeater {
             model: demoModel
             Item {
                 width: main.width / 2
                 height: menuGrid.height / 3
                 clip: true
                 Image {
                     width: parent.width
                     height: width
                     source: "images/" + name + ".jpg"
                     opacity: mouseArea.pressed ? 0.6 : 1.0
                 }
                 MouseArea {
                     id: mouseArea
                     anchors.fill: parent
                     onClicked: {
                         demoLoader.source = name + ".qml"
                         main.state = "showDemo"
                     }
                 }
             }
         }
     }
     Loader {
         anchors.fill: parent
         id: demoLoader
         visible: false
         Behavior on opacity {
             NumberAnimation { duration: 300 }
         }
     }
     Image {
         id: toolbar
         source: "images/toolbar.png"
         width: parent.width
         anchors.bottom: parent.bottom
     }
     Rectangle {
         id: translucentToolbar
         color: "black"
         opacity: 0.3
         anchors.fill: toolbar
         visible: !toolbar.visible
     }
     Item {
         height: toolbar.height
         width: height
         anchors.bottom: parent.bottom
         Image {
             source: "images/back.png"
             anchors.centerIn: parent
         }
         MouseArea {
             anchors.fill: parent
             onClicked: {
                 if (main.state == "") Qt.quit(); else {
                     main.state = ""
                     demoLoader.source = ""
                 }
             }
         }
     }
     states: State {
         name: "showDemo"
         PropertyChanges {
             target: menuGrid
             visible: false
         }
         PropertyChanges {
             target: demoLoader
             visible: true
         }
         PropertyChanges {
             target: toolbar
             visible: false
         }
     }
 }