import QtQuick 2.0
import QtQuick.Controls 1.4
Rectangle {
id: window
width: 600
height: 500
gradient: Gradient {
GradientStop { position: 0; color: "lightsteelblue" }
GradientStop { position: 1; color: "black" }
}
Image {
id: img
width: 300
height: 170
source: "qrc:/src/pic/3.jpeg"
}
Button{
id:btn
anchors.left: img.right
width: 100
height: 60
layer.enabled: true
layer.effect: Component{
Rectangle{
color: "green"
Text {
anchors.centerIn: parent
text: qsTr("Button")
}
}
}
}
Rectangle{
id:rect
color: "red"
anchors.left: btn.right
width: 100
height: 60
}
ShaderEffect {
id:efft
width: img.width
height: img.height
x:img.x
y:img.y+img.height+2
property variant source: img
fragmentShader: "
varying highp vec2 qt_TexCoord0;
uniform lowp sampler2D source;
void main() {
lowp vec2 tc = qt_TexCoord0 * vec2(1, -1) + vec2(0, 1);
lowp vec4 col = texture2D(source, tc);
gl_FragColor = col * (1.0 - qt_TexCoord0.y) * 0.5;
}"
}
}