Use hideSource, Luke

And, dear Luke, don't implement the same in twenty eight lines that are
just one property away. RTFM, Luke.
This commit is contained in:
Sebastian Kügler 2013-03-09 01:53:24 +01:00
parent af6e538fa4
commit 64892e1c4e

View File

@ -126,10 +126,10 @@ Item {
id: wobbleShader id: wobbleShader
anchors.fill: frame anchors.fill: frame
property variant source: ShaderEffectSource { property variant source: ShaderEffectSource {
id: theSource hideSource: true
sourceItem: frame sourceItem: frame
} }
opacity: 0
property int fadeDuration: 250 property int fadeDuration: 250
property real amplitude: busyIndicator.visible ? 0.04 * 0.2 : 0 property real amplitude: busyIndicator.visible ? 0.04 * 0.2 : 0
property real frequency: 20 property real frequency: 20
@ -149,30 +149,6 @@ Item {
" gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" + " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" +
"}" "}"
} }
// compose the item on-screen, we want to render
// either the shader item or the source item,
// so swap their opacity as the wobbling fades in
// and after it fades out
Connections {
target: busyIndicator
onVisibleChanged: {
if (busyIndicator.visible) {
wobbleShader.opacity = 1;
frame.opacity = 0;
} else {
hideTimer.start();
}
}
}
Timer {
id: hideTimer
interval: wobbleShader.fadeDuration
onTriggered: {
wobbleShader.opacity = 0;
frame.opacity = 1;
}
}
//! [fragment] //! [fragment]
} }
} }